output is very stretched
silburt opened this issue · 5 comments
Great tool, been having some fun exploring this. However I have noticed that sometimes the output WAV file gets distorted/stretched in the time dimension when running predict.py. I have attached a zip file showing the example input wav and resulting output. Any idea why this happens? The output looks to be exactly twice as long... making me think there is some systematic stretching going on?
Hi silburt, thanks for reporting this. Any chance the data is not 44.1kHz? Everything is coded to work with data with that sample rate. If the data is in fact 44.1kHz please let me know and I'll take a look tomorrow :)
Yes it is indeed 44.1kHz. Thanks for the speedy reply and taking a look!
So i took a look at your input.wav
file; it appears that is is stereo file (two channels) so it must be flattened into one:
>>> from scipy.io import wavfile
>>> rate, data = wavfile.read("Archive/input.wav")
>>> data.shape
(1762236, 2) # observe two channels
>>> wavfile.write("Archive/mono_input.wav", rate, data[:, 0]) # write first channel only
I tested you audio after doing this and it works well (I have including the mono input and output below). I believe the 2x slowdown was caused by the 2 channel audio being flattened into 1 channel with twice the length.
Great playing by the way! The sound produced in this case doesn't seem as harsh as with the electric, it seems like a boost with a little bit of "dirt". With your permission (and credit), I would love to add these as examples to my blog post!
Hey, thanks very much for looking into this. I can confirm that this solution works on my end too. Happy to have you put this on your blog post. Full disclaimer that it is not my playing, it's literally a random WAV file I had on my computer since forever ago, that I probably got from the web somewhere once upon a time?? I suppose if someone ever reads your blog post and claims it's them you can just take it down haha...
Awesome, haha I don't think that should be an issue. When I get a chance I'll add this code to predict.py
to avoid this issue in the future!