iamycy / diffwave-sr

https://iamycy.github.io/diffwave-sr/
MIT License
79 stars 8 forks source link

run lfilter on GPU #2

Open yoyolicoris opened 1 year ago

yoyolicoris commented 1 year ago

depends on yoyololicon/audio#12

csteinmetz1 commented 1 year ago

You can also implement a fast IIR filter on GPU by approximating it with an FIR filter and then apply the filter in the frequency domain via FFT. You can see an example here: https://github.com/adobe-research/DeepAFx-ST/blob/49bd0c88f3a0ad8b9c45f88200b4caa74952c43d/deepafx_st/processors/autodiff/signal.py#L158

yoyolicoris commented 1 year ago

Thanks for the suggestion, Chris. I see where you're talking and it's a reasonable workaround in pytorch, but performing FFT is kind of overkill for low-order IIR in my opinion, especially when the input sequence is long. I'm looking into custom cuda kernel for IIR and have some preliminary results on torchaudio. This issue can be solved easily after my PR is merged.