开发者

cut audio data in the stream with java

i know how to read bytes from file and save, but how can i read seconds from an audio file and save in a new file? is there any method for this?how many bytes contains 1 second?maybe it sounds stupied but i have no idea.

p.s. i want to record 开发者_StackOverflowonly 20 seconds from an audio file and save this 20 seconds to another file.. i know how to write to a new file, but how to write only some part(20 seconds) of an audio file

thx in advance roni


It depends on the format you are using for capturing the audio stream. For example if your are using raw (uncompressed) audio, 16 bits per sample, stereo, and 44Khz (which means 44100 samples per second), then you need to store 2*(16/8)*44100 bytes per second. Additionally, if you want to write some kind of standard file that other applications can read, you will need to decide on a container format. For raw (uncompressed) audio, Microsoft wave files are commonly used, and it will require you to write a header with some metadata at the begining of your file.

Update:

You can try using AudioFileWriter.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜