歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Speex編解碼在Android上實現

Speex編解碼在Android上實現

日期:2017/3/1 10:09:13   编辑:Linux編程

以前在應用中使用到了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文件,編輯內容如下:

  1. LOCAL_PATH := $(call my-dir)
  2. include $(CLEAR_VARS)
  3. LOCAL_MODULE:= libspeex
  4. LOCAL_CFLAGS = -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" -UHAVE_CONFIG_H
  5. LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
  6. LOCAL_SRC_FILES :=\
  7. libspeex/bits.c \
  8. libspeex/buffer.c \
  9. libspeex/cb_search.c \
  10. libspeex/exc_10_16_table.c \
  11. libspeex/exc_10_32_table.c \
  12. libspeex/exc_20_32_table.c \
  13. libspeex/exc_5_256_table.c \
  14. libspeex/exc_5_64_table.c \
  15. libspeex/exc_8_128_table.c \
  16. libspeex/fftwrap.c \
  17. libspeex/filterbank.c \
  18. libspeex/filters.c \
  19. libspeex/gain_table.c \
  20. libspeex/gain_table_lbr.c \
  21. libspeex/hexc_10_32_table.c \
  22. libspeex/hexc_table.c \
  23. libspeex/high_lsp_tables.c \
  24. libspeex/jitter.c \
  25. libspeex/kiss_fft.c \
  26. libspeex/kiss_fftr.c \
  27. libspeex/lpc.c \
  28. libspeex/lsp.c \
  29. libspeex/lsp_tables_nb.c \
  30. libspeex/ltp.c \
  31. libspeex/mdf.c \
  32. libspeex/modes.c \
  33. libspeex/modes_wb.c \
  34. libspeex/nb_celp.c \
  35. libspeex/preprocess.c \
  36. libspeex/quant_lsp.c \
  37. libspeex/resample.c \
  38. libspeex/sb_celp.c \
  39. libspeex/scal.c \
  40. libspeex/smallft.c \
  41. libspeex/speex.c \
  42. libspeex/speex_callbacks.c \
  43. libspeex/speex_header.c \
  44. libspeex/stereo.c \
  45. libspeex/vbr.c \
  46. libspeex/vq.c \
  47. libspeex/window.c \
  48. speex_jni.cpp \
  49. include $(BUILD_SHARED_LIBRARY)
Copyright © Linux教程網 All Rights Reserved