acids-ircam / ddsp_pytorch

Implementation of Differentiable Digital Signal Processing (DDSP) in Pytorch
Apache License 2.0
451 stars 56 forks source link

Loudness is computed in a wrong way #31

Open nielsrolf opened 3 years ago

nielsrolf commented 3 years ago

Hello, Some time ago, I noticed a bug in compute_loudness in magenta/ddsp, and I think this repo has a similar issue. Below is the loudness curve extracted for a sine wave with pitch interpolating linearly between 100Hz to 4000Hz image Here is a notebook that compared the magenta/ddsp loudness, the proposed fix and the loudness as computed by this repo. I would be happy to create a pull request if you agree that this should be fixed. Here is a colab notebook that generated the graph above

caillonantoine commented 3 years ago

Hi! Thanks for the issue ! About the PR, sure! Most of the preprocessing stuff is heavily inspired from the original repo so I guess it could use a fix !

nielsrolf commented 3 years ago

Do you prefer to keep the loudness computation in librosa/numpy over doing it in torch as well? I imagine there could be cases where you'd like to backpropagate through this, for example when you do self-supervised training like in the inv-DDSP paper (although that particular model does not use compute_loudness at all).