Skip to content
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

TypeError: "NoneType" object is not subscriptable when converting some wav file #5

Open
AaronZhangAus opened this issue Apr 18, 2024 · 4 comments
Assignees

Comments

@AaronZhangAus
Copy link

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.

@cristoper cristoper self-assigned this Apr 18, 2024
@cristoper
Copy link
Owner

Hi,

Is it possible for you to share one of the wav files that produces the error?

@AaronZhangAus
Copy link
Author

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.

cristoper added a commit that referenced this issue Apr 19, 2024
This is because Python's `wave` module does not support floating point
WAV files, though there is an upstream bug report and PR:

python/cpython#60729

I believe this is the root-cause of Issue #5
@cristoper
Copy link
Owner

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: python/cpython#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).

@AaronZhangAus
Copy link
Author

thanks Cristoper for the prompt response. I will give it a try and keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants