简体   繁体   English

在Blackberry 10(本机)上拆分音频文件(wav)

[英]Split audio files (wav) on Blackberry 10 (native)

I use the following code for record wav file: 我使用以下代码记录wav文件:

AudioRecorder recorder; 
recorder.setOutputUrl(<file path...>); 
recorder.record();

and for playing this tutorial 并播放本教程

When wav file is recorded I want to play it and split file when I pause the track. 录制wav文件时,我想播放它并在暂停曲目时拆分文件。

Could you please help me how can I split wav file? 您能帮我怎么分割wav文件吗?

Write a copy while playing the file. 播放文件时写一个副本。 When pausing, close the file and start write a new file and continue the writing by writing to that file instead. 暂停时,请关闭文件并开始写入新文件,然后继续写入该文件来继续写入。

Your record approach seems very high level. 您的记录方法似乎非常高级。 If you play file by using something like 如果您使用类似的方法播放文件

AudioPlayer player;
player.setInputUrl(...);
player.play();

You cannot split the file in that way. 您不能以这种方式拆分文件。 You need to do things in your playback loop to get it work. 您需要在回放循环中进行操作才能使其正常工作。

EDIT: 编辑:

The comment indicate that you want to do realtime splitting. 该注释表示您要进行实时拆分。 If so, divide AudioRecorder into two classes: 如果是这样,请将AudioRecorder分为两类:

WaveDeviceIn for communication with hardware
WaveFileOut for file output.

Then read from WaveDeviceIn as if it were an endless file. 然后从WaveDeviceIn读取,好像它是一个无休止的文件。 Inside your I/O loop you can create and destroy WaveFileOut objects as you wish while recording. 在I / O循环中,您可以在记录时随意创建和销毁WaveFileOut对象。 Disk I/O may need another thread that is activated when WaveDeviceIn has a new data block to deliver. 当WaveDeviceIn具有要传递的新数据块时,磁盘I / O可能需要激活另一个线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM