开发者

How do i sample an audio file say .wav , in an 8 bit 8khz parameter

开发者 https://www.devze.com 2023-04-05 11:32 出处:网络
i am not that big on programming and i need to sample an audio file that is recorded via a mobile, i understand that the mobile device records the voice, and there are sample rates and each sample has

i am not that big on programming and i need to sample an audio file that is recorded via a mobile, i understand that the mobile device records the voice, and there are sample rates and each sample has a 8bit or 16 bit sample size. i need 8 bit sample size in 8khz. the programming environment is lua but that doesnt matter really the basic deal is sampling. An开发者_如何学JAVAy help would be appreciated.


You need to either set your recording parameters at the time that you record the sound sample to 8 bits @ 8 kHz, or, if you can't, or don't have any control over the actual recording process, then you will need to resample the original recording to get it into the format that you need. You can do this off-line with a tool such as SoX, or you can write code that does this on-the-fly. If you give more detail in your question then I can add more specific detail in my answer.


I don't know about lua, but as suggested by Paul R, you can always post-process your audio files using SoX or ffmpeg. On linux, just install ffmpeg :

sudo apt-get install ffmpeg

Then :

ffmpeg -i trenet.wav -ar 8000 trenet-8k.wav

This resamples your audio at 8000 Hz. I did not find how to deal with the bits/sample parameter but you can always tune the bitrate. For documentation :

man ffmpeg
0

精彩评论

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