soundtouch源码分析

1.soundtouch官网:http://www.surina.net/soundtouch/。这上面有soundtouch的介绍、源码,封装好的dll文件、使用方法、以及一些demo。这上面demo做的不好。

2.一个利用java的jni调用soundtouch非常短小精悍的java swing界面小程序:http://www.aplu.ch/home/apluhomex.jsp?site=44

3.csdn suhetao做的soundtouch源码分析:http://blog.csdn.net/suhetao/article/details/5843480

4.关于声音处理的一个理论网页:http://www.surina.net/article/time-and-pitch-scaling.html

5.其他资料:http://baosu.iteye.com/blog/1840054

      http://baosu.iteye.com/blog/1843031

      http://blog.csdn.net/leilu2008/article/details/6724354


1. 音频采集

   这点主要是通过Android设备的麦克风实时采集音频,由于Android平台的MediaRecorder类录制音频到文件,虽然可以通过空设备回调获得实时的音频流,不过为了降低开发者的难度,Android开发网推荐使用正统的AudioRecord和AudioTrack,首先我们仍然需要加入android.permission.RECORD_AUDIO这个权限。

android.media.AudioRecord类的read方法主要有 3 种重载形式:
 
int   read( short [] audioData,  int  offsetInShorts,  int  sizeInShorts)    //short在java中占用两个字节
int   read( byte [] audioData,  int  offsetInBytes,  int  sizeInBytes)   //byte在java中占用一个字节
int   read(ByteBuffer audioBuffer,  int  sizeInBytes)   //基于NIO的ByteBuffer类型

 我们可以看到从麦克风中获取的音频无需经过文件系统直接通过AudioRecord类的read方法读入到我们预定的缓冲区中,这里需要注意的是采样率的大小必须有足够的缓冲区空间处理

 

  2. 变声处理

  这点需要一些基本的音频处理方式,比如移调、变速,Android开发网推荐大家参考Adobe Audition的早期Cool Editi泄露的代码,当然音频处理算法比较多,大家可以自己实现。

 

  3. 播放原始音频流

  同样,处理完后考虑到效率我们仍然直接从内存流中播放,最简单的就是AudioTrack类,通过android.media.AudioTrack类的write方法,让Android声卡播放原始音频流。两种重载方法如下

int   write( short [] audioData,  int  offsetInShorts,  int  sizeInShorts)
int   write( byte [] audioData,  int  offsetInBytes,  int  sizeInBytes)


4,编译NDK:http://soundtouch.surina.net/README-SoundTouch-Android.html


转载于:https://my.oschina.net/sitexa/blog/384171

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值