wav2vec
wav2vec copied to clipboard
TypeError: "NoneType" object is not subscriptable when converting some wav file
Hi, wav2vec team.
I received "TypeError: "NoneType" object is not subscriptable" as in the screenshot attached when I converted some wav files while others seem to be OK.
Can you pls give some ideas what caused it?
Thank you.
Hi,
Is it possible for you to share one of the wav files that produces the error?
thanks for getting back to me Chris. I used this public dataset: https://github.com/irfankamboh/DeepShip/tree/main
I can't upload wav file here as it only accepts images. if you run wav2vec on a wav file e.g in PassengerShip or other ships folders, you will replicate the issue.
Areas I have looked into but no findings are:
- codec of the wav file
- file access on Linux, normal as other wav files
- sample rate of the wav file
thanks for looking into this. Look forward to hear back from you.
Hi Aaron,
It looks like .wav files in that directory use floating point data samples, but unfortunately Python's wave
module only supports reading integer data. There is an open Python bug report and PR, but it is not yet merged: https://github.com/python/cpython/issues/60729
I think the only workaround would be to first convert the .wav files to a non-floating point format. One way to do that is to open the files in Audacity and then export them as signed 32 bit PCM WAV files. You can probably automate the conversion with the ffmpeg
command line tool (this works for me: ffmpeg -i ~/Downloads/1.wav 1_converted.wav
which produces a 16 bit WAV file that wav2vec
can read).
thanks Cristoper for the prompt response. I will give it a try and keep you posted.