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).
- Git clone this repository
git clone https://github.com/nperraud/sparsity-audio-inpainting.git
- Download the UNLocBoX
- Download the LTFAT (the compiled library of the LTAT are important for efficiency)
- Add the UNLocBoX to your path. In MATLAB, go to the root directory of the UNLocBoX and run
init_unlocbox
- Add the LTFAT to your path. In MATLAB, go to the root directory of the LTFAT and run
ltfatstart
- Run the demo. In MATLAB, go to the folder of this repository and run
demo_audio_inpainting
- 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.
- They might be a solution for that too. Please raise an issue.
This code has not been tested extensively.