Remove the first .5 of a second from Wav file

2019-08-27 18:10发布

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

标签: c# audio wav
3条回答
三岁会撩人
2楼-- · 2019-08-27 18:43

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

查看更多
该账号已被封号
3楼-- · 2019-08-27 18:43

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

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-08-27 18:45

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.
查看更多
登录 后发表回答