PedalNetRT
PedalNetRT copied to clipboard
Bug when calculating pre-emphasis filter for plotting
Hello!
When plotting, the following function is not calculating correctly the pre-emphasis filter: https://github.com/GuitarML/PedalNetRT/blob/238aca13db1aac87cbfd8df06a8d5960c9641f13/plot_wav.py#L24
The correct implementation is being used in the model: https://github.com/GuitarML/PedalNetRT/blob/238aca13db1aac87cbfd8df06a8d5960c9641f13/model.py#L106
At high level this is given a signal x, in order to calculate x[t] you do:
x[t] = x[t] - 0.95*x[t - 1]
btw, great project! :+1:
@ivanpondal Thanks for catching that, I will check it out, and I'll also check that in the GuitarLSTM repo because I might be making the same mistake there.
@ivanpondal Sorry for the delay in responding to this, but if you compare the two implementations, aren't they doing the same thing? The one in plot code is using numpy arrays and the one in the model is using pytorch tensors.
Hey! The problem is it's not using the previous element for the substraction. The pytorch implementation does:
x[:, :, 1:] - coeff * x[:, :, :-1]
That list slicing produces the desired x[t] = x[t] - 0.95*x[t - 1] while the numpy implementation does the substraction over the same list element.
Got it now, good catch!