Cannot load the .wav file captured by AudioCaptureRaw in Matlab
-
Tuesday, June 21, 2011 8:49 PM
Hi everyone,
I want to use the 4-mic wave file obtained by running the provided sample AudioCaptureRaw.exe to perform extended experiments in Matlab. However, when I tried to use wavread() to load the file, I got error:
Error using ==> wavread at 127
Data compression format (Format #65534) is not supported.I googled the error but found no efficient way to address the problem since I have a huge Kinect audio files to be processed in Matlab. Is there any way to modify the API code or could someone tell me the solutions? I appreciate your help!
Lee
All Replies
-
Wednesday, June 22, 2011 7:38 AMOwner
Lee,
I haven't used matlab in a while, so I don't know all the features of its wav file reader, but it might help you to know that the file output by AudioCaptureRaw.exe is a 4-channel wav file, not a more standard 1-channel (mono) or 2-channel (stereo), because it includes raw audio from each of the microphones in a 4-microphone array. Does matlab support reading 4-channel wav files?
Hope this helps!
Eddy
I'm here to help -
Tuesday, July 05, 2011 10:36 AM
The problem is that the file is not actually "normal PCM data", like they write in the source, but actually in the "exstensible" format (which is 0xfffe) - see http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html for WAVE header documentation. Later in the header (as part of the GUID field) it is specified that the PCM is saved in IEEE float format.
Changing the "compression code" to 0x0003 (eg. in a hex editor), you can now read the wav in matlab and it actually looks like a wave file in 4 channels...A small matlab hack, that does the trick is:
fname='out.wav';f=fopen(fname,'r+'); fseek(f,20,0); fwrite(f,[3 0]); fclose(f); y=wavread(fname);
(overwrite the compression code in the file with one matlab understands before loading it) - you could also just do the open-seek-write-close to a bunch of recorded wav files to fix them... after "fixing" the file it now also works in standards compliant audio players like VLC and not just in windows media player...Edit: Fixed contents to match the truth rather than my initial guess so noone get's confused and merged in my second post...
- Edited by EsbenMadsen Wednesday, July 06, 2011 7:59 AM
- Proposed As Answer by Eddy Escardo-Raffo [MSFT]Microsoft Employee, Owner Thursday, July 07, 2011 10:45 PM
- Marked As Answer by Eddy Escardo-Raffo [MSFT]Microsoft Employee, Owner Wednesday, July 13, 2011 6:19 AM
-
Thursday, April 19, 2012 12:25 AM
thanks ,.
the matlab hack worked pretty well.
seenarvce
-
Friday, April 20, 2012 7:11 AM
hello:
i'm so sorry , i still not Understand it.I want to use the 32-mic wave file obtained by em32 Eigenmike microphone array.I got the same error:
??? Error using ==> wavread at 166
Data compression format (Format #65534) is not supported.if i do it in your way as:
fname='C:\Documents and Settings\Administrator\desktop\wav\file0.wav';
f=fopen(fname,'r+');
fseek(f,20,0);
fwrite(f,[3 0]);
fclose(f);
y=wavread(fname);I got the error:
??? Error using ==> fseek
Invalid file identifier. Use fopen to generate a valid file identifier.Error in ==> testwavread at 3
fseek(f,20,0);Hope for your help!huang
-
Monday, April 23, 2012 4:33 AM
Hi,
it worked well for me.I got my wav file named out_hello split into 4 channel file like this.
fname='out_hello.wav';
f=fopen(fname,'r+');
fseek(f,20,0);
fwrite(f,[3 0]);
fclose(f);
y=wavread(fname);
wavwrite(y(:,1),16000,"out_hello_1.wav");
wavwrite(y(:,2),16000,"out_hello_2.wav");
wavwrite(y(:,3),16000,"out_hello_3.wav");
wavwrite(y(:,4),16000,"out_hello_4.wav");seenarvce
-
Tuesday, April 24, 2012 3:18 AM
hi,
I do not understand why it not work well for me .
fname='F:\music\wav\file0.wav';
f=fopen(fname,'r+')
fseek(f,20,0)
fwrite(f,[3 0])
fclose(f)
y=wavread(fname);I'm Really depressed,It Still was this error:————————————————————————————————————
??? Error using ==> wavread at 166
Data compression format (Format #65534) is not supported.Error in ==> myfread at 8
y=wavread(fname);

