Remove the first .5 of a second from Wav file

北慕城南 提交于 2019-12-13 04:55:43

问题


How can I remove the first .5 of a second from Wav file?


回答1:


Here is the format. You need to open up the file, find the size of the header, then remove the required number of samples. You can find the number of bits per sample in the header. A 16-bit WAV file at a sampling rate of 44100 Hz would require you to remove (16/8) * 44100 * 0.5 = 44100 bytes




回答2:


A quick Google search turned up a library that may be able to do this.




回答3:


If you need to do it programatically, you need a wav file parser. The general algorithm would be

A) open the file
b) find the fmt chunk
c) parse to calculate X =  bytes per sample * samples per second.
d) find the data chunk
e) remove the first X bytes
f) adjust the size of the data chunk
g) adjust the size of the initial RIFF chunk.
h) write the new file.


来源:https://stackoverflow.com/questions/4786660/remove-the-first-5-of-a-second-from-wav-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!