Cannot load the .wav file captured by AudioCaptureRaw in Matlab
-
mardi 21 juin 2011 20:49
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
Toutes les réponses
-
mercredi 22 juin 2011 07:38Propriétaire
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 -
mardi 5 juillet 2011 10:36
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...
- Modifié EsbenMadsen mercredi 6 juillet 2011 07:59
- Proposé comme réponse Eddy Escardo-Raffo [MSFT]Microsoft Employee, Owner jeudi 7 juillet 2011 22:45
- Marqué comme réponse Eddy Escardo-Raffo [MSFT]Microsoft Employee, Owner mercredi 13 juillet 2011 06:19
-
jeudi 19 avril 2012 00:25
thanks ,.
the matlab hack worked pretty well.
seenarvce
-
vendredi 20 avril 2012 07:11
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
-
lundi 23 avril 2012 04:33
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
-
mardi 24 avril 2012 03:18
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);

