zoukankan      html  css  js  c++  java
  • Android语音系列:编译Speex框架

    原文:http://www.badlogicgames.com/wordpress/?p=1726&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+PlanetAndroidCom+%28Planet+Android%29 

    JSpeex does not work very well on Android, encoding times are between 0.03 to 0.2 seconds for a 320 samples frame. Way to much for any real-time app (can you say in-game voice chat? :p). So i set out to get the native speex to compile for Android. A couple of steps are involved if you don’t want to go the configure road with ndk r5b.

    1. Download the latest speex source distri.
    2. Create your project’s folder, and a jni/ folder inside that folder
    3. Copy the libspeex/ and include/ folders from the speex distri to your jni/ folder. You should end up with $project/jni/libspeex and $project/jni/include
    4. Add the following thingy as your Android.mk file in your jni/ folder
    5. 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
       
      include $(BUILD_SHARED_LIBRARY)
    6. Add the following thingy as your Application.mk file in the jni/ folder
      APP_ABI := armeabi armeabi-v7a

      This will compile binaries for the arm and arm-v7a cpus.

    7. Add the following thingy as a file called speex_config_types.h to the $project/jni/include/speex/ folder.
      #ifndef __SPEEX_TYPES_H__
      #define __SPEEX_TYPES_H__
      typedef short spx_int16_t;
      typedef unsigned short spx_uint16_t;
      typedef int spx_int32_t;
      typedef unsigned int spx_uint32_t;
      #endif

      最后一步 ndk-build 编译OK
      Compile thumb  : speex <= modes.c
      Compile thumb  : speex <= modes_wb.c
      Compile thumb  : speex <= nb_celp.c
      Compile thumb  : speex <= preprocess.c
      Compile thumb  : speex <= quant_lsp.c
      Compile thumb  : speex <= resample.c
      Compile thumb  : speex <= sb_celp.c
      Compile thumb  : speex <= scal.c
      Compile thumb  : speex <= smallft.c
      Compile thumb  : speex <= speex.c
      Compile thumb  : speex <= speex_callbacks.c
      Compile thumb  : speex <= speex_header.c
      Compile thumb  : speex <= stereo.c
      Compile thumb  : speex <= vbr.c
      Compile thumb  : speex <= vq.c
      Compile thumb  : speex <= window.c
      SharedLibrary  : libspeex.so
      Install        : libspeex.so => libs/armeabi-v7a/libspeex.so



  • 相关阅读:
    [UML]UML系列——活动图activity diagram
    [UML]UML系列——包图Package
    UNIDAC不能识别CLIENTDATASET的TSINGLEFIELD
    UNIDAC如何驱动MSSQL2000
    delphi各个版本编译开关值
    优秀的数据序列和还原类----TSimpleMsgPack
    DELPHI方法注释的标准写法
    客户端如何通过咏南中间件调用存储过程和数据分页查询和文件传输的演示
    delphi 安卓程序如何读取外部配置文件
    调用DATASNAP+FIREDAC的远程方法有时会执行二次SQL或存储过程的BUG
  • 原文地址:https://www.cnblogs.com/tinkl/p/2489217.html
Copyright © 2011-2022 走看看