## 1 音頻處理基礎知識
### 1.1 文件格式和編碼之間的關系
首先需要說明的是,文件格式和編碼之間的關系如同碗與烹飪手法之間的關系。
文件格式只代表一個容器,這個容器可以包含視頻或者音頻,以及頭文件信息,腳本等之類的數據。
一般來說一個特定容器容納的數據都是有一定范圍的。
比如MP4,其文件中存儲的通常是MPEG-4編碼的數據。
又比如WAV,其文件中存儲的是原始的PCM數據文件,同時附加了一個44字節的媒體信息描述。但是除此之外,WAV文件中也可以包含MP3編碼的數據。
### 1.2 聲音是什么
聲音是物體震動所產生的“波”。它是能量的傳播方式。
聲音包括三個特征:響度、音調、音色。而錄音,則是通過將空氣中的聲音,還原為震動,然后將震動的幅度,頻率,記錄下來。
[脈沖編碼調制PCM原理看這里](http://blog.chinaunix.net/uid-11572501-id-3309833.html)
### 1.3 為什么要壓縮
為啥要壓縮呢?很簡單,錄制的原始文件太大。
PCM的大小可以按照以下公式計算:采樣率 * 比特率 * 聲道數 * 錄制時間
一般來說,我們是按照44100的采樣率錄制音頻的(為什么是44100,我們暫且認為這是一個經驗數值,超過這個數值,人耳已經無法區分好壞)。比特率則指的是存儲每一幀數據所需要的數據量一般是16bit。
按照上面的公式一個1min的視頻占用空間是: 44100 * 16 * 2 * 60 = 84672000 bit
換算出來就是超過10M,這個尺寸顯然過於龐大。於是為了減少存儲空間,人們開始想出了各種壓縮辦法。
### 1.4 壓縮原理簡述
因為聲音是由各種音波疊加形成的。而單個音波本身是可以函數化的。也就是類似於咱們在坐標圖上畫正弦函數一樣。要記錄這個圖像,可以把每個點都描記下來,當需要重現圖形時,一個點一個點的對照描出來;而另一張方法則是直接記住正弦函數,當需要重現圖形時,只需要按照函數重新繪制即可。很顯然記錄函數遠比記錄每一個數據點要來的省時省力的多。
音頻壓縮的原理也是這樣。通過一系列的編碼操作,把錄制的聲音信號轉換為一個一個的波形函數的疊加。這樣使得文件占用空間大大減少。但是同樣的,由於重建函數的過程,很難百分之百完全重建成原始波形函數,一般都只是相似而已,所以壓縮算法壓縮出來的音頻和真實的音頻會存在一定的差異。也就是說,不存在真正的無損壓縮,現在標榜的無損壓縮算法,也僅可以說是無限接近真實意義上的“無損”而已。
參考:
[音頻格式,編碼,解碼 相關知識](http://www.cnblogs.com/doit8791/archive/2012/06/02/2532382.html)
[音頻基礎知識](http://bbs.poptp.net/network-t-18209)
[音頻基礎知識2](http://ce.sysu.edu.cn/hope2008/beautydesign/ShowArticle.asp?ArticleID=2232)
[脈沖編碼調制PCM原理](http://blog.chinaunix.net/uid-11572501-id-3309833.html)
## 2 lame庫相關資料
LAME是LAME Ain't an MP3 Encoder的縮寫,開源並且免費的,公認最強大也是當今最流行的MP3壓縮引擎
[lame主頁](http://lame.sourceforge.net/links.php)
[ios下使用lame壓縮](http://ikinglai.blog.51cto.com/6220785/1228309)
[lame 解碼](http://blog.sina.com.cn/s/blog_648d306d0100sl2o.html)
[*lame JNI引用及demo](http://developer.samsung.com/technical-doc/view.do;jsessionid=f9yXJh2M1VCCTpN2dHHVYq8ShXPBBSJ15YXQyv2HDs3LGvjyTKzv!1229459487?v=T000000090)
[*lame 編解碼示例](http://www.codeproject.com/Articles/656543/The-LAME-wrapper-An-audio-converter)
[libmp3lame >= 3.98.3 not found](https://forum.videolan.org/viewtopic.php?f=32&t=82771)
[lame 移植到安卓](http://blog.sina.com.cn/s/blog_936739790101b1ag.html)
標*的為比較重要的資料
## 3 AAC編碼解碼
http://blog.csdn.net/sunnylgz/article/details/7676340
http://blog.csdn.net/axdc_qa_team/article/details/4271043
如何創建AAC頭部信息
http://stackoverflow.com/questions/18862715/how-to-generate-the-aac-adts-elementary-stream-with-android-mediacodec
AAC解碼:
faad解碼器
http://www.audiocoding.com/faad2.html
FAAC中文
http://blog.csdn.net/poechant/article/details/7435054
一個FAAC JNI庫
http://bashell.sinaapp.com/voaacencoder
系統默認解碼器
http://www.itstrike.cn/Question/fb391992-0a92-46c3-959e-fb18a3133c84.html
基於OpenCore的解碼庫
https://code.google.com/p/aacdecoder-android/downloads/detail?name=aacdecoder-android-libs-0.8.zip&can=2&q=
https://github.com/vbartacek/aacdecoder-android
https://github.com/timsu/android-aac-enc
http://www.iis.fraunhofer.de/en/ff/amm/impl/fdkaaccodec.html
## 4 SOX資料
sox for android
http://stackoverflow.com/questions/18851214/how-to-use-sox-in-android
sox android lib
http://www.bytebucket.org/LukeLu1263/sox-android-lib/src/79764fdb30e8/sox-linux-armeabi-simple-dynamic/?at=master
一個基於sox的播放器
https://github.com/Kyborg2011/SoxPlayer
## 5 混音算法
混音算法介紹
http://dsp.stackexchange.com/questions/3581/algorithms-to-mix-audio-signals-without-clipping
噪音處理:http://stackoverflow.com/questions/15450448/noise-removal-from-a-recorded-audio-file-in-android?rq=1
http://stackoverflow.com/questions/19021484/how-to-remove-noise-mix-audio-in-android
http://blog.csdn.net/wocao1226/article/details/17580849
改進的混音算法
http://wenku.baidu.com/view/46cd4b0ef12d2af90242e631.html
http://blog.csdn.net/messagebox/article/details/3482244
http://blog.csdn.net/wocao1226/article/details/17549621視頻會議混音算法
http://www.oschina.net/p/audiokit
混音處理關鍵文章
http://stackoverflow.com/questions/18750892/merging-two-wave-files-on-android-concatenate
http://mobilengineering.blogspot.com/2012_06_01_archive.html
https://github.com/jitsi/libjitsi/tree/master/lib
混音,+打分
http://blog.csdn.net/h3c4lenovo/article/details/8099550
混音
http://stackoverflow.com/questions/16766248/mix-audio-in-android
http://stackoverflow.com/questions/13228196/audio-song-mixer-in-android-programatically
https://code.google.com/p/mobikar/source/browse/mobiKAR/archive/tmp/src/MixingAudioInputStream.java?r=13
http://stackoverflow.com/questions/18750892/merging-two-wave-files-on-android-concatenate
## 6 SoundTouch相關資料
soundTouch 音頻處理庫
http://www.surina.net/soundtouch/download.html
android端
https://github.com/nonameentername/soundtouch-android
https://github.com/svenoaks/SoundTouch-Android
## 7 Speex
speex音頻處理
http://blog.csdn.net/xyz_lmn/article/details/8013490
speex算法在android上的移植
http://blog.csdn.net/zkw12358/article/details/25339003
## 8 Libmad
libmad 音頻處理
http://blog.csdn.net/lishaoqi_scau/article/details/8568967
mad解碼
http://blog.csdn.net/ahyswang/article/details/7748344
## 9 采樣率轉換Resample
郵件列表libsamplerate vs. libresample
http://sourceforge.net/p/audacity/mailman/message/24262084/
libresample 移植
https://github.com/intervigilium/libresample
pcm降低采樣率
http://stackoverflow.com/questions/11257447/pcm-downsampling-input-frames-output-frames-vs-buffer-size?rq=1
http://www.mega-nerd.com/SRC/api_full.html#Process
http://www.mega-nerd.com/SRC/
音頻處理resample
https://ccrma.stanford.edu/~jos/resample/Free_Resampling_Software.html
https://github.com/lsjwzh/JSSRC
http://shibatch.sourceforge.net/
http://stackoverflow.com/questions/4009737/library-for-audio-resampling
http://tdistler.com/2010/07/22/audio-resampling-using-ffmpeg-avcodec
http://www.mega-nerd.com/SRC/
https://github.com/xxDroid/libsamplerate-android
http://stackoverflow.com/questions/17785499/how-to-convert-44100-stereo-to-11025-mono-programmatically
http://sourceforge.net/projects/soxr/
http://kokkinizita.linuxaudio.org/linuxaudio/zita-resampler/resampler.html
https://github.com/simingweng/android-pcm-resample
http://stackoverflow.com/questions/3260424/resample-upsample-sound-frames-from-8khz-to-48khz-java-android
https://github.com/dnault-laszlo/libresample4j
## 10 其他
音色重現工具:
http://www.asel.udel.edu/speech/InvTutor/
安卓 音頻處理庫
http://google-opensource.blogspot.com/2013/09/patchfield-for-android.html
http://libpd.cc/
音頻處理集合
http://jackaudio.org/applications/
iOS 轉碼
http://www.cnblogs.com/ios8/p/IOS-PCM-MP3.html
語音識別
http://cmusphinx.sourceforge.net/