-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
torchaudio #4
Comments
First this project is a DSP hobby, so I'm quite happy to reimplement things that already exists. from torchaudio.compliance import kaldi
import torch
import julius
x = th.randn(1, 44100 * 10)
rolloff = 0.99 # lowpass filter freq used by torchaudio
zeros = 6 # use the same number of zero crossing as torchaudio
for from_sr, to_sr in [(5, 7), (7, 5)]:
print("comparing for", from_sr, to_sr)
%timeit kaldi.resample_waveform(x, from_sr, to_sr)
%timeit julius.resample_frac(x, from_sr, to_sr, rolloff=rolloff, zeros=zeros)
yt = kaldi.resample_waveform(x, from_sr, to_sr)
yj = julius.resample_frac(x, from_sr, to_sr, rolloff=rolloff, zeros=zeros)
print(torch.norm(yt - yj)) comparing for 5 7
32.4 ms ± 309 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
4.46 ms ± 44.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
tensor(8.7085e-05)
comparing for 7 5
12.9 ms ± 323 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
2.83 ms ± 43.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
tensor(5.1333e-05) Julius implementation is also shorter in terms of code. |
Bug report opened pytorch/audio#1057 |
Great, I agree that we can learn a lot to re-implement something, and it would be even better as share your idea to benefit the whole community. Thank you. |
The implementation from julius is now part of Torchaudio: pytorch/audio#1087 :) |
Nice work.
But it seems there're already resample implemented by conv1d in pytorch's official torchaudio
Is there any necessary to implement it again?
The text was updated successfully, but these errors were encountered: