I am trying to develop an application using the JUCE library that can record an audio or open an audio file. The audio file is to be passed into the openSMILE program to have its feature values extracted. All audio files are in wave format and the application is to be finally built for the iPhone platform.
I have developed the part of the application that allows the application to record audio and open an audio file from the file directory. I am able to pass some audio files into openSMILE to have their feature values extracted, but not others. All those recorded from the JUCE application itself all cannot be passed in.
The error produced when passing those audio files that cannot be passed is as follows:
smilePcm: Riff: 46464952
Format: 45564157
Subchunk1ID: 4b4e554a
Subchunk2ID: 0
AudioFormat: 0
Subchunk1Size: 34smilePcm: bogus wave/riff header or file in wrong format ('Audio/Audio Recording.wav')! (maybe you are trying to read a 32-bit wave file which is not yet supported (new header type...)?)(ERROR) [1] in cWaveSource: failed reading wave header from file 'Audio/Audio Recording.wav'! Maybe this is not a WAVE file?
To try to find the cause of the error, I then extracted information about the wave headers of the passable and non-passable audio files using Riffpad.
In the audio files that could be passed into the openSMILE program, the wave file header information are as follows:
Audio 1
RIFF-WAVE - (len= 180260, off= 12)
fmt - (len=16, off=20)
data - (len=180224, off=44)
Audio 2
RIFF-WAVE - (len= 19236, off= 12)
fmt - (len=16, off=20)
data - (len=19200, off=44)
And the non-passable ones are as follows:
Audio 3 <---Recorded from my JUCE application
RIFF-WAVE - (len= 128096, off= 12)
JUNK - (len=52, off=20)
fmt - (len=16, off=80)
data - (len=128000, off=104)
Audio 4 <---A random audio file that also can't be passed into openSMILE
RIFF-WAVE - (len= 21289308, off= 12)
fmt - (len=40, off=20)
fact - (len = 4, off=68)
data - (len=21289248, off=80)
I am guessing (correct me if I am wrong) that the error would be removed if I can remove the JUNK subchunk from the wave file recorded, i.e. Audio 3, so that the headers will be similar to that in the passable audio files.
I thought of 2 possibilities that might be able to resolve this issue:
Record Juce Audio with a header format similar to the passable audio file headers (most straightforward and preferred method, if workable)
Convert the Audio file after recording, so that the headers will be similar (I have read that using libsndfile and Audio Compression Manager (ACM) might work, but I am not sure if they are workable for cross platform that JUCE can build to, e.g. iPhone)
For the first way, is there any way I can record Audio in the 'right' format as with the passable audio files?
For the second way, could I use a library that can be built for cross platform, or somehow take out the data chunk of the recorded audio, and add a header with the 'right' format to it? (What i gathered from what I read is that, the JUNK allows for information to be included, and if it is not required, can be skipped. I presume that removing it would not be a problem, as long as i edit the total length from the RIFF-WAVE subchunk.)
Are any of the methods above possible, and if so, how should I carry them out?
Thanks!
Solved: Apparently there was a comment in wavAudioFormat.cpp on enabling JUCE_WAV_DO_NOT_PAD_HEADER_SIZE
to remove JUNK padding.
Leaving the steps here for anybody who want to record audio in wavAudioFormat but have "crappy wav players" that cannot read the padded recorded audio:
JUCE_WAV_DO_NOT_PAD_HEADER_SIZE
to the list.