开发者

How to remove header of a wavfile in Matlab

I need to remove first 1024 bytes of a wave file. I tried to do but I got corrupted/distorted wavfile:

wavFile = fopen(fullFileName, 'r'); % Open file for reading 
fseek (wavFile, 1024, -1);% Skip past header, which is 1024 bytes long.
wF = fread (wavFile, inf, 'int16');% 16-bit signed integers
wF = wF(:)';
newWavFile = fopen(strcat('new_',fileNa开发者_StackOverflow社区mes(fileNo).name), 'w+');% Open file for reading
fwrite(newWavFile,wF);
fclose(wavFile);

What can be the problem?


I could manage to remove header and correct the distortion by :

            wavFile = fopen(fullFileName, 'r');% Open file for reading 
            fseek (wavFile, 1024, -1);% Skip past header, which is 1024 bytes long.
            wF = fread (wavFile, inf, 'int16');% 16-bit signed integers
            wF = wF(:)';
            wF = 0.8*wF/max(abs(wF));
            newWavFile =strcat('1_',fileNames(fileNo).name);% Open file for reading
            wavwrite(wF,16000,16,newWavFile);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜