Audio inpainting using sparsity prior (MATLAB)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This code solves a sound inpainting problem, i.e. the recovery of missing audio content for a short period of time.

It uses the assumption that the sound has a supposedly sparse time-frequency representation. The recovery problem is expressed as a convex optimization problem:

	x^* = argmin_x  || x ||_1     s. t.   M Gx = y
	sol = Gx,

where x is the time frequency representation of the solution, M a masking operator, y the known audio content and G the inverse Short Time Fourier Transform (iSTFT).


  1. Git clone this repository
	git clone
  1. Download the UNLocBoX
  2. Download the LTFAT (the compiled library of the LTAT are important for efficiency)
  3. Add the UNLocBoX to your path. In MATLAB, go to the root directory of the UNLocBoX and run
  1. Add the LTFAT to your path. In MATLAB, go to the root directory of the LTFAT and run
  1. Run the demo. In MATLAB, go to the folder of this repository and run

The result of the audio inpainting is bad?

  • This code will not work if the missing content is too long.
  • You may want to adapt the parameters of the Short Time Fourier Transform to your problem.

The result of the audio inpainting is slow?

  • They might be a solution for that too. Please raise an issue.


This code has not been tested extensively.