Speex编解码在Android上实现
Speex编解码在Android上实现
以前在应用中使用到了Speex编解码,近来总结了一下Speex在Android上的实现。Speex是一套主要针对语音的开源免费,无专利保护的音频压缩格式。Speex工程着力于通过提供一个可以替代高性能语音编解码来降低语音应用输入门槛 。另外,相对于其它编解码,Speex也很适合网络应用,在网络应用上有着自己独特的优势。同时,Speex还是GNU工程的一部分,在改版的BSD协议中得到了很好的支持。Speex是基于CELP并且专门为码率在2-44kbps的语音压缩而设计的。Speex源码是基于c语音实现的(也有java实现,效率相对较低)。
1、去Speex官网下载最新Speex源码。
2、创建新的android工程,并创建jni文件夹。
3、把speex源码目录下的libspeex和include目录及其子目录文件全部拷贝到$project/jni目录下。
4、在jni目录下新增Android.mk文件,编辑内容如下:
- LOCAL_PATH := $(call my-dir)
- include $(CLEAR_VARS)
- LOCAL_MODULE:= libspeex
- LOCAL_CFLAGS = -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" -UHAVE_CONFIG_H
- LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
- LOCAL_SRC_FILES :=\
- libspeex/bits.c \
- libspeex/buffer.c \
- libspeex/cb_search.c \
- libspeex/exc_10_16_table.c \
- libspeex/exc_10_32_table.c \
- libspeex/exc_20_32_table.c \
- libspeex/exc_5_256_table.c \
- libspeex/exc_5_64_table.c \
- libspeex/exc_8_128_table.c \
- libspeex/fftwrap.c \
- libspeex/filterbank.c \
- libspeex/filters.c \
- libspeex/gain_table.c \
- libspeex/gain_table_lbr.c \
- libspeex/hexc_10_32_table.c \
- libspeex/hexc_table.c \
- libspeex/high_lsp_tables.c \
- libspeex/jitter.c \
- libspeex/kiss_fft.c \
- libspeex/kiss_fftr.c \
- libspeex/lpc.c \
- libspeex/lsp.c \
- libspeex/lsp_tables_nb.c \
- libspeex/ltp.c \
- libspeex/mdf.c \
- libspeex/modes.c \
- libspeex/modes_wb.c \
- libspeex/nb_celp.c \
- libspeex/preprocess.c \
- libspeex/quant_lsp.c \
- libspeex/resample.c \
- libspeex/sb_celp.c \
- libspeex/scal.c \
- libspeex/smallft.c \
- libspeex/speex.c \
- libspeex/speex_callbacks.c \
- libspeex/speex_header.c \
- libspeex/stereo.c \
- libspeex/vbr.c \
- libspeex/vq.c \
- libspeex/window.c \
- speex_jni.cpp \
- include $(BUILD_SHARED_LIBRARY)
|
评论暂时关闭