我需要删除波形文件的前1024个字节。我试着这样做但是我的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_',fileNames(fileNo).name), 'w+');% Open file for reading
fwrite(newWavFile,wF);
fclose(wavFile);
可能是什么问题?
答案 0 :(得分:1)
我可以设法删除标题并通过以下方式纠正失真:
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);