# How to convert NIST to RIFF wav file

I have a dataset of audios(namely TIDIGITS, collected at Texas Instruments, Inc.) and they are in .wav format. However, when I try to read them from python, I get the following error:

Error: file does not start with RIFF id


Error is thrown from the following line:

import wave
...
f = wave.open(/path/to/audio/example.wav, "rb")


I searched on the Internet, and it looks like the problem is that "wave" library does not support NIST formats and the audio are in the NIST SPHERE format, according to the dabaset's website: https://catalog.ldc.upenn.edu/ldc93s10

So I transformed them into .wav using "sox" program:

find . -name '*.wav' | xargs -I@ bash -c "sox @ @"


The command reads though all of my ".wav" files and then applies

sox name.wav name.wav


to transform them to RIFF format.

However, now when I play the files in my media player, I get no sound. The waveform of the audio becomes as follows:

Where it should be something like this:

I think the problem lies at the sox command.

Can anyone help me to convert all of my data to a RIFF format, so that I could read them from the "wave" library?

EDIT: Also, now I noticed, that when I apply the sox command to only one file, the file is converted to "RIFF" format and the waveform is similar to the second image, however when I apply them to all of them with the above described command, the audios loose their sound.

• Ask TI which format the files are in: .wav is just a file name extension, and that says exactly nothing about the file format. – Marcus Müller Apr 30 '18 at 9:26
• Hello @MarcusMüller! As I mentioned, on the TI website, there is written that "The waveform files are in the NIST SPHERE format." – UrmLmn Apr 30 '18 at 9:30
• You didn't say that, you said you inferred from something you read "on the internet", so I needed you to confirm that we're not only guessing it's that format, but have certainty. Can you still link to where you read that, please? Might help a lot! Where did you read that Sox can read SPHERE files? – Marcus Müller Apr 30 '18 at 9:32
• Also, now I noticed, that when I apply the sox command to only one file, the file is converted to "RIFF" format and the waveform is similar to the second image, however when I apply them to all of them with the above described command, the audios loose their sound. The page of the dataset is here: catalog.ldc.upenn.edu/ldc93s10 – UrmLmn Apr 30 '18 at 9:36
• Please edit your question to include that link! The chances that you get an answer when people don't have to read all the comments to get all the details are way higher :) – Marcus Müller Apr 30 '18 at 9:38