黑莓录音采样code [英] Blackberry Audio Recording Sample Code

查看:192
本文介绍了黑莓录音采样code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道一个良好的存储库,以获取样本code为黑莓手机?具体来说,样本,这将有助于我学习录制音频,甚至可能取样,并在上面做一些动态信号处理的机制?

Does anyone know of a good repository to get sample code for the BlackBerry? Specifically, samples that will help me learn the mechanics of recording audio, possibly even sampling it and doing some on the fly signal processing on it?

我想用样品读取传入的音频,样本如果需要的话,然后对其进行处理,以产生所希望的结果,在这种情况下,可视化

I'd like to read incoming audio, sample by sample if need be, then process it to produce a desired result, in this case a visualizer.

推荐答案

RIM API包含 JSR 135的Java手机用于处理音频放大器和媒体API ;视频内容。

你纠正有关BB知识库一塌糊涂。唯一的办法就是浏览它,希望他们会不会再次更改站点地图。

这是 Developers->资源 - > <一个href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/customview.html?func=ll&objId=348583&objAction=browse&sort=name\">Knowledge基地 - > <一个href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe?func=ll&objId=800332&objAction=browse&sort=name\">Java API的&放大器;样品 - > <一个href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe?func=ll&objId=1089414&objAction=browse&sort=name\">Audio&Video

RIM API contains JSR 135 Java Mobile Media API for handling audio & video content.
You correct about mess on BB Knowledge Base. The only way is browse it, hoping they'll not going to change site map again.
It's Developers->Resources->Knowledge Base->Java API's&Samples->Audio&Video

基本上它是简单的录音:

Basically it's simple to record audio:


  • 与正确的音频编码创建播放器

  • 获取RecordControl

  • 开始录制

  • 停止录制

链接:

<一href=\"http://www.blackberry.com/developers/docs/4.6.0api/javax/microedition/media/package-summary.html\">RIM 4.6.0 API参考:包装javax.microedition.media

<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How%5FTo%5F-%5FRecord%5Faudio%5Fon%5Fa%5FBlackBerry%5Fsmartphone.html?nodeid=1311883&vernum=0\">How要 - 录音在BlackBerry智能手机

<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How%5FTo%5F-%5FPlay%5Faudio%5Fin%5Fan%5Fapplication.html?nodeid=1168553&vernum=0\">How要 - 音频播放应用程序中的

<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How%5FTo%5F-%5FSupport%5Fstreaming%5Faudio%5Fto%5Fthe%5Fmedia%5Fapplication.html?nodeid=1369914&vernum=0\">How要 - 支持音频流媒体应用

<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How%5FTo%5F-%5FSpecify%5FAudio%5FPath%5FRouting.html?nodeid=1326675&vernum=0\">How到 - 指定音频路​​径路由

<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How%5FTo%5F-%5FObtain%5Fthe%5Fmedia%5Fplayback%5Ftime%5Ffrom%5Fa%5Fmedia%5Fapplication.html?nodeid=1498782&vernum=0\">How要 - 从媒体应用程序
<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/796557/800332/1089414/What%5FIs%5F-%5FSupported%5Faudio%5Fformats.html?nodeid=1187763\">What是 - 支持的音频格式

<一href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/What%5FIs%5F-%5F%5FMedia%5Fapplication%5Ferror%5F$c$cs.html?nodeid=1357545&vernum=0\">What是 - 媒体应用程序错误codeS

Links:
RIM 4.6.0 API ref: Package javax.microedition.media
How To - Record Audio on a BlackBerry smartphone
How To - Play audio in an application
How To - Support streaming audio to the media application
How To - Specify Audio Path Routing
How To - Obtain the media playback time from a media application
What Is - Supported audio formats
What Is - Media application error codes

与球员,RecordControl和资源主题声明:

Thread with Player, RecordControl and resources is declared:

final class VoiceNotesRecorderThread extends Thread{
   private Player _player;
   private RecordControl _rcontrol;
   private ByteArrayOutputStream _output;
   private byte _data[];

   VoiceNotesRecorderThread() {}

   private int getSize(){
       return (_output != null ? _output.size() : 0);
   }

   private byte[] getVoiceNote(){
      return _data;
   }
}

在Thread.run()音频录制启动:

On Thread.run() audio recording is started:

   public void run() {
      try {
          // Create a Player that captures live audio.
          _player = Manager.createPlayer("capture://audio");
          _player.realize();    
          // Get the RecordControl, set the record stream,
          _rcontrol = (RecordControl)_player.getControl("RecordControl");    
          //Create a ByteArrayOutputStream to capture the audio stream.
          _output = new ByteArrayOutputStream();
          _rcontrol.setRecordStream(_output);
          _rcontrol.startRecord();
          _player.start();    
      } catch (final Exception e) {
         UiApplication.getUiApplication().invokeAndWait(new Runnable() {
            public void run() {
               Dialog.inform(e.toString());
            }
         });
      }
   }

和上Thread.stop()以记录停止:

And on thread.stop() recording is stopped:

   public void stop() {
      try {
           //Stop recording, capture data from the OutputStream,
           //close the OutputStream and player.
           _rcontrol.commit();
           _data = _output.toByteArray();
           _output.close();
           _player.close();    
      } catch (Exception e) {
         synchronized (UiApplication.getEventLock()) {
            Dialog.inform(e.toString());
         }
      }
   }

处理和采样音频流

在记录你将有填充有在特定音频格式的数据输出流的末尾。因此,要处理或品尝它,你将不得不去code此音频流。

Processing and sampling audio stream

In the end of recording you will have output stream filled with data in specific audio format. So to process or sample it you will have to decode this audio stream.

动态处理,那将是更加复杂的谈论。您将有创纪录的无记录commiting在读取输出流。所以会有几个问题需要解决:

Talking about on the fly processing, that will be more complex. You will have to read output stream during recording without record commiting. So there will be several problems to solve:


  • 同步获得输出流进行记录和采样 - 线程问题

  • 读取的音频数据的正确数量 - 深入到音频格式德code找出标记规则

也可能是有用的:

<一href=\"http://today.java.net/pub/a/today/2006/08/22/experiments-in-streaming-java-me.html?page=1\">java.net:在实验中流的Java ME含量维克拉姆·戈亚尔

这篇关于黑莓录音采样code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆