├── .gitignore ├── VoiceChanger ├── .classpath ├── .externalToolBuilders │ └── NDK_Builder.launch ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── assets │ └── .gitignore ├── jni │ ├── Android.mk │ ├── Application.mk │ ├── SoundTouch │ │ ├── Android.mk │ │ ├── SoundTouch │ │ │ ├── AAFilter.cpp │ │ │ ├── AAFilter.h │ │ │ ├── BPMDetect.cpp │ │ │ ├── FIFOSampleBuffer.cpp │ │ │ ├── FIRFilter.cpp │ │ │ ├── FIRFilter.h │ │ │ ├── InterpolateCubic.cpp │ │ │ ├── InterpolateCubic.h │ │ │ ├── InterpolateLinear.cpp │ │ │ ├── InterpolateLinear.h │ │ │ ├── InterpolateShannon.cpp │ │ │ ├── InterpolateShannon.h │ │ │ ├── Makefile.am │ │ │ ├── PeakFinder.cpp │ │ │ ├── PeakFinder.h │ │ │ ├── RateTransposer.cpp │ │ │ ├── RateTransposer.h │ │ │ ├── SoundTouch.cpp │ │ │ ├── TDStretch.cpp │ │ │ ├── TDStretch.h │ │ │ ├── cpu_detect.h │ │ │ ├── cpu_detect_x86.cpp │ │ │ ├── mmx_optimized.cpp │ │ │ └── sse_optimized.cpp │ │ ├── include │ │ │ ├── BPMDetect.h │ │ │ ├── FIFOSampleBuffer.h │ │ │ ├── FIFOSamplePipe.h │ │ │ ├── Makefile.am │ │ │ ├── STTypes.h │ │ │ ├── SoundTouch.h │ │ │ └── soundtouch_config.h │ │ └── soundtouch-jni.cpp │ └── speex │ │ ├── Android.mk │ │ ├── include │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ └── speex │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── speex.h │ │ │ ├── speex_bits.h │ │ │ ├── speex_buffer.h │ │ │ ├── speex_callbacks.h │ │ │ ├── speex_config_types.h │ │ │ ├── speex_config_types.h.in │ │ │ ├── speex_echo.h │ │ │ ├── speex_header.h │ │ │ ├── speex_jitter.h │ │ │ ├── speex_preprocess.h │ │ │ ├── speex_resampler.h │ │ │ ├── speex_stereo.h │ │ │ └── speex_types.h │ │ ├── libspeex │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── _kiss_fft_guts.h │ │ ├── arch.h │ │ ├── bits.c │ │ ├── buffer.c │ │ ├── cb_search.c │ │ ├── cb_search.h │ │ ├── cb_search_arm4.h │ │ ├── cb_search_bfin.h │ │ ├── cb_search_sse.h │ │ ├── echo_diagnostic.m │ │ ├── exc_10_16_table.c │ │ ├── exc_10_32_table.c │ │ ├── exc_20_32_table.c │ │ ├── exc_5_256_table.c │ │ ├── exc_5_64_table.c │ │ ├── exc_8_128_table.c │ │ ├── fftwrap.c │ │ ├── fftwrap.h │ │ ├── filterbank.c │ │ ├── filterbank.h │ │ ├── filters.c │ │ ├── filters.h │ │ ├── filters_arm4.h │ │ ├── filters_bfin.h │ │ ├── filters_sse.h │ │ ├── fixed_arm4.h │ │ ├── fixed_arm5e.h │ │ ├── fixed_bfin.h │ │ ├── fixed_debug.h │ │ ├── fixed_generic.h │ │ ├── gain_table.c │ │ ├── gain_table_lbr.c │ │ ├── hexc_10_32_table.c │ │ ├── hexc_table.c │ │ ├── high_lsp_tables.c │ │ ├── jitter.c │ │ ├── kiss_fft.c │ │ ├── kiss_fft.h │ │ ├── kiss_fftr.c │ │ ├── kiss_fftr.h │ │ ├── lpc.c │ │ ├── lpc.h │ │ ├── lpc_bfin.h │ │ ├── lsp.c │ │ ├── lsp.h │ │ ├── lsp_bfin.h │ │ ├── lsp_tables_nb.c │ │ ├── ltp.c │ │ ├── ltp.h │ │ ├── ltp_arm4.h │ │ ├── ltp_bfin.h │ │ ├── ltp_sse.h │ │ ├── math_approx.h │ │ ├── mdf.c │ │ ├── misc_bfin.h │ │ ├── modes.c │ │ ├── modes.h │ │ ├── modes_wb.c │ │ ├── nb_celp.c │ │ ├── nb_celp.h │ │ ├── os_support.h │ │ ├── preprocess.c │ │ ├── pseudofloat.h │ │ ├── quant_lsp.c │ │ ├── quant_lsp.h │ │ ├── quant_lsp_bfin.h │ │ ├── resample.c │ │ ├── resample_sse.h │ │ ├── sb_celp.c │ │ ├── sb_celp.h │ │ ├── scal.c │ │ ├── smallft.c │ │ ├── smallft.h │ │ ├── speex.c │ │ ├── speex_callbacks.c │ │ ├── speex_header.c │ │ ├── stack_alloc.h │ │ ├── stereo.c │ │ ├── testdenoise.c │ │ ├── testecho.c │ │ ├── testenc.c │ │ ├── testenc_uwb.c │ │ ├── testenc_wb.c │ │ ├── testjitter.c │ │ ├── vbr.c │ │ ├── vbr.h │ │ ├── vorbis_psy.h │ │ ├── vq.c │ │ ├── vq.h │ │ ├── vq_arm4.h │ │ ├── vq_bfin.h │ │ ├── vq_sse.h │ │ └── window.c │ │ └── speex_jni.cpp ├── libs │ ├── android-support-v4.jar │ ├── armeabi-v7a │ │ ├── libsoundtouch.so │ │ └── libspeex.so │ └── armeabi │ │ ├── libsoundtouch.so │ │ └── libspeex.so ├── lint.xml ├── obj │ └── local │ │ ├── armeabi-v7a │ │ ├── libsoundtouch.so │ │ ├── libspeex.so │ │ └── libstdc++.a │ │ └── armeabi │ │ ├── libsoundtouch.so │ │ ├── libspeex.so │ │ ├── libstdc++.a │ │ └── objs │ │ └── soundstretch │ │ └── .gitignore ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── .gitignore │ ├── drawable-ldpi │ │ └── .gitignore │ ├── drawable-mdpi │ │ └── .gitignore │ ├── drawable-xhdpi │ │ └── .gitignore │ ├── layout │ │ └── .gitignore │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ └── styles.xml └── src │ └── com │ └── dll │ ├── speex │ ├── SpeexPlayer.java │ ├── SpeexPlayerListener.java │ ├── SpeexRecorder.java │ ├── SpeexRecorderListener.java │ ├── encode │ │ ├── Speex.java │ │ ├── SpeexDecoder.java │ │ └── SpeexEncoder.java │ └── writer │ │ ├── AudioFileWriter.java │ │ ├── OggCrc.java │ │ ├── OggSpeexWriter.java │ │ ├── SpeexWriteClient.java │ │ └── SpeexWriter.java │ ├── util │ └── FilePathUtil.java │ └── voicechanger │ ├── PlayerListener.java │ ├── PlayerManager.java │ ├── RecorderListener.java │ ├── RecorderManager.java │ ├── SoundTouch.java │ └── VoiceChanger.java └── VoiceChangerDemo ├── .classpath ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── assets └── .gitignore ├── libs └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-ldpi │ └── .gitignore ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── layout │ └── activity_main.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml └── values │ ├── strings.xml │ └── styles.xml └── src └── com └── dll └── voicechangerdemo └── MainActivity.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | -------------------------------------------------------------------------------- /VoiceChanger/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /VoiceChanger/.externalToolBuilders/NDK_Builder.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /VoiceChanger/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | VoiceChanger 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.ui.externaltools.ExternalToolBuilder 30 | full,incremental, 31 | 32 | 33 | LaunchConfigHandle 34 | <project>/.externalToolBuilders/NDK_Builder.launch 35 | 36 | 37 | 38 | 39 | 40 | com.android.ide.eclipse.adt.AndroidNature 41 | org.eclipse.jdt.core.javanature 42 | 43 | 44 | -------------------------------------------------------------------------------- /VoiceChanger/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/com/dll/voicechanger/RecorderManager.java=UTF-8 3 | -------------------------------------------------------------------------------- /VoiceChanger/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /VoiceChanger/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /VoiceChanger/assets/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/assets/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/jni/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) -------------------------------------------------------------------------------- /VoiceChanger/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi armeabi-v7a -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # $Id: Android.mk 165 2012-12-28 19:55:23Z oparviai $ 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | # *** Remember: Change -O0 into -O2 in add-applications.mk *** 22 | 23 | 24 | 25 | LOCAL_MODULE := soundtouch 26 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 27 | LOCAL_SRC_FILES := soundtouch-jni.cpp \ 28 | SoundTouch/AAFilter.cpp \ 29 | SoundTouch/BPMDetect.cpp \ 30 | SoundTouch/cpu_detect_x86.cpp \ 31 | SoundTouch/FIFOSampleBuffer.cpp \ 32 | SoundTouch/FIRFilter.cpp \ 33 | SoundTouch/InterpolateCubic.cpp \ 34 | SoundTouch/InterpolateLinear.cpp \ 35 | SoundTouch/InterpolateShannon.cpp \ 36 | SoundTouch/RateTransposer.cpp \ 37 | SoundTouch/mmx_optimized.cpp \ 38 | SoundTouch/PeakFinder.cpp \ 39 | SoundTouch/SoundTouch.cpp \ 40 | SoundTouch/sse_optimized.cpp \ 41 | SoundTouch/TDStretch.cpp 42 | 43 | # for native audio 44 | LOCAL_LDLIBS += -lgcc 45 | # --whole-archive -lgcc 46 | # for logging 47 | LOCAL_LDLIBS += -llog 48 | # for native asset manager 49 | #LOCAL_LDLIBS += -landroid 50 | # don't export all symbols 51 | # added "-marm" switch to use arm instruction set instead of thumb for improved calculation performance. 52 | LOCAL_CFLAGS += -Wall -fvisibility=hidden -I ../../../include -D ST_NO_EXCEPTION_HANDLING -fdata-sections -ffunction-sections -marm 53 | 54 | include $(BUILD_SHARED_LIBRARY) 55 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/AAFilter.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo 4 | /// while maintaining the original pitch by using a time domain WSOLA-like method 5 | /// with several performance-increasing tweaks. 6 | /// 7 | /// Anti-alias filter is used to prevent folding of high frequencies when 8 | /// transposing the sample rate with interpolation. 9 | /// 10 | /// Author : Copyright (c) Olli Parviainen 11 | /// Author e-mail : oparviai 'at' iki.fi 12 | /// SoundTouch WWW: http://www.surina.net/soundtouch 13 | /// 14 | //////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // Last changed : $Date: 2014-01-07 21:41:23 +0200 (Tue, 07 Jan 2014) $ 17 | // File revision : $Revision: 4 $ 18 | // 19 | // $Id: AAFilter.h 187 2014-01-07 19:41:23Z oparviai $ 20 | // 21 | //////////////////////////////////////////////////////////////////////////////// 22 | // 23 | // License : 24 | // 25 | // SoundTouch audio processing library 26 | // Copyright (c) Olli Parviainen 27 | // 28 | // This library is free software; you can redistribute it and/or 29 | // modify it under the terms of the GNU Lesser General Public 30 | // License as published by the Free Software Foundation; either 31 | // version 2.1 of the License, or (at your option) any later version. 32 | // 33 | // This library is distributed in the hope that it will be useful, 34 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | // Lesser General Public License for more details. 37 | // 38 | // You should have received a copy of the GNU Lesser General Public 39 | // License along with this library; if not, write to the Free Software 40 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 41 | // 42 | //////////////////////////////////////////////////////////////////////////////// 43 | 44 | #ifndef AAFilter_H 45 | #define AAFilter_H 46 | 47 | #include "STTypes.h" 48 | #include "FIFOSampleBuffer.h" 49 | 50 | namespace soundtouch 51 | { 52 | 53 | class AAFilter 54 | { 55 | protected: 56 | class FIRFilter *pFIR; 57 | 58 | /// Low-pass filter cut-off frequency, negative = invalid 59 | double cutoffFreq; 60 | 61 | /// num of filter taps 62 | uint length; 63 | 64 | /// Calculate the FIR coefficients realizing the given cutoff-frequency 65 | void calculateCoeffs(); 66 | public: 67 | AAFilter(uint length); 68 | 69 | ~AAFilter(); 70 | 71 | /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling 72 | /// frequency (nyquist frequency = 0.5). The filter will cut off the 73 | /// frequencies than that. 74 | void setCutoffFreq(double newCutoffFreq); 75 | 76 | /// Sets number of FIR filter taps, i.e. ~filter complexity 77 | void setLength(uint newLength); 78 | 79 | uint getLength() const; 80 | 81 | /// Applies the filter to the given sequence of samples. 82 | /// Note : The amount of outputted samples is by value of 'filter length' 83 | /// smaller than the amount of input samples. 84 | uint evaluate(SAMPLETYPE *dest, 85 | const SAMPLETYPE *src, 86 | uint numSamples, 87 | uint numChannels) const; 88 | 89 | /// Applies the filter to the given src & dest pipes, so that processed amount of 90 | /// samples get removed from src, and produced amount added to dest 91 | /// Note : The amount of outputted samples is by value of 'filter length' 92 | /// smaller than the amount of input samples. 93 | uint evaluate(FIFOSampleBuffer &dest, 94 | FIFOSampleBuffer &src) const; 95 | 96 | }; 97 | 98 | } 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/InterpolateCubic.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Cubic interpolation routine. 4 | /// 5 | /// Author : Copyright (c) Olli Parviainen 6 | /// Author e-mail : oparviai 'at' iki.fi 7 | /// SoundTouch WWW: http://www.surina.net/soundtouch 8 | /// 9 | //////////////////////////////////////////////////////////////////////////////// 10 | // 11 | // $Id: InterpolateCubic.h 179 2014-01-06 18:41:42Z oparviai $ 12 | // 13 | //////////////////////////////////////////////////////////////////////////////// 14 | // 15 | // License : 16 | // 17 | // SoundTouch audio processing library 18 | // Copyright (c) Olli Parviainen 19 | // 20 | // This library is free software; you can redistribute it and/or 21 | // modify it under the terms of the GNU Lesser General Public 22 | // License as published by the Free Software Foundation; either 23 | // version 2.1 of the License, or (at your option) any later version. 24 | // 25 | // This library is distributed in the hope that it will be useful, 26 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | // Lesser General Public License for more details. 29 | // 30 | // You should have received a copy of the GNU Lesser General Public 31 | // License along with this library; if not, write to the Free Software 32 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 33 | // 34 | //////////////////////////////////////////////////////////////////////////////// 35 | 36 | #ifndef _InterpolateCubic_H_ 37 | #define _InterpolateCubic_H_ 38 | 39 | #include "RateTransposer.h" 40 | #include "STTypes.h" 41 | 42 | namespace soundtouch 43 | { 44 | 45 | class InterpolateCubic : public TransposerBase 46 | { 47 | protected: 48 | virtual void resetRegisters(); 49 | virtual int transposeMono(SAMPLETYPE *dest, 50 | const SAMPLETYPE *src, 51 | int &srcSamples); 52 | virtual int transposeStereo(SAMPLETYPE *dest, 53 | const SAMPLETYPE *src, 54 | int &srcSamples); 55 | virtual int transposeMulti(SAMPLETYPE *dest, 56 | const SAMPLETYPE *src, 57 | int &srcSamples); 58 | 59 | float fract; 60 | 61 | public: 62 | InterpolateCubic(); 63 | }; 64 | 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/InterpolateLinear.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Linear interpolation routine. 4 | /// 5 | /// Author : Copyright (c) Olli Parviainen 6 | /// Author e-mail : oparviai 'at' iki.fi 7 | /// SoundTouch WWW: http://www.surina.net/soundtouch 8 | /// 9 | //////////////////////////////////////////////////////////////////////////////// 10 | // 11 | // $Id: InterpolateLinear.h 179 2014-01-06 18:41:42Z oparviai $ 12 | // 13 | //////////////////////////////////////////////////////////////////////////////// 14 | // 15 | // License : 16 | // 17 | // SoundTouch audio processing library 18 | // Copyright (c) Olli Parviainen 19 | // 20 | // This library is free software; you can redistribute it and/or 21 | // modify it under the terms of the GNU Lesser General Public 22 | // License as published by the Free Software Foundation; either 23 | // version 2.1 of the License, or (at your option) any later version. 24 | // 25 | // This library is distributed in the hope that it will be useful, 26 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | // Lesser General Public License for more details. 29 | // 30 | // You should have received a copy of the GNU Lesser General Public 31 | // License along with this library; if not, write to the Free Software 32 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 33 | // 34 | //////////////////////////////////////////////////////////////////////////////// 35 | 36 | #ifndef _InterpolateLinear_H_ 37 | #define _InterpolateLinear_H_ 38 | 39 | #include "RateTransposer.h" 40 | #include "STTypes.h" 41 | 42 | namespace soundtouch 43 | { 44 | 45 | /// Linear transposer class that uses integer arithmetics 46 | class InterpolateLinearInteger : public TransposerBase 47 | { 48 | protected: 49 | int iFract; 50 | int iRate; 51 | 52 | virtual void resetRegisters(); 53 | 54 | virtual int transposeMono(SAMPLETYPE *dest, 55 | const SAMPLETYPE *src, 56 | int &srcSamples); 57 | virtual int transposeStereo(SAMPLETYPE *dest, 58 | const SAMPLETYPE *src, 59 | int &srcSamples); 60 | virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples); 61 | public: 62 | InterpolateLinearInteger(); 63 | 64 | /// Sets new target rate. Normal rate = 1.0, smaller values represent slower 65 | /// rate, larger faster rates. 66 | virtual void setRate(float newRate); 67 | }; 68 | 69 | 70 | /// Linear transposer class that uses floating point arithmetics 71 | class InterpolateLinearFloat : public TransposerBase 72 | { 73 | protected: 74 | float fract; 75 | 76 | virtual void resetRegisters(); 77 | 78 | virtual int transposeMono(SAMPLETYPE *dest, 79 | const SAMPLETYPE *src, 80 | int &srcSamples); 81 | virtual int transposeStereo(SAMPLETYPE *dest, 82 | const SAMPLETYPE *src, 83 | int &srcSamples); 84 | virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples); 85 | 86 | public: 87 | InterpolateLinearFloat(); 88 | }; 89 | 90 | } 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/InterpolateShannon.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Sample interpolation routine using 8-tap band-limited Shannon interpolation 4 | /// with kaiser window. 5 | /// 6 | /// Notice. This algorithm is remarkably much heavier than linear or cubic 7 | /// interpolation, and not remarkably better than cubic algorithm. Thus mostly 8 | /// for experimental purposes 9 | /// 10 | /// Author : Copyright (c) Olli Parviainen 11 | /// Author e-mail : oparviai 'at' iki.fi 12 | /// SoundTouch WWW: http://www.surina.net/soundtouch 13 | /// 14 | //////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // $Id: InterpolateShannon.h 179 2014-01-06 18:41:42Z oparviai $ 17 | // 18 | //////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // License : 21 | // 22 | // SoundTouch audio processing library 23 | // Copyright (c) Olli Parviainen 24 | // 25 | // This library is free software; you can redistribute it and/or 26 | // modify it under the terms of the GNU Lesser General Public 27 | // License as published by the Free Software Foundation; either 28 | // version 2.1 of the License, or (at your option) any later version. 29 | // 30 | // This library is distributed in the hope that it will be useful, 31 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 | // Lesser General Public License for more details. 34 | // 35 | // You should have received a copy of the GNU Lesser General Public 36 | // License along with this library; if not, write to the Free Software 37 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 38 | // 39 | //////////////////////////////////////////////////////////////////////////////// 40 | 41 | #ifndef _InterpolateShannon_H_ 42 | #define _InterpolateShannon_H_ 43 | 44 | #include "RateTransposer.h" 45 | #include "STTypes.h" 46 | 47 | namespace soundtouch 48 | { 49 | 50 | class InterpolateShannon : public TransposerBase 51 | { 52 | protected: 53 | void resetRegisters(); 54 | int transposeMono(SAMPLETYPE *dest, 55 | const SAMPLETYPE *src, 56 | int &srcSamples); 57 | int transposeStereo(SAMPLETYPE *dest, 58 | const SAMPLETYPE *src, 59 | int &srcSamples); 60 | int transposeMulti(SAMPLETYPE *dest, 61 | const SAMPLETYPE *src, 62 | int &srcSamples); 63 | 64 | float fract; 65 | 66 | public: 67 | InterpolateShannon(); 68 | }; 69 | 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to create Makefile.in 2 | ## 3 | ## $Id: Makefile.am 178 2014-01-06 18:40:23Z oparviai $ 4 | ## 5 | ## This file is part of SoundTouch, an audio processing library for pitch/time adjustments 6 | ## 7 | ## SoundTouch is free software; you can redistribute it and/or modify it under the 8 | ## terms of the GNU General Public License as published by the Free Software 9 | ## Foundation; either version 2 of the License, or (at your option) any later 10 | ## version. 11 | ## 12 | ## SoundTouch is distributed in the hope that it will be useful, but WITHOUT ANY 13 | ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | ## A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public License along with 17 | ## this program; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | ## Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | 21 | include $(top_srcdir)/config/am_include.mk 22 | 23 | 24 | # set to something if you want other stuff to be included in the distribution tarball 25 | EXTRA_DIST=SoundTouch.dsp SoundTouch.dsw SoundTouch.sln SoundTouch.vcproj 26 | 27 | noinst_HEADERS=AAFilter.h cpu_detect.h cpu_detect_x86.cpp FIRFilter.h RateTransposer.h TDStretch.h PeakFinder.h 28 | 29 | lib_LTLIBRARIES=libSoundTouch.la 30 | # 31 | libSoundTouch_la_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp \ 32 | RateTransposer.cpp SoundTouch.cpp TDStretch.cpp cpu_detect_x86.cpp \ 33 | BPMDetect.cpp PeakFinder.cpp InterpolateLinear.cpp InterpolateCubic.cpp \ 34 | InterpolateShannon.cpp 35 | 36 | # Compiler flags 37 | AM_CXXFLAGS=-O3 -fcheck-new -I../../include 38 | 39 | # Compile the files that need MMX and SSE individually. 40 | libSoundTouch_la_LIBADD=libSoundTouchMMX.la libSoundTouchSSE.la 41 | noinst_LTLIBRARIES=libSoundTouchMMX.la libSoundTouchSSE.la 42 | libSoundTouchMMX_la_SOURCES=mmx_optimized.cpp 43 | libSoundTouchSSE_la_SOURCES=sse_optimized.cpp 44 | 45 | # We enable optimizations by default. 46 | # If MMX is supported compile with -mmmx. 47 | # Do not assume -msse is also supported. 48 | if HAVE_MMX 49 | libSoundTouchMMX_la_CXXFLAGS = -mmmx $(AM_CXXFLAGS) 50 | else 51 | libSoundTouchMMX_la_CXXFLAGS = $(AM_CXXFLAGS) 52 | endif 53 | 54 | # We enable optimizations by default. 55 | # If SSE is supported compile with -msse. 56 | if HAVE_SSE 57 | libSoundTouchSSE_la_CXXFLAGS = -msse $(AM_CXXFLAGS) 58 | else 59 | libSoundTouchSSE_la_CXXFLAGS = $(AM_CXXFLAGS) 60 | endif 61 | 62 | # Let the user disable optimizations if he wishes to. 63 | if !X86_OPTIMIZATIONS 64 | libSoundTouchMMX_la_CXXFLAGS = $(AM_CXXFLAGS) 65 | libSoundTouchSSE_la_CXXFLAGS = $(AM_CXXFLAGS) 66 | endif 67 | 68 | 69 | # other linking flags to add 70 | # noinst_LTLIBRARIES = libSoundTouchOpt.la 71 | # libSoundTouch_la_LIBADD = libSoundTouchOpt.la 72 | # libSoundTouchOpt_la_SOURCES = mmx_optimized.cpp sse_optimized.cpp 73 | # libSoundTouchOpt_la_CXXFLAGS = -O3 -msse -fcheck-new -I../../include 74 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/PeakFinder.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/jni/SoundTouch/SoundTouch/PeakFinder.cpp -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/PeakFinder.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// The routine detects highest value on an array of values and calculates the 4 | /// precise peak location as a mass-center of the 'hump' around the peak value. 5 | /// 6 | /// Author : Copyright (c) Olli Parviainen 7 | /// Author e-mail : oparviai 'at' iki.fi 8 | /// SoundTouch WWW: http://www.surina.net/soundtouch 9 | /// 10 | //////////////////////////////////////////////////////////////////////////////// 11 | // 12 | // Last changed : $Date: 2011-12-30 22:33:46 +0200 (Fri, 30 Dec 2011) $ 13 | // File revision : $Revision: 4 $ 14 | // 15 | // $Id: PeakFinder.h 132 2011-12-30 20:33:46Z oparviai $ 16 | // 17 | //////////////////////////////////////////////////////////////////////////////// 18 | // 19 | // License : 20 | // 21 | // SoundTouch audio processing library 22 | // Copyright (c) Olli Parviainen 23 | // 24 | // This library is free software; you can redistribute it and/or 25 | // modify it under the terms of the GNU Lesser General Public 26 | // License as published by the Free Software Foundation; either 27 | // version 2.1 of the License, or (at your option) any later version. 28 | // 29 | // This library is distributed in the hope that it will be useful, 30 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 32 | // Lesser General Public License for more details. 33 | // 34 | // You should have received a copy of the GNU Lesser General Public 35 | // License along with this library; if not, write to the Free Software 36 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 37 | // 38 | //////////////////////////////////////////////////////////////////////////////// 39 | 40 | #ifndef _PeakFinder_H_ 41 | #define _PeakFinder_H_ 42 | 43 | namespace soundtouch 44 | { 45 | 46 | class PeakFinder 47 | { 48 | protected: 49 | /// Min, max allowed peak positions within the data vector 50 | int minPos, maxPos; 51 | 52 | /// Calculates the mass center between given vector items. 53 | double calcMassCenter(const float *data, ///< Data vector. 54 | int firstPos, ///< Index of first vector item beloging to the peak. 55 | int lastPos ///< Index of last vector item beloging to the peak. 56 | ) const; 57 | 58 | /// Finds the data vector index where the monotoniously decreasing signal crosses the 59 | /// given level. 60 | int findCrossingLevel(const float *data, ///< Data vector. 61 | float level, ///< Goal crossing level. 62 | int peakpos, ///< Peak position index within the data vector. 63 | int direction /// Direction where to proceed from the peak: 1 = right, -1 = left. 64 | ) const; 65 | 66 | // Finds real 'top' of a peak hump from neighnourhood of the given 'peakpos'. 67 | int findTop(const float *data, int peakpos) const; 68 | 69 | 70 | /// Finds the 'ground' level, i.e. smallest level between two neighbouring peaks, to right- 71 | /// or left-hand side of the given peak position. 72 | int findGround(const float *data, /// Data vector. 73 | int peakpos, /// Peak position index within the data vector. 74 | int direction /// Direction where to proceed from the peak: 1 = right, -1 = left. 75 | ) const; 76 | 77 | /// get exact center of peak near given position by calculating local mass of center 78 | double getPeakCenter(const float *data, int peakpos) const; 79 | 80 | public: 81 | /// Constructor. 82 | PeakFinder(); 83 | 84 | /// Detect exact peak position of the data vector by finding the largest peak 'hump' 85 | /// and calculating the mass-center location of the peak hump. 86 | /// 87 | /// \return The location of the largest base harmonic peak hump. 88 | double detectPeak(const float *data, /// Data vector to be analyzed. The data vector has 89 | /// to be at least 'maxPos' items long. 90 | int minPos, ///< Min allowed peak location within the vector data. 91 | int maxPos ///< Max allowed peak location within the vector data. 92 | ); 93 | }; 94 | 95 | } 96 | 97 | #endif // _PeakFinder_H_ 98 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/SoundTouch/cpu_detect.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// A header file for detecting the Intel MMX instructions set extension. 4 | /// 5 | /// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the 6 | /// routine implementations for x86 Windows, x86 gnu version and non-x86 7 | /// platforms, respectively. 8 | /// 9 | /// Author : Copyright (c) Olli Parviainen 10 | /// Author e-mail : oparviai 'at' iki.fi 11 | /// SoundTouch WWW: http://www.surina.net/soundtouch 12 | /// 13 | //////////////////////////////////////////////////////////////////////////////// 14 | // 15 | // Last changed : $Date: 2008-02-10 18:26:55 +0200 (Sun, 10 Feb 2008) $ 16 | // File revision : $Revision: 4 $ 17 | // 18 | // $Id: cpu_detect.h 11 2008-02-10 16:26:55Z oparviai $ 19 | // 20 | //////////////////////////////////////////////////////////////////////////////// 21 | // 22 | // License : 23 | // 24 | // SoundTouch audio processing library 25 | // Copyright (c) Olli Parviainen 26 | // 27 | // This library is free software; you can redistribute it and/or 28 | // modify it under the terms of the GNU Lesser General Public 29 | // License as published by the Free Software Foundation; either 30 | // version 2.1 of the License, or (at your option) any later version. 31 | // 32 | // This library is distributed in the hope that it will be useful, 33 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35 | // Lesser General Public License for more details. 36 | // 37 | // You should have received a copy of the GNU Lesser General Public 38 | // License along with this library; if not, write to the Free Software 39 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 40 | // 41 | //////////////////////////////////////////////////////////////////////////////// 42 | 43 | #ifndef _CPU_DETECT_H_ 44 | #define _CPU_DETECT_H_ 45 | 46 | #include "STTypes.h" 47 | 48 | #define SUPPORT_MMX 0x0001 49 | #define SUPPORT_3DNOW 0x0002 50 | #define SUPPORT_ALTIVEC 0x0004 51 | #define SUPPORT_SSE 0x0008 52 | #define SUPPORT_SSE2 0x0010 53 | 54 | /// Checks which instruction set extensions are supported by the CPU. 55 | /// 56 | /// \return A bitmask of supported extensions, see SUPPORT_... defines. 57 | uint detectCPUextensions(void); 58 | 59 | /// Disables given set of instruction extensions. See SUPPORT_... defines. 60 | void disableExtensions(uint wDisableMask); 61 | 62 | #endif // _CPU_DETECT_H_ 63 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/include/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to create Makefile.in 2 | ## 3 | ## $Id: Makefile.am 11 2008-02-10 16:26:55Z oparviai $ 4 | ## 5 | ## Copyright (C) 2003 - David W. Durham 6 | ## 7 | ## This file is part of SoundTouch, an audio processing library for pitch/time adjustments 8 | ## 9 | ## SoundTouch is free software; you can redistribute it and/or modify it under the 10 | ## terms of the GNU General Public License as published by the Free Software 11 | ## Foundation; either version 2 of the License, or (at your option) any later 12 | ## version. 13 | ## 14 | ## SoundTouch is distributed in the hope that it will be useful, but WITHOUT ANY 15 | ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | ## A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | ## 18 | ## You should have received a copy of the GNU General Public License along with 19 | ## this program; if not, write to the Free Software Foundation, Inc., 59 Temple 20 | ## Place - Suite 330, Boston, MA 02111-1307, USA 21 | 22 | ## I used config/am_include.mk for common definitions 23 | include $(top_srcdir)/config/am_include.mk 24 | 25 | pkginclude_HEADERS=FIFOSampleBuffer.h FIFOSamplePipe.h SoundTouch.h STTypes.h BPMDetect.h soundtouch_config.h 26 | 27 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/include/soundtouch_config.h: -------------------------------------------------------------------------------- 1 | /* include/soundtouch_config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Use Float as Sample type */ 4 | #undef FLOAT_SAMPLES 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_DLFCN_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_INTTYPES_H 11 | 12 | /* Define to 1 if you have the `m' library (-lm). */ 13 | #undef HAVE_LIBM 14 | 15 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 16 | to 0 otherwise. */ 17 | #undef HAVE_MALLOC 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #undef HAVE_MEMORY_H 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #undef HAVE_STDINT_H 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #undef HAVE_STDLIB_H 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #undef HAVE_STRINGS_H 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #undef HAVE_STRING_H 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #undef HAVE_SYS_STAT_H 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #undef HAVE_SYS_TYPES_H 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #undef HAVE_UNISTD_H 42 | 43 | /* Use Integer as Sample type */ 44 | #undef INTEGER_SAMPLES 45 | 46 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 47 | */ 48 | #undef LT_OBJDIR 49 | 50 | /* Name of package */ 51 | #undef PACKAGE 52 | 53 | /* Define to the address where bug reports for this package should be sent. */ 54 | #undef PACKAGE_BUGREPORT 55 | 56 | /* Define to the full name of this package. */ 57 | #undef PACKAGE_NAME 58 | 59 | /* Define to the full name and version of this package. */ 60 | #undef PACKAGE_STRING 61 | 62 | /* Define to the one symbol short name of this package. */ 63 | #undef PACKAGE_TARNAME 64 | 65 | /* Define to the version of this package. */ 66 | #undef PACKAGE_VERSION 67 | 68 | /* Define as the return type of signal handlers (`int' or `void'). */ 69 | #undef RETSIGTYPE 70 | 71 | /* Define to 1 if you have the ANSI C header files. */ 72 | #undef STDC_HEADERS 73 | 74 | /* Version number of package */ 75 | #undef VERSION 76 | 77 | /* Define to empty if `const' does not conform to ANSI C. */ 78 | #undef const 79 | 80 | /* Define to `__inline__' or `__inline' if that's what the C compiler 81 | calls it, or to nothing if 'inline' is not supported under any name. */ 82 | #ifndef __cplusplus 83 | #undef inline 84 | #endif 85 | 86 | /* Define to rpl_malloc if the replacement function should be used. */ 87 | #undef malloc 88 | -------------------------------------------------------------------------------- /VoiceChanger/jni/SoundTouch/soundtouch-jni.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Example Interface class for SoundTouch native compilation 4 | /// 5 | /// Author : Copyright (c) Olli Parviainen 6 | /// Author e-mail : oparviai 'at' iki.fi 7 | /// WWW : http://www.surina.net 8 | /// 9 | //////////////////////////////////////////////////////////////////////////////// 10 | // 11 | // $Id: soundtouch-jni.cpp 173 2013-06-15 11:44:11Z oparviai $ 12 | // 13 | //////////////////////////////////////////////////////////////////////////////// 14 | 15 | #include 16 | #include 17 | 18 | #include "include/SoundTouch.h" 19 | 20 | #define LOGV(...) __android_log_print((int)ANDROID_LOG_INFO, "SOUNDTOUCH", __VA_ARGS__) 21 | //#define LOGV(...) 22 | 23 | #define DLL_PUBLIC __attribute__ ((visibility ("default"))) 24 | 25 | using namespace soundtouch; 26 | 27 | 28 | 29 | extern "C" 30 | JNIEXPORT jstring JNICALL Java_com_dll_voicechanger_SoundTouch_getVersionString 31 | (JNIEnv *env, jobject thiz) { 32 | const char *verStr; 33 | 34 | // Call example SoundTouch routine 35 | verStr = SoundTouch::getVersionString(); 36 | 37 | // return version as string 38 | return env->NewStringUTF(verStr); 39 | } 40 | 41 | extern "C" 42 | JNIEXPORT jlong JNICALL Java_com_dll_voicechanger_SoundTouch_initSoundTouchObject 43 | (JNIEnv *env, jobject thiz) { 44 | SoundTouch* soundTouch = new SoundTouch(); 45 | soundTouch->setSetting(SETTING_SEQUENCE_MS, 40); 46 | soundTouch->setSetting(SETTING_SEEKWINDOW_MS, 15); 47 | soundTouch->setSetting(SETTING_OVERLAP_MS, 8); 48 | return (jlong) soundTouch; 49 | } 50 | 51 | extern "C" 52 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_freeSoundTouchObject 53 | (JNIEnv *env, jobject thiz, jlong objectPtr) { 54 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 55 | if (soundTouch != 0) { 56 | delete(soundTouch); 57 | } 58 | } 59 | 60 | extern "C" 61 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_setSampleRate 62 | (JNIEnv *env, jobject thiz, jint sampleRate, jlong objectPtr) { 63 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 64 | soundTouch->setSampleRate(sampleRate); 65 | } 66 | 67 | extern "C" 68 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_setChannels 69 | (JNIEnv *env, jobject thiz, jint channels, jlong objectPtr) { 70 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 71 | soundTouch->setChannels(channels); 72 | } 73 | 74 | extern "C" 75 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_setTempo 76 | (JNIEnv *env, jobject thiz, jfloat tempo, jlong objectPtr) { 77 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 78 | soundTouch->setTempo(tempo); 79 | } 80 | 81 | extern "C" 82 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_setPitch 83 | (JNIEnv *env, jobject thiz, jfloat pitch, jlong objectPtr) { 84 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 85 | soundTouch->setPitchSemiTones(pitch); 86 | } 87 | 88 | extern "C" 89 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_setRate 90 | (JNIEnv *env, jobject thiz, jfloat rate, jlong objectPtr) { 91 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 92 | soundTouch->setRate(rate); 93 | } 94 | 95 | extern "C" 96 | JNIEXPORT void JNICALL Java_com_dll_voicechanger_SoundTouch_putSamples 97 | (JNIEnv *env, jobject thiz, jshortArray samples, jint length, jlong objectPtr) { 98 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 99 | // 转换为本地数组 100 | jshort *input_samples = env->GetShortArrayElements(samples, NULL); 101 | soundTouch->putSamples(input_samples, length); 102 | // 释放本地数组(避免内存泄露) 103 | env->ReleaseShortArrayElements(samples, input_samples, 0); 104 | } 105 | 106 | 107 | #define BUFFER_SIZE 4096 108 | 109 | extern "C" 110 | JNIEXPORT jshortArray JNICALL Java_com_dll_voicechanger_SoundTouch_receiveSamples 111 | (JNIEnv *env, jobject thiz, jlong objectPtr) { 112 | SoundTouch *soundTouch = (SoundTouch *)objectPtr; 113 | short buffer[BUFFER_SIZE]; 114 | jint nSamples = soundTouch->receiveSamples(buffer, BUFFER_SIZE); 115 | // 局部引用,创建一个short数组 116 | jshortArray receiveSamples = env->NewShortArray(nSamples); 117 | // 给short数组设置值 118 | env->SetShortArrayRegion(receiveSamples, 0, nSamples, buffer); 119 | 120 | return receiveSamples; 121 | } 122 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE:= libspeex 5 | LOCAL_CFLAGS = -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" -UHAVE_CONFIG_H 6 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 7 | 8 | LOCAL_SRC_FILES := libspeex/bits.c \ 9 | libspeex/buffer.c \ 10 | libspeex/cb_search.c \ 11 | libspeex/exc_10_16_table.c \ 12 | libspeex/exc_10_32_table.c \ 13 | libspeex/exc_20_32_table.c \ 14 | libspeex/exc_5_256_table.c \ 15 | libspeex/exc_5_64_table.c \ 16 | libspeex/exc_8_128_table.c \ 17 | libspeex/fftwrap.c \ 18 | libspeex/filterbank.c \ 19 | libspeex/filters.c \ 20 | libspeex/gain_table.c \ 21 | libspeex/gain_table_lbr.c \ 22 | libspeex/hexc_10_32_table.c \ 23 | libspeex/hexc_table.c \ 24 | libspeex/high_lsp_tables.c \ 25 | libspeex/jitter.c \ 26 | libspeex/kiss_fft.c \ 27 | libspeex/kiss_fftr.c \ 28 | libspeex/lpc.c \ 29 | libspeex/lsp.c \ 30 | libspeex/lsp_tables_nb.c \ 31 | libspeex/ltp.c \ 32 | libspeex/mdf.c \ 33 | libspeex/modes.c \ 34 | libspeex/modes_wb.c \ 35 | libspeex/nb_celp.c \ 36 | libspeex/preprocess.c \ 37 | libspeex/quant_lsp.c \ 38 | libspeex/resample.c \ 39 | libspeex/sb_celp.c \ 40 | libspeex/scal.c \ 41 | libspeex/smallft.c \ 42 | libspeex/speex.c \ 43 | libspeex/speex_callbacks.c \ 44 | libspeex/speex_header.c \ 45 | libspeex/stereo.c \ 46 | libspeex/window.c \ 47 | libspeex/vbr.c \ 48 | libspeex/vq.c \ 49 | speex_jni.cpp \ 50 | 51 | 52 | include $(BUILD_SHARED_LIBRARY) -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = speex 3 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/Makefile.am: -------------------------------------------------------------------------------- 1 | # Disable automatic dependency tracking if using other tools than gcc and gmake 2 | #AUTOMAKE_OPTIONS = no-dependencies 3 | 4 | nodist_pkginclude_HEADERS = speex_config_types.h 5 | 6 | pkginclude_HEADERS = speex.h speex_bits.h speex_buffer.h speex_callbacks.h \ 7 | speex_echo.h speex_header.h speex_jitter.h speex_preprocess.h speex_resampler.h \ 8 | speex_stereo.h speex_types.h 9 | 10 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/speex_buffer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007 Jean-Marc Valin 2 | 3 | File: speex_buffer.h 4 | This is a very simple ring buffer implementation. It is not thread-safe 5 | so you need to do your own locking. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | 3. The name of the author may not be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef SPEEX_BUFFER_H 35 | #define SPEEX_BUFFER_H 36 | 37 | #include "speex/speex_types.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | struct SpeexBuffer_; 44 | typedef struct SpeexBuffer_ SpeexBuffer; 45 | 46 | SpeexBuffer *speex_buffer_init(int size); 47 | 48 | void speex_buffer_destroy(SpeexBuffer *st); 49 | 50 | int speex_buffer_write(SpeexBuffer *st, void *data, int len); 51 | 52 | int speex_buffer_writezeros(SpeexBuffer *st, int len); 53 | 54 | int speex_buffer_read(SpeexBuffer *st, void *data, int len); 55 | 56 | int speex_buffer_get_available(SpeexBuffer *st); 57 | 58 | int speex_buffer_resize(SpeexBuffer *st, int len); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/speex_config_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPEEX_TYPES_H__ 2 | #define __SPEEX_TYPES_H__ 3 | typedef short spx_int16_t; 4 | typedef unsigned short spx_uint16_t; 5 | typedef int spx_int32_t; 6 | typedef unsigned int spx_uint32_t; 7 | #endif 8 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/speex_config_types.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __SPEEX_TYPES_H__ 2 | #define __SPEEX_TYPES_H__ 3 | 4 | /* these are filled in by configure */ 5 | typedef @SIZE16@ spx_int16_t; 6 | typedef unsigned @SIZE16@ spx_uint16_t; 7 | typedef @SIZE32@ spx_int32_t; 8 | typedef unsigned @SIZE32@ spx_uint32_t; 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/speex_header.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file speex_header.h 4 | @brief Describes the Speex header 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | 37 | #ifndef SPEEX_HEADER_H 38 | #define SPEEX_HEADER_H 39 | /** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header 40 | * This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP. 41 | * @{ 42 | */ 43 | 44 | #include "speex/speex_types.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | struct SpeexMode; 51 | 52 | /** Length of the Speex header identifier */ 53 | #define SPEEX_HEADER_STRING_LENGTH 8 54 | 55 | /** Maximum number of characters for encoding the Speex version number in the header */ 56 | #define SPEEX_HEADER_VERSION_LENGTH 20 57 | 58 | /** Speex header info for file-based formats */ 59 | typedef struct SpeexHeader { 60 | char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */ 61 | char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */ 62 | spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */ 63 | spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */ 64 | spx_int32_t rate; /**< Sampling rate used */ 65 | spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */ 66 | spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */ 67 | spx_int32_t nb_channels; /**< Number of channels encoded */ 68 | spx_int32_t bitrate; /**< Bit-rate used */ 69 | spx_int32_t frame_size; /**< Size of frames */ 70 | spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */ 71 | spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */ 72 | spx_int32_t extra_headers; /**< Number of additional headers after the comments */ 73 | spx_int32_t reserved1; /**< Reserved for future use, must be zero */ 74 | spx_int32_t reserved2; /**< Reserved for future use, must be zero */ 75 | } SpeexHeader; 76 | 77 | /** Initializes a SpeexHeader using basic information */ 78 | void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m); 79 | 80 | /** Creates the header packet from the header itself (mostly involves endianness conversion) */ 81 | char *speex_header_to_packet(SpeexHeader *header, int *size); 82 | 83 | /** Creates a SpeexHeader from a packet */ 84 | SpeexHeader *speex_packet_to_header(char *packet, int size); 85 | 86 | /** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */ 87 | void speex_header_free(void *ptr); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | /** @} */ 94 | #endif 95 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/speex_stereo.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin*/ 2 | /** 3 | @file speex_stereo.h 4 | @brief Describes the handling for intensity stereo 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef STEREO_H 36 | #define STEREO_H 37 | /** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files 38 | * This describes the Speex intensity stereo encoding/decoding 39 | * @{ 40 | */ 41 | 42 | #include "speex/speex_types.h" 43 | #include "speex/speex_bits.h" 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** If you access any of these fields directly, I'll personally come and bite you */ 50 | typedef struct SpeexStereoState { 51 | float balance; /**< Left/right balance info */ 52 | float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */ 53 | float smooth_left; /**< Smoothed left channel gain */ 54 | float smooth_right; /**< Smoothed right channel gain */ 55 | float reserved1; /**< Reserved for future use */ 56 | float reserved2; /**< Reserved for future use */ 57 | } SpeexStereoState; 58 | 59 | /** Deprecated. Use speex_stereo_state_init() instead. */ 60 | #define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0} 61 | 62 | /** Initialise/create a stereo stereo state */ 63 | SpeexStereoState *speex_stereo_state_init(); 64 | 65 | /** Reset/re-initialise an already allocated stereo state */ 66 | void speex_stereo_state_reset(SpeexStereoState *stereo); 67 | 68 | /** Destroy a stereo stereo state */ 69 | void speex_stereo_state_destroy(SpeexStereoState *stereo); 70 | 71 | /** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */ 72 | void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits); 73 | 74 | /** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */ 75 | void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits); 76 | 77 | /** Transforms a mono frame into a stereo frame using intensity stereo info */ 78 | void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo); 79 | 80 | /** Transforms a mono frame into a stereo frame using intensity stereo info */ 81 | void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo); 82 | 83 | /** Callback handler for intensity stereo info */ 84 | int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | /** @} */ 91 | #endif 92 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/include/speex/speex_types.h: -------------------------------------------------------------------------------- 1 | /* speex_types.h taken from libogg */ 2 | /******************************************************************** 3 | * * 4 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * by the Xiph.Org Foundation http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 15 | last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $ 16 | 17 | ********************************************************************/ 18 | /** 19 | @file speex_types.h 20 | @brief Speex types 21 | */ 22 | #ifndef _SPEEX_TYPES_H 23 | #define _SPEEX_TYPES_H 24 | 25 | #if defined(_WIN32) 26 | 27 | # if defined(__CYGWIN__) 28 | # include <_G_config.h> 29 | typedef _G_int32_t spx_int32_t; 30 | typedef _G_uint32_t spx_uint32_t; 31 | typedef _G_int16_t spx_int16_t; 32 | typedef _G_uint16_t spx_uint16_t; 33 | # elif defined(__MINGW32__) 34 | typedef short spx_int16_t; 35 | typedef unsigned short spx_uint16_t; 36 | typedef int spx_int32_t; 37 | typedef unsigned int spx_uint32_t; 38 | # elif defined(__MWERKS__) 39 | typedef int spx_int32_t; 40 | typedef unsigned int spx_uint32_t; 41 | typedef short spx_int16_t; 42 | typedef unsigned short spx_uint16_t; 43 | # else 44 | /* MSVC/Borland */ 45 | typedef __int32 spx_int32_t; 46 | typedef unsigned __int32 spx_uint32_t; 47 | typedef __int16 spx_int16_t; 48 | typedef unsigned __int16 spx_uint16_t; 49 | # endif 50 | 51 | #elif defined(__MACOS__) 52 | 53 | # include 54 | typedef SInt16 spx_int16_t; 55 | typedef UInt16 spx_uint16_t; 56 | typedef SInt32 spx_int32_t; 57 | typedef UInt32 spx_uint32_t; 58 | 59 | #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ 60 | 61 | # include 62 | typedef int16_t spx_int16_t; 63 | typedef u_int16_t spx_uint16_t; 64 | typedef int32_t spx_int32_t; 65 | typedef u_int32_t spx_uint32_t; 66 | 67 | #elif defined(__BEOS__) 68 | 69 | /* Be */ 70 | # include 71 | typedef int16_t spx_int16_t; 72 | typedef u_int16_t spx_uint16_t; 73 | typedef int32_t spx_int32_t; 74 | typedef u_int32_t spx_uint32_t; 75 | 76 | #elif defined (__EMX__) 77 | 78 | /* OS/2 GCC */ 79 | typedef short spx_int16_t; 80 | typedef unsigned short spx_uint16_t; 81 | typedef int spx_int32_t; 82 | typedef unsigned int spx_uint32_t; 83 | 84 | #elif defined (DJGPP) 85 | 86 | /* DJGPP */ 87 | typedef short spx_int16_t; 88 | typedef int spx_int32_t; 89 | typedef unsigned int spx_uint32_t; 90 | 91 | #elif defined(R5900) 92 | 93 | /* PS2 EE */ 94 | typedef int spx_int32_t; 95 | typedef unsigned spx_uint32_t; 96 | typedef short spx_int16_t; 97 | 98 | #elif defined(__SYMBIAN32__) 99 | 100 | /* Symbian GCC */ 101 | typedef signed short spx_int16_t; 102 | typedef unsigned short spx_uint16_t; 103 | typedef signed int spx_int32_t; 104 | typedef unsigned int spx_uint32_t; 105 | 106 | #elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) 107 | 108 | typedef short spx_int16_t; 109 | typedef unsigned short spx_uint16_t; 110 | typedef long spx_int32_t; 111 | typedef unsigned long spx_uint32_t; 112 | 113 | #elif defined(CONFIG_TI_C6X) 114 | 115 | typedef short spx_int16_t; 116 | typedef unsigned short spx_uint16_t; 117 | typedef int spx_int32_t; 118 | typedef unsigned int spx_uint32_t; 119 | 120 | #else 121 | 122 | # include 123 | 124 | #endif 125 | 126 | #endif /* _SPEEX_TYPES_H */ 127 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/Makefile.am: -------------------------------------------------------------------------------- 1 | # Disable automatic dependency tracking if using other tools than gcc and gmake 2 | #AUTOMAKE_OPTIONS = no-dependencies 3 | 4 | 5 | EXTRA_DIST=echo_diagnostic.m 6 | 7 | INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) @OGG_CFLAGS@ @FFT_CFLAGS@ 8 | 9 | lib_LTLIBRARIES = libspeex.la libspeexdsp.la 10 | 11 | # Sources for compilation in the library 12 | libspeex_la_SOURCES = cb_search.c exc_10_32_table.c exc_8_128_table.c \ 13 | filters.c gain_table.c hexc_table.c high_lsp_tables.c lsp.c \ 14 | ltp.c speex.c stereo.c vbr.c vq.c bits.c exc_10_16_table.c \ 15 | exc_20_32_table.c exc_5_256_table.c exc_5_64_table.c gain_table_lbr.c hexc_10_32_table.c \ 16 | lpc.c lsp_tables_nb.c modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \ 17 | speex_callbacks.c speex_header.c window.c 18 | 19 | if BUILD_KISS_FFT 20 | FFTSRC=kiss_fft.c _kiss_fft_guts.h kiss_fft.h kiss_fftr.c kiss_fftr.h 21 | else 22 | if BUILD_SMALLFT 23 | FFTSRC=smallft.c 24 | else 25 | FFTSRC= 26 | endif 27 | endif 28 | 29 | libspeexdsp_la_SOURCES = preprocess.c jitter.c mdf.c fftwrap.c filterbank.c resample.c buffer.c scal.c $(FFTSRC) 30 | 31 | noinst_HEADERS = arch.h cb_search_arm4.h cb_search_bfin.h cb_search_sse.h \ 32 | filters.h filters_arm4.h filters_bfin.h filters_sse.h fixed_arm4.h \ 33 | fixed_arm5e.h fixed_bfin.h fixed_debug.h lpc.h lpc_bfin.h ltp.h ltp_arm4.h \ 34 | ltp_sse.h math_approx.h misc_bfin.h nb_celp.h quant_lsp.h sb_celp.h \ 35 | stack_alloc.h vbr.h vq.h vq_arm4.h vq_bfin.h vq_sse.h cb_search.h fftwrap.h \ 36 | filterbank.h fixed_generic.h lsp.h lsp_bfin.h ltp_bfin.h modes.h os_support.h \ 37 | pseudofloat.h quant_lsp_bfin.h smallft.h vorbis_psy.h resample_sse.h 38 | 39 | 40 | libspeex_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@ 41 | libspeexdsp_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@ 42 | 43 | noinst_PROGRAMS = testenc testenc_wb testenc_uwb testdenoise testecho testjitter 44 | testenc_SOURCES = testenc.c 45 | testenc_LDADD = libspeex.la 46 | testenc_wb_SOURCES = testenc_wb.c 47 | testenc_wb_LDADD = libspeex.la 48 | testenc_uwb_SOURCES = testenc_uwb.c 49 | testenc_uwb_LDADD = libspeex.la 50 | testdenoise_SOURCES = testdenoise.c 51 | testdenoise_LDADD = libspeexdsp.la @FFT_LIBS@ 52 | testecho_SOURCES = testecho.c 53 | testecho_LDADD = libspeexdsp.la @FFT_LIBS@ 54 | testjitter_SOURCES = testjitter.c 55 | testjitter_LDADD = libspeexdsp.la @FFT_LIBS@ 56 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/cb_search.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin & David Rowe */ 2 | /** 3 | @file cb_search.h 4 | @brief Overlapped codebook search 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef CB_SEARCH_H 36 | #define CB_SEARCH_H 37 | 38 | #include 39 | #include "arch.h" 40 | 41 | /** Split codebook parameters. */ 42 | typedef struct split_cb_params { 43 | int subvect_size; 44 | int nb_subvect; 45 | const signed char *shape_cb; 46 | int shape_bits; 47 | int have_sign; 48 | } split_cb_params; 49 | 50 | 51 | void split_cb_search_shape_sign( 52 | spx_word16_t target[], /* target vector */ 53 | spx_coef_t ak[], /* LPCs for this subframe */ 54 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ 55 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ 56 | const void *par, /* Codebook/search parameters */ 57 | int p, /* number of LPC coeffs */ 58 | int nsf, /* number of samples in subframe */ 59 | spx_sig_t *exc, 60 | spx_word16_t *r, 61 | SpeexBits *bits, 62 | char *stack, 63 | int complexity, 64 | int update_target 65 | ); 66 | 67 | void split_cb_shape_sign_unquant( 68 | spx_sig_t *exc, 69 | const void *par, /* non-overlapping codebook */ 70 | int nsf, /* number of samples in subframe */ 71 | SpeexBits *bits, 72 | char *stack, 73 | spx_int32_t *seed 74 | ); 75 | 76 | 77 | void noise_codebook_quant( 78 | spx_word16_t target[], /* target vector */ 79 | spx_coef_t ak[], /* LPCs for this subframe */ 80 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ 81 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ 82 | const void *par, /* Codebook/search parameters */ 83 | int p, /* number of LPC coeffs */ 84 | int nsf, /* number of samples in subframe */ 85 | spx_sig_t *exc, 86 | spx_word16_t *r, 87 | SpeexBits *bits, 88 | char *stack, 89 | int complexity, 90 | int update_target 91 | ); 92 | 93 | 94 | void noise_codebook_unquant( 95 | spx_sig_t *exc, 96 | const void *par, /* non-overlapping codebook */ 97 | int nsf, /* number of samples in subframe */ 98 | SpeexBits *bits, 99 | char *stack, 100 | spx_int32_t *seed 101 | ); 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/cb_search_bfin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2005 Analog Devices */ 2 | /** 3 | @author Jean-Marc Valin 4 | @file cb_search_bfin.h 5 | @brief Fixed codebook functions (Blackfin version) 6 | */ 7 | /* 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in the 17 | documentation and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the Xiph.org Foundation nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK 37 | void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack) 38 | { 39 | int i; 40 | for (i=0;i>>= 13;\n\t" 65 | "A1 += R0.L*R0.L (IS);\n\t" 66 | "W[P3++] = R0;\n\t" 67 | "P0 += 1;\n\t" 68 | "P2 += 2;\n\t" 69 | "LOOP_END outter%=;\n\t" 70 | "P4 = %4;\n\t" 71 | "R1 = A1;\n\t" 72 | "[P4] = R1;\n\t" 73 | : 74 | : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E) 75 | : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", 76 | "L1", "A0", "A1", "memory" 77 | #if !(__GNUC__ == 3) 78 | , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */ 79 | #endif 80 | ); 81 | shape_cb += subvect_size; 82 | resp += subvect_size; 83 | E++; 84 | } 85 | } 86 | 87 | #define OVERRIDE_TARGET_UPDATE 88 | static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len) 89 | { 90 | if (!len) 91 | return; 92 | __asm__ __volatile__ 93 | ( 94 | "I0 = %0;\n\t" 95 | "I1 = %1;\n\t" 96 | "L0 = 0;\n\t" 97 | "L1 = 0;\n\t" 98 | "R2 = 4096;\n\t" 99 | "LOOP tupdate%= LC0 = %3;\n\t" 100 | "LOOP_BEGIN tupdate%=;\n\t" 101 | "R0.L = W[I0] || R1.L = W[I1++];\n\t" 102 | "R1 = (A1 = R1.L*%2.L) (IS);\n\t" 103 | "R1 = R1 + R2;\n\t" 104 | "R1 >>>= 13;\n\t" 105 | "R0.L = R0.L - R1.L;\n\t" 106 | "W[I0++] = R0.L;\n\t" 107 | "LOOP_END tupdate%=;\n\t" 108 | : 109 | : "a" (t), "a" (r), "d" (g), "a" (len) 110 | : "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1" 111 | ); 112 | } 113 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/cb_search_sse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Jean-Marc Valin */ 2 | /** 3 | @file cb_search_sse.h 4 | @brief Fixed codebook functions (SSE version) 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #include 36 | 37 | static inline void _spx_mm_getr_ps (__m128 U, float *__Z, float *__Y, float *__X, float *__W) 38 | { 39 | union { 40 | float __a[4]; 41 | __m128 __v; 42 | } __u; 43 | 44 | __u.__v = U; 45 | 46 | *__Z = __u.__a[0]; 47 | *__Y = __u.__a[1]; 48 | *__X = __u.__a[2]; 49 | *__W = __u.__a[3]; 50 | 51 | } 52 | 53 | #define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK 54 | static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *_r, float *resp, __m128 *resp2, __m128 *E, int shape_cb_size, int subvect_size, char *stack) 55 | { 56 | int i, j, k; 57 | __m128 resj, EE; 58 | VARDECL(__m128 *r); 59 | VARDECL(__m128 *shape); 60 | ALLOC(r, subvect_size, __m128); 61 | ALLOC(shape, subvect_size, __m128); 62 | for(j=0;j>2] = EE; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/echo_diagnostic.m: -------------------------------------------------------------------------------- 1 | % Attempts to diagnose AEC problems from recorded samples 2 | % 3 | % out = echo_diagnostic(rec_file, play_file, out_file, tail_length) 4 | % 5 | % Computes the full matrix inversion to cancel echo from the 6 | % recording 'rec_file' using the far end signal 'play_file' using 7 | % a filter length of 'tail_length'. The output is saved to 'out_file'. 8 | function out = echo_diagnostic(rec_file, play_file, out_file, tail_length) 9 | 10 | F=fopen(rec_file,'rb'); 11 | rec=fread(F,Inf,'short'); 12 | fclose (F); 13 | F=fopen(play_file,'rb'); 14 | play=fread(F,Inf,'short'); 15 | fclose (F); 16 | 17 | rec = [rec; zeros(1024,1)]; 18 | play = [play; zeros(1024,1)]; 19 | 20 | N = length(rec); 21 | corr = real(ifft(fft(rec).*conj(fft(play)))); 22 | acorr = real(ifft(fft(play).*conj(fft(play)))); 23 | 24 | [a,b] = max(corr); 25 | 26 | if b > N/2 27 | b = b-N; 28 | end 29 | printf ("Far end to near end delay is %d samples\n", b); 30 | if (b > .3*tail_length) 31 | printf ('This is too much delay, try delaying the far-end signal a bit\n'); 32 | else if (b < 0) 33 | printf ('You have a negative delay, the echo canceller has no chance to cancel anything!\n'); 34 | else 35 | printf ('Delay looks OK.\n'); 36 | end 37 | end 38 | end 39 | N2 = round(N/2); 40 | corr1 = real(ifft(fft(rec(1:N2)).*conj(fft(play(1:N2))))); 41 | corr2 = real(ifft(fft(rec(N2+1:end)).*conj(fft(play(N2+1:end))))); 42 | 43 | [a,b1] = max(corr1); 44 | if b1 > N2/2 45 | b1 = b1-N2; 46 | end 47 | [a,b2] = max(corr2); 48 | if b2 > N2/2 49 | b2 = b2-N2; 50 | end 51 | drift = (b1-b2)/N2; 52 | printf ('Drift estimate is %f%% (%d samples)\n', 100*drift, b1-b2); 53 | if abs(b1-b2) < 10 54 | printf ('A drift of a few (+-10) samples is normal.\n'); 55 | else 56 | if abs(b1-b2) < 30 57 | printf ('There may be (not sure) excessive clock drift. Is the capture and playback done on the same soundcard?\n'); 58 | else 59 | printf ('Your clock is drifting! No way the AEC will be able to do anything with that. Most likely, you''re doing capture and playback from two different cards.\n'); 60 | end 61 | end 62 | end 63 | acorr(1) = .001+1.00001*acorr(1); 64 | AtA = toeplitz(acorr(1:tail_length)); 65 | bb = corr(1:tail_length); 66 | h = AtA\bb; 67 | 68 | out = (rec - filter(h, 1, play)); 69 | 70 | F=fopen(out_file,'w'); 71 | fwrite(F,out,'short'); 72 | fclose (F); 73 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/exc_10_16_table.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin 2 | File: exc_10_16_table.c 3 | Codebook for excitation in narrowband CELP mode (3200 bps) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | - Neither the name of the Xiph.org Foundation nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | const signed char exc_10_16_table[160] = { 35 | 22,39,14,44,11,35,-2,23,-4,6, 36 | 46,-28,13,-27,-23,12,4,20,-5,9, 37 | 37,-18,-23,23,0,9,-6,-20,4,-1, 38 | -17,-5,-4,17,0,1,9,-2,1,2, 39 | 2,-12,8,-25,39,15,9,16,-55,-11, 40 | 9,11,5,10,-2,-60,8,13,-6,11, 41 | -16,27,-47,-12,11,1,16,-7,9,-3, 42 | -29,9,-14,25,-19,34,36,12,40,-10, 43 | -3,-24,-14,-37,-21,-35,-2,-36,3,-6, 44 | 67,28,6,-17,-3,-12,-16,-15,-17,-7, 45 | -59,-36,-13,1,7,1,2,10,2,11, 46 | 13,10,8,-2,7,3,5,4,2,2, 47 | -3,-8,4,-5,6,7,-42,15,35,-2, 48 | -46,38,28,-20,-9,1,7,-3,0,-2, 49 | 0,0,0,0,0,0,0,0,0,0, 50 | -15,-28,52,32,5,-5,-17,-20,-10,-1}; 51 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/exc_10_32_table.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin 2 | File: exc_10_32_table.c 3 | Codebook for excitation in narrowband CELP mode (4000 bps) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | - Neither the name of the Xiph.org Foundation nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | const signed char exc_10_32_table[320] = { 35 | 7,17,17,27,25,22,12,4,-3,0, 36 | 28,-36,39,-24,-15,3,-9,15,-5,10, 37 | 31,-28,11,31,-21,9,-11,-11,-2,-7, 38 | -25,14,-22,31,4,-14,19,-12,14,-5, 39 | 4,-7,4,-5,9,0,-2,42,-47,-16, 40 | 1,8,0,9,23,-57,0,28,-11,6, 41 | -31,55,-45,3,-5,4,2,-2,4,-7, 42 | -3,6,-2,7,-3,12,5,8,54,-10, 43 | 8,-7,-8,-24,-25,-27,-14,-5,8,5, 44 | 44,23,5,-9,-11,-11,-13,-9,-12,-8, 45 | -29,-8,-22,6,-15,3,-12,-1,-5,-3, 46 | 34,-1,29,-16,17,-4,12,2,1,4, 47 | -2,-4,2,-1,11,-3,-52,28,30,-9, 48 | -32,25,44,-20,-24,4,6,-1,0,0, 49 | 0,0,0,0,0,0,0,0,0,0, 50 | -25,-10,22,29,13,-13,-22,-13,-4,0, 51 | -4,-16,10,15,-36,-24,28,25,-1,-3, 52 | 66,-33,-11,-15,6,0,3,4,-2,5, 53 | 24,-20,-47,29,19,-2,-4,-1,0,-1, 54 | -2,3,1,8,-11,5,5,-57,28,28, 55 | 0,-16,4,-4,12,-6,-1,2,-20,61, 56 | -9,24,-22,-42,29,6,17,8,4,2, 57 | -65,15,8,10,5,6,5,3,2,-2, 58 | -3,5,-9,4,-5,23,13,23,-3,-63, 59 | 3,-5,-4,-6,0,-3,23,-36,-46,9, 60 | 5,5,8,4,9,-5,1,-3,10,1, 61 | -6,10,-11,24,-47,31,22,-12,14,-10, 62 | 6,11,-7,-7,7,-31,51,-12,-6,7, 63 | 6,-17,9,-11,-20,52,-19,3,-6,-6, 64 | -8,-5,23,-41,37,1,-21,10,-14,8, 65 | 7,5,-15,-15,23,39,-26,-33,7,2, 66 | -32,-30,-21,-8,4,12,17,15,14,11}; 67 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/exc_20_32_table.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin 2 | File: exc_20_32_table.c 3 | Codebook for excitation in narrowband CELP mode (2000 bps) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | - Neither the name of the Xiph.org Foundation nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | const signed char exc_20_32_table[640] = { 35 | 12,32,25,46,36,33,9,14,-3,6,1,-8,0,-10,-5,-7,-7,-7,-5,-5, 36 | 31,-27,24,-32,-4,10,-11,21,-3,19,23,-9,22,24,-10,-1,-10,-13,-7,-11, 37 | 42,-33,31,19,-8,0,-10,-16,1,-21,-17,10,-8,14,8,4,11,-2,5,-2, 38 | -33,11,-16,33,11,-4,9,-4,11,2,6,-5,8,-5,11,-4,-6,26,-36,-16, 39 | 0,4,-2,-8,12,6,-1,34,-46,-22,9,9,21,9,5,-66,-5,26,2,10, 40 | 13,2,19,9,12,-81,3,13,13,0,-14,22,-35,6,-7,-4,6,-6,10,-6, 41 | -31,38,-33,0,-10,-11,5,-12,12,-17,5,0,-6,13,-9,10,8,25,33,2, 42 | -12,8,-6,10,-2,21,7,17,43,5,11,-7,-9,-20,-36,-20,-23,-4,-4,-3, 43 | 27,-9,-9,-49,-39,-38,-11,-9,6,5,23,25,5,3,3,4,1,2,-3,-1, 44 | 87,39,17,-21,-9,-19,-9,-15,-13,-14,-17,-11,-10,-11,-8,-6,-1,-3,-3,-1, 45 | -54,-34,-27,-8,-11,-4,-5,0,0,4,8,6,9,7,9,7,6,5,5,5, 46 | 48,10,19,-10,12,-1,9,-3,2,5,-3,2,-2,-2,0,-2,-26,6,9,-7, 47 | -16,-9,2,7,7,-5,-43,11,22,-11,-9,34,37,-15,-13,-6,1,-1,1,1, 48 | -64,56,52,-11,-27,5,4,3,1,2,1,3,-1,-4,-4,-10,-7,-4,-4,2, 49 | -1,-7,-7,-12,-10,-15,-9,-5,-5,-11,-16,-13,6,16,4,-13,-16,-10,-4,2, 50 | -47,-13,25,47,19,-14,-20,-8,-17,0,-3,-13,1,6,-17,-14,15,1,10,6, 51 | -24,0,-10,19,-69,-8,14,49,17,-5,33,-29,3,-4,0,2,-8,5,-6,2, 52 | 120,-56,-12,-47,23,-9,6,-5,1,2,-5,1,-10,4,-1,-1,4,-1,0,-3, 53 | 30,-52,-67,30,22,11,-1,-4,3,0,7,2,0,1,-10,-4,-8,-13,5,1, 54 | 1,-1,5,13,-9,-3,-10,-62,22,48,-4,-6,2,3,5,1,1,4,1,13, 55 | 3,-20,10,-9,13,-2,-4,9,-20,44,-1,20,-32,-67,19,0,28,11,8,2, 56 | -11,15,-19,-53,31,2,34,10,6,-4,-58,8,10,13,14,1,12,2,0,0, 57 | -128,37,-8,44,-9,26,-3,18,2,6,11,-1,9,1,5,3,0,1,1,2, 58 | 12,3,-2,-3,7,25,9,18,-6,-37,3,-8,-16,3,-10,-7,17,-34,-44,11, 59 | 17,-15,-3,-16,-1,-13,11,-46,-65,-2,8,13,2,4,4,5,15,5,9,6, 60 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 61 | -9,19,-12,12,-28,38,29,-1,12,2,5,23,-10,3,4,-15,21,-4,3,3, 62 | 6,17,-9,-4,-8,-20,26,5,-10,6,1,-19,18,-15,-12,47,-6,-2,-7,-9, 63 | -1,-17,-2,-2,-14,30,-14,2,-7,-4,-1,-12,11,-25,16,-3,-12,11,-7,7, 64 | -17,1,19,-28,31,-7,-10,7,-10,3,12,5,-16,6,24,41,-29,-54,0,1, 65 | 7,-1,5,-6,13,10,-4,-8,8,-9,-27,-53,-38,-1,10,19,17,16,12,12, 66 | 0,3,-7,-4,13,12,-31,-14,6,-5,3,5,17,43,50,25,10,1,-6,-2}; 67 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/exc_5_64_table.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin 2 | File: exc_5_64_table.c 3 | Codebook for excitation in narrowband CELP mode (9600 bps) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | - Neither the name of the Xiph.org Foundation nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | const signed char exc_5_64_table[320]={ 35 | 1,5,-15,49,-66, 36 | -48,-4,50,-44,7, 37 | 37,16,-18,25,-26, 38 | -26,-15,19,19,-27, 39 | -47,28,57,5,-17, 40 | -32,-41,68,21,-2, 41 | 64,56,8,-16,-13, 42 | -26,-9,-16,11,6, 43 | -39,25,-19,22,-31, 44 | 20,-45,55,-43,10, 45 | -16,47,-40,40,-20, 46 | -51,3,-17,-14,-15, 47 | -24,53,-20,-46,46, 48 | 27,-68,32,3,-18, 49 | -5,9,-31,16,-9, 50 | -10,-1,-23,48,95, 51 | 47,25,-41,-32,-3, 52 | 15,-25,-55,36,41, 53 | -27,20,5,13,14, 54 | -22,5,2,-23,18, 55 | 46,-15,17,-18,-34, 56 | -5,-8,27,-55,73, 57 | 16,2,-1,-17,40, 58 | -78,33,0,2,19, 59 | 4,53,-16,-15,-16, 60 | -28,-3,-13,49,8, 61 | -7,-29,27,-13,32, 62 | 20,32,-61,16,14, 63 | 41,44,40,24,20, 64 | 7,4,48,-60,-77, 65 | 17,-6,-48,65,-15, 66 | 32,-30,-71,-10,-3, 67 | -6,10,-2,-7,-29, 68 | -56,67,-30,7,-5, 69 | 86,-6,-10,0,5, 70 | -31,60,34,-38,-3, 71 | 24,10,-2,30,23, 72 | 24,-41,12,70,-43, 73 | 15,-17,6,13,16, 74 | -13,8,30,-15,-8, 75 | 5,23,-34,-98,-4, 76 | -13,13,-48,-31,70, 77 | 12,31,25,24,-24, 78 | 26,-7,33,-16,8, 79 | 5,-11,-14,-8,-65, 80 | 13,10,-2,-9,0, 81 | -3,-68,5,35,7, 82 | 0,-31,-1,-17,-9, 83 | -9,16,-37,-18,-1, 84 | 69,-48,-28,22,-21, 85 | -11,5,49,55,23, 86 | -86,-36,16,2,13, 87 | 63,-51,30,-11,13, 88 | 24,-18,-6,14,-19, 89 | 1,41,9,-5,27, 90 | -36,-44,-34,-37,-21, 91 | -26,31,-39,15,43, 92 | 5,-8,29,20,-8, 93 | -20,-52,-28,-1,13, 94 | 26,-34,-10,-9,27, 95 | -8,8,27,-66,4, 96 | 12,-22,49,10,-77, 97 | 32,-18,3,-38,12, 98 | -3,-1,2,2,0}; 99 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/fftwrap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2005 Jean-Marc Valin 2 | File: fftwrap.h 3 | 4 | Wrapper for various FFTs 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | - Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | - Neither the name of the Xiph.org Foundation nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | */ 34 | 35 | #ifndef FFTWRAP_H 36 | #define FFTWRAP_H 37 | 38 | #include "arch.h" 39 | 40 | /** Compute tables for an FFT */ 41 | void *spx_fft_init(int size); 42 | 43 | /** Destroy tables for an FFT */ 44 | void spx_fft_destroy(void *table); 45 | 46 | /** Forward (real to half-complex) transform */ 47 | void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out); 48 | 49 | /** Backward (half-complex to real) transform */ 50 | void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out); 51 | 52 | /** Forward (real to half-complex) transform of float data */ 53 | void spx_fft_float(void *table, float *in, float *out); 54 | 55 | /** Backward (half-complex to real) transform of float data */ 56 | void spx_ifft_float(void *table, float *in, float *out); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/filterbank.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 Jean-Marc Valin */ 2 | /** 3 | @file filterbank.h 4 | @brief Converting between psd and filterbank 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | 3. The name of the author may not be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef FILTERBANK_H 35 | #define FILTERBANK_H 36 | 37 | #include "arch.h" 38 | 39 | typedef struct { 40 | int *bank_left; 41 | int *bank_right; 42 | spx_word16_t *filter_left; 43 | spx_word16_t *filter_right; 44 | #ifndef FIXED_POINT 45 | float *scaling; 46 | #endif 47 | int nb_banks; 48 | int len; 49 | } FilterBank; 50 | 51 | 52 | FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type); 53 | 54 | void filterbank_destroy(FilterBank *bank); 55 | 56 | void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel); 57 | 58 | void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd); 59 | 60 | #ifndef FIXED_POINT 61 | void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel); 62 | void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd); 63 | #endif 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/filters.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file filters.h 4 | @brief Various analysis/synthesis filters 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef FILTERS_H 36 | #define FILTERS_H 37 | 38 | #include "arch.h" 39 | 40 | spx_word16_t compute_rms(const spx_sig_t *x, int len); 41 | spx_word16_t compute_rms16(const spx_word16_t *x, int len); 42 | void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len); 43 | void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len); 44 | 45 | #ifdef FIXED_POINT 46 | 47 | int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len); 48 | 49 | #endif 50 | 51 | 52 | #define HIGHPASS_NARROWBAND 0 53 | #define HIGHPASS_WIDEBAND 2 54 | #define HIGHPASS_INPUT 0 55 | #define HIGHPASS_OUTPUT 1 56 | #define HIGHPASS_IRS 4 57 | 58 | void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem); 59 | 60 | 61 | void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack); 62 | void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack); 63 | 64 | void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); 65 | void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); 66 | void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); 67 | 68 | /* Apply bandwidth expansion on LPC coef */ 69 | void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order); 70 | void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len); 71 | 72 | 73 | void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); 74 | void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); 75 | 76 | void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); 77 | 78 | void multicomb( 79 | spx_word16_t *exc, /*decoded excitation*/ 80 | spx_word16_t *new_exc, /*enhanced excitation*/ 81 | spx_coef_t *ak, /*LPC filter coefs*/ 82 | int p, /*LPC order*/ 83 | int nsf, /*sub-frame size*/ 84 | int pitch, /*pitch period*/ 85 | int max_pitch, /*pitch gain (3-tap)*/ 86 | spx_word16_t comb_gain, /*gain of comb filter*/ 87 | char *stack 88 | ); 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/filters_arm4.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Jean-Marc Valin */ 2 | /** 3 | @file filters_arm4.h 4 | @brief Various analysis/synthesis filters (ARM4 version) 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #define OVERRIDE_NORMALIZE16 36 | int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len) 37 | { 38 | spx_sig_t max_val=1; 39 | int sig_shift; 40 | int dead1, dead2, dead3, dead4, dead5, dead6; 41 | 42 | __asm__ __volatile__ ( 43 | "\tmov %1, #1 \n" 44 | "\tmov %3, #0 \n" 45 | 46 | ".normalize16loop1%=: \n" 47 | 48 | "\tldr %4, [%0], #4 \n" 49 | "\tcmps %4, %1 \n" 50 | "\tmovgt %1, %4 \n" 51 | "\tcmps %4, %3 \n" 52 | "\tmovlt %3, %4 \n" 53 | 54 | "\tsubs %2, %2, #1 \n" 55 | "\tbne .normalize16loop1%=\n" 56 | 57 | "\trsb %3, %3, #0 \n" 58 | "\tcmp %1, %3 \n" 59 | "\tmovlt %1, %3 \n" 60 | : "=r" (dead1), "=r" (max_val), "=r" (dead3), "=r" (dead4), 61 | "=r" (dead5), "=r" (dead6) 62 | : "0" (x), "2" (len) 63 | : "cc"); 64 | 65 | sig_shift=0; 66 | while (max_val>max_scale) 67 | { 68 | sig_shift++; 69 | max_val >>= 1; 70 | } 71 | 72 | __asm__ __volatile__ ( 73 | ".normalize16loop%=: \n" 74 | 75 | "\tldr %4, [%0], #4 \n" 76 | "\tldr %5, [%0], #4 \n" 77 | "\tmov %4, %4, asr %3 \n" 78 | "\tstrh %4, [%1], #2 \n" 79 | "\tldr %4, [%0], #4 \n" 80 | "\tmov %5, %5, asr %3 \n" 81 | "\tstrh %5, [%1], #2 \n" 82 | "\tldr %5, [%0], #4 \n" 83 | "\tmov %4, %4, asr %3 \n" 84 | "\tstrh %4, [%1], #2 \n" 85 | "\tsubs %2, %2, #1 \n" 86 | "\tmov %5, %5, asr %3 \n" 87 | "\tstrh %5, [%1], #2 \n" 88 | 89 | "\tbgt .normalize16loop%=\n" 90 | : "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4), 91 | "=r" (dead5), "=r" (dead6) 92 | : "0" (x), "1" (y), "2" (len>>2), "3" (sig_shift) 93 | : "cc", "memory"); 94 | return sig_shift; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/gain_table_lbr.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin 2 | File: gain_table_lbr.c 3 | Codebook for 3-tap pitch prediction gain (32 entries) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | 3. The name of the author may not be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 23 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | const signed char gain_cdbk_lbr[128] = { 33 | -32, -32, -32, 0, 34 | -31, -58, -16, 22, 35 | -41, -24, -43, 14, 36 | -56, -22, -55, 29, 37 | -13, 33, -41, 47, 38 | -4, -39, -9, 29, 39 | -41, 15, -12, 38, 40 | -8, -15, -12, 31, 41 | 1, 2, -44, 40, 42 | -22, -66, -42, 27, 43 | -38, 28, -23, 38, 44 | -21, 14, -37, 31, 45 | 0, 21, -50, 52, 46 | -53, -71, -27, 33, 47 | -37, -1, -19, 25, 48 | -19, -5, -28, 22, 49 | 6, 65, -44, 74, 50 | -33, -48, -33, 9, 51 | -40, 57, -14, 58, 52 | -17, 4, -45, 32, 53 | -31, 38, -33, 36, 54 | -23, 28, -40, 39, 55 | -43, 29, -12, 46, 56 | -34, 13, -23, 28, 57 | -16, 15, -27, 34, 58 | -14, -82, -15, 43, 59 | -31, 25, -32, 29, 60 | -21, 5, -5, 38, 61 | -47, -63, -51, 33, 62 | -46, 12, 3, 47, 63 | -28, -17, -29, 11, 64 | -10, 14, -40, 38}; 65 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/hexc_10_32_table.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin 2 | File: hexc_10_32_table.c 3 | Codebook for high-band excitation in SB-CELP mode (4000 bps) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | - Neither the name of the Xiph.org Foundation nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | const signed char hexc_10_32_table[320] = { 34 | -3, -2, -1, 0, -4, 5, 35, -40, -9, 13, 35 | -44, 5, -27, -1, -7, 6, -11, 7, -8, 7, 36 | 19, -14, 15, -4, 9, -10, 10, -8, 10, -9, 37 | -1, 1, 0, 0, 2, 5, -18, 22, -53, 50, 38 | 1, -23, 50, -36, 15, 3, -13, 14, -10, 6, 39 | 1, 5, -3, 4, -2, 5, -32, 25, 5, -2, 40 | -1, -4, 1, 11, -29, 26, -6, -15, 30, -18, 41 | 0, 15, -17, 40, -41, 3, 9, -2, -2, 3, 42 | -3, -1, -5, 2, 21, -6, -16, -21, 23, 2, 43 | 60, 15, 16, -16, -9, 14, 9, -1, 7, -9, 44 | 0, 1, 1, 0, -1, -6, 17, -28, 54, -45, 45 | -1, 1, -1, -6, -6, 2, 11, 26, -29, -2, 46 | 46, -21, 34, 12, -23, 32, -23, 16, -10, 3, 47 | 66, 19, -20, 24, 7, 11, -3, 0, -3, -1, 48 | -50, -46, 2, -18, -3, 4, -1, -2, 3, -3, 49 | -19, 41, -36, 9, 11, -24, 21, -16, 9, -3, 50 | -25, -3, 10, 18, -9, -2, -5, -1, -5, 6, 51 | -4, -3, 2, -26, 21, -19, 35, -15, 7, -13, 52 | 17, -19, 39, -43, 48, -31, 16, -9, 7, -2, 53 | -5, 3, -4, 9, -19, 27, -55, 63, -35, 10, 54 | 26, -44, -2, 9, 4, 1, -6, 8, -9, 5, 55 | -8, -1, -3, -16, 45, -42, 5, 15, -16, 10, 56 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57 | -16, 24, -55, 47, -38, 27, -19, 7, -3, 1, 58 | 16, 27, 20, -19, 18, 5, -7, 1, -5, 2, 59 | -6, 8, -22, 0, -3, -3, 8, -1, 7, -8, 60 | 1, -3, 5, 0, 17, -48, 58, -52, 29, -7, 61 | -2, 3, -10, 6, -26, 58, -31, 1, -6, 3, 62 | 93, -29, 39, 3, 17, 5, 6, -1, -1, -1, 63 | 27, 13, 10, 19, -7, -34, 12, 10, -4, 9, 64 | -76, 9, 8, -28, -2, -11, 2, -1, 3, 1, 65 | -83, 38, -39, 4, -16, -6, -2, -5, 5, -2, 66 | }; 67 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/kiss_fft.h: -------------------------------------------------------------------------------- 1 | #ifndef KISS_FFT_H 2 | #define KISS_FFT_H 3 | 4 | #include 5 | #include 6 | #include "arch.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* 13 | ATTENTION! 14 | If you would like a : 15 | -- a utility that will handle the caching of fft objects 16 | -- real-only (no imaginary time component ) FFT 17 | -- a multi-dimensional FFT 18 | -- a command-line utility to perform ffts 19 | -- a command-line utility to perform fast-convolution filtering 20 | 21 | Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c 22 | in the tools/ directory. 23 | */ 24 | 25 | #ifdef USE_SIMD 26 | # include 27 | # define kiss_fft_scalar __m128 28 | #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) 29 | #else 30 | #define KISS_FFT_MALLOC speex_alloc 31 | #endif 32 | 33 | 34 | #ifdef FIXED_POINT 35 | #include "arch.h" 36 | # define kiss_fft_scalar spx_int16_t 37 | #else 38 | # ifndef kiss_fft_scalar 39 | /* default is float */ 40 | # define kiss_fft_scalar float 41 | # endif 42 | #endif 43 | 44 | typedef struct { 45 | kiss_fft_scalar r; 46 | kiss_fft_scalar i; 47 | }kiss_fft_cpx; 48 | 49 | typedef struct kiss_fft_state* kiss_fft_cfg; 50 | 51 | /* 52 | * kiss_fft_alloc 53 | * 54 | * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. 55 | * 56 | * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); 57 | * 58 | * The return value from fft_alloc is a cfg buffer used internally 59 | * by the fft routine or NULL. 60 | * 61 | * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. 62 | * The returned value should be free()d when done to avoid memory leaks. 63 | * 64 | * The state can be placed in a user supplied buffer 'mem': 65 | * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, 66 | * then the function places the cfg in mem and the size used in *lenmem 67 | * and returns mem. 68 | * 69 | * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), 70 | * then the function returns NULL and places the minimum cfg 71 | * buffer size in *lenmem. 72 | * */ 73 | 74 | kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 75 | 76 | /* 77 | * kiss_fft(cfg,in_out_buf) 78 | * 79 | * Perform an FFT on a complex input buffer. 80 | * for a forward FFT, 81 | * fin should be f[0] , f[1] , ... ,f[nfft-1] 82 | * fout will be F[0] , F[1] , ... ,F[nfft-1] 83 | * Note that each element is complex and can be accessed like 84 | f[k].r and f[k].i 85 | * */ 86 | void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); 87 | 88 | /* 89 | A more generic version of the above function. It reads its input from every Nth sample. 90 | * */ 91 | void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); 92 | 93 | /* If kiss_fft_alloc allocated a buffer, it is one contiguous 94 | buffer and can be simply free()d when no longer needed*/ 95 | #define kiss_fft_free speex_free 96 | 97 | /* 98 | Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 99 | your compiler output to call this before you exit. 100 | */ 101 | void kiss_fft_cleanup(void); 102 | 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/kiss_fftr.h: -------------------------------------------------------------------------------- 1 | #ifndef KISS_FTR_H 2 | #define KISS_FTR_H 3 | 4 | #include "kiss_fft.h" 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | /* 11 | 12 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq. 13 | 14 | 15 | 16 | */ 17 | 18 | typedef struct kiss_fftr_state *kiss_fftr_cfg; 19 | 20 | 21 | kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem); 22 | /* 23 | nfft must be even 24 | 25 | If you don't care to allocate space, use mem = lenmem = NULL 26 | */ 27 | 28 | 29 | void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); 30 | /* 31 | input timedata has nfft scalar points 32 | output freqdata has nfft/2+1 complex points 33 | */ 34 | 35 | void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata); 36 | 37 | void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); 38 | 39 | void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata, kiss_fft_scalar *timedata); 40 | 41 | /* 42 | input freqdata has nfft/2+1 complex points 43 | output timedata has nfft scalar points 44 | */ 45 | 46 | #define kiss_fftr_free speex_free 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif 52 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/lpc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file lpc.h 4 | @brief Functions for LPC (Linear Prediction Coefficients) analysis 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef LPC_H 36 | #define LPC_H 37 | 38 | #include "arch.h" 39 | 40 | void _spx_autocorr( 41 | const spx_word16_t * x, /* in: [0...n-1] samples x */ 42 | spx_word16_t *ac, /* out: [0...lag-1] ac values */ 43 | int lag, int n); 44 | 45 | spx_word32_t /* returns minimum mean square error */ 46 | _spx_lpc( 47 | spx_coef_t * lpc, /* [0...p-1] LPC coefficients */ 48 | const spx_word16_t * ac, /* in: [0...p] autocorrelation values */ 49 | int p 50 | ); 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/lsp.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | Original Copyright 3 | FILE........: AK2LSPD.H 4 | TYPE........: Turbo C header file 5 | COMPANY.....: Voicetronix 6 | AUTHOR......: James Whitehall 7 | DATE CREATED: 21/11/95 8 | 9 | Modified by Jean-Marc Valin 10 | 11 | This file contains functions for converting Linear Prediction 12 | Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the 13 | LSP coefficients are not in radians format but in the x domain of the 14 | unit circle. 15 | 16 | \*---------------------------------------------------------------------------*/ 17 | /** 18 | @file lsp.h 19 | @brief Line Spectral Pair (LSP) functions. 20 | */ 21 | /* Speex License: 22 | 23 | Redistribution and use in source and binary forms, with or without 24 | modification, are permitted provided that the following conditions 25 | are met: 26 | 27 | - Redistributions of source code must retain the above copyright 28 | notice, this list of conditions and the following disclaimer. 29 | 30 | - Redistributions in binary form must reproduce the above copyright 31 | notice, this list of conditions and the following disclaimer in the 32 | documentation and/or other materials provided with the distribution. 33 | 34 | - Neither the name of the Xiph.org Foundation nor the names of its 35 | contributors may be used to endorse or promote products derived from 36 | this software without specific prior written permission. 37 | 38 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 39 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 40 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 41 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 42 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 43 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 44 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 45 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 46 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 47 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 48 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 | */ 50 | 51 | #ifndef __AK2LSPD__ 52 | #define __AK2LSPD__ 53 | 54 | #include "arch.h" 55 | 56 | int lpc_to_lsp (spx_coef_t *a, int lpcrdr, spx_lsp_t *freq, int nb, spx_word16_t delta, char *stack); 57 | void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack); 58 | 59 | /*Added by JMV*/ 60 | void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin); 61 | 62 | void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes); 63 | 64 | #endif /* __AK2LSPD__ */ 65 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/lsp_bfin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 David Rowe */ 2 | /** 3 | @file lsp_bfin.h 4 | @author David Rowe 5 | @brief LSP routines optimised for the Blackfin 6 | */ 7 | /* 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in the 17 | documentation and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the Xiph.org Foundation nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #define OVERRIDE_CHEB_POLY_EVA 37 | #ifdef OVERRIDE_CHEB_POLY_EVA 38 | static inline spx_word32_t cheb_poly_eva( 39 | spx_word16_t *coef, /* P or Q coefs in Q13 format */ 40 | spx_word16_t x, /* cos of freq (-1.0 to 1.0) in Q14 format */ 41 | int m, /* LPC order/2 */ 42 | char *stack 43 | ) 44 | { 45 | spx_word32_t sum; 46 | 47 | __asm__ __volatile__ 48 | ( 49 | "P0 = %2;\n\t" /* P0: coef[m], coef[m-1],..., coef[0] */ 50 | "R4 = 8192;\n\t" /* R4: rounding constant */ 51 | "R2 = %1;\n\t" /* R2: x */ 52 | 53 | "R5 = -16383;\n\t" 54 | "R2 = MAX(R2,R5);\n\t" 55 | "R5 = 16383;\n\t" 56 | "R2 = MIN(R2,R5);\n\t" 57 | 58 | "R3 = W[P0--] (X);\n\t" /* R3: sum */ 59 | "R5 = W[P0--] (X);\n\t" 60 | "R5 = R5.L * R2.L (IS);\n\t" 61 | "R5 = R5 + R4;\n\t" 62 | "R5 >>>= 14;\n\t" 63 | "R3 = R3 + R5;\n\t" 64 | 65 | "R0 = R2;\n\t" /* R0: b0 */ 66 | "R1 = 16384;\n\t" /* R1: b1 */ 67 | "LOOP cpe%= LC0 = %3;\n\t" 68 | "LOOP_BEGIN cpe%=;\n\t" 69 | "P1 = R0;\n\t" 70 | "R0 = R2.L * R0.L (IS) || R5 = W[P0--] (X);\n\t" 71 | "R0 >>>= 13;\n\t" 72 | "R0 = R0 - R1;\n\t" 73 | "R1 = P1;\n\t" 74 | "R5 = R5.L * R0.L (IS);\n\t" 75 | "R5 = R5 + R4;\n\t" 76 | "R5 >>>= 14;\n\t" 77 | "R3 = R3 + R5;\n\t" 78 | "LOOP_END cpe%=;\n\t" 79 | "%0 = R3;\n\t" 80 | : "=&d" (sum) 81 | : "a" (x), "a" (&coef[m]), "a" (m-1) 82 | : "R0", "R1", "R3", "R2", "R4", "R5", "P0", "P1" 83 | ); 84 | return sum; 85 | } 86 | #endif 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/ltp_sse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file ltp_sse.h 4 | @brief Long-Term Prediction functions (SSE version) 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #include 36 | 37 | #define OVERRIDE_INNER_PROD 38 | float inner_prod(const float *a, const float *b, int len) 39 | { 40 | int i; 41 | float ret; 42 | __m128 sum = _mm_setzero_ps(); 43 | for (i=0;i<(len>>2);i+=2) 44 | { 45 | sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+0), _mm_loadu_ps(b+0))); 46 | sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+4), _mm_loadu_ps(b+4))); 47 | a += 8; 48 | b += 8; 49 | } 50 | sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum)); 51 | sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55)); 52 | _mm_store_ss(&ret, sum); 53 | return ret; 54 | } 55 | 56 | #define OVERRIDE_PITCH_XCORR 57 | void pitch_xcorr(const float *_x, const float *_y, float *corr, int len, int nb_pitch, char *stack) 58 | { 59 | int i, offset; 60 | VARDECL(__m128 *x); 61 | VARDECL(__m128 *y); 62 | int N, L; 63 | N = len>>2; 64 | L = nb_pitch>>2; 65 | ALLOC(x, N, __m128); 66 | ALLOC(y, N+L, __m128); 67 | for (i=0;i>2)-1), "0" (src), "1" (dest) 51 | : "R0", "I0", "L0", "memory" 52 | ); 53 | return dest; 54 | } 55 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/quant_lsp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file quant_lsp.h 4 | @brief LSP vector quantization 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef QUANT_LSP_H 36 | #define QUANT_LSP_H 37 | 38 | #include 39 | #include "arch.h" 40 | 41 | #define MAX_LSP_SIZE 20 42 | 43 | #define NB_CDBK_SIZE 64 44 | #define NB_CDBK_SIZE_LOW1 64 45 | #define NB_CDBK_SIZE_LOW2 64 46 | #define NB_CDBK_SIZE_HIGH1 64 47 | #define NB_CDBK_SIZE_HIGH2 64 48 | 49 | /*Narrowband codebooks*/ 50 | extern const signed char cdbk_nb[]; 51 | extern const signed char cdbk_nb_low1[]; 52 | extern const signed char cdbk_nb_low2[]; 53 | extern const signed char cdbk_nb_high1[]; 54 | extern const signed char cdbk_nb_high2[]; 55 | 56 | /* Quantizes narrowband LSPs with 30 bits */ 57 | void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits); 58 | 59 | /* Decodes quantized narrowband LSPs */ 60 | void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits); 61 | 62 | /* Quantizes low bit-rate narrowband LSPs with 18 bits */ 63 | void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits); 64 | 65 | /* Decodes quantized low bit-rate narrowband LSPs */ 66 | void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits); 67 | 68 | /* Quantizes high-band LSPs with 12 bits */ 69 | void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits); 70 | 71 | /* Decodes high-band LSPs */ 72 | void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/smallft.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 7 | * * 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * 9 | * by the XIPHOPHORUS Company http://www.xiph.org/ * 10 | * * 11 | ******************************************************************** 12 | 13 | function: fft transform 14 | last mod: $Id: smallft.h,v 1.3 2003/09/16 18:35:45 jm Exp $ 15 | 16 | ********************************************************************/ 17 | /** 18 | @file smallft.h 19 | @brief Discrete Rotational Fourier Transform (DRFT) 20 | */ 21 | 22 | #ifndef _V_SMFT_H_ 23 | #define _V_SMFT_H_ 24 | 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** Discrete Rotational Fourier Transform lookup */ 31 | struct drft_lookup{ 32 | int n; 33 | float *trigcache; 34 | int *splitcache; 35 | }; 36 | 37 | extern void spx_drft_forward(struct drft_lookup *l,float *data); 38 | extern void spx_drft_backward(struct drft_lookup *l,float *data); 39 | extern void spx_drft_init(struct drft_lookup *l,int n); 40 | extern void spx_drft_clear(struct drft_lookup *l); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/stack_alloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file stack_alloc.h 4 | @brief Temporary memory allocation on stack 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef STACK_ALLOC_H 36 | #define STACK_ALLOC_H 37 | 38 | #ifdef USE_ALLOCA 39 | # ifdef WIN32 40 | # include 41 | # else 42 | # ifdef HAVE_ALLOCA_H 43 | # include 44 | # else 45 | # include 46 | # endif 47 | # endif 48 | #endif 49 | 50 | /** 51 | * @def ALIGN(stack, size) 52 | * 53 | * Aligns the stack to a 'size' boundary 54 | * 55 | * @param stack Stack 56 | * @param size New size boundary 57 | */ 58 | 59 | /** 60 | * @def PUSH(stack, size, type) 61 | * 62 | * Allocates 'size' elements of type 'type' on the stack 63 | * 64 | * @param stack Stack 65 | * @param size Number of elements 66 | * @param type Type of element 67 | */ 68 | 69 | /** 70 | * @def VARDECL(var) 71 | * 72 | * Declare variable on stack 73 | * 74 | * @param var Variable to declare 75 | */ 76 | 77 | /** 78 | * @def ALLOC(var, size, type) 79 | * 80 | * Allocate 'size' elements of 'type' on stack 81 | * 82 | * @param var Name of variable to allocate 83 | * @param size Number of elements 84 | * @param type Type of element 85 | */ 86 | 87 | #ifdef ENABLE_VALGRIND 88 | 89 | #include 90 | 91 | #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) 92 | 93 | #define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type)))) 94 | 95 | #else 96 | 97 | #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) 98 | 99 | #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type)))) 100 | 101 | #endif 102 | 103 | #if defined(VAR_ARRAYS) 104 | #define VARDECL(var) 105 | #define ALLOC(var, size, type) type var[size] 106 | #elif defined(USE_ALLOCA) 107 | #define VARDECL(var) var 108 | #define ALLOC(var, size, type) var = alloca(sizeof(type)*(size)) 109 | #else 110 | #define VARDECL(var) var 111 | #define ALLOC(var, size, type) var = PUSH(stack, size, type) 112 | #endif 113 | 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/testdenoise.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #include 6 | #include 7 | 8 | #define NN 160 9 | 10 | int main() 11 | { 12 | short in[NN]; 13 | int i; 14 | SpeexPreprocessState *st; 15 | int count=0; 16 | float f; 17 | 18 | st = speex_preprocess_state_init(NN, 8000); 19 | i=1; 20 | speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i); 21 | i=0; 22 | speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i); 23 | i=8000; 24 | speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &i); 25 | i=0; 26 | speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i); 27 | f=.0; 28 | speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f); 29 | f=.0; 30 | speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f); 31 | while (1) 32 | { 33 | int vad; 34 | fread(in, sizeof(short), NN, stdin); 35 | if (feof(stdin)) 36 | break; 37 | vad = speex_preprocess_run(st, in); 38 | /*fprintf (stderr, "%d\n", vad);*/ 39 | fwrite(in, sizeof(short), NN, stdout); 40 | count++; 41 | } 42 | speex_preprocess_state_destroy(st); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/testecho.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "speex/speex_echo.h" 11 | #include "speex/speex_preprocess.h" 12 | 13 | 14 | #define NN 128 15 | #define TAIL 1024 16 | 17 | int main(int argc, char **argv) 18 | { 19 | FILE *echo_fd, *ref_fd, *e_fd; 20 | short echo_buf[NN], ref_buf[NN], e_buf[NN]; 21 | SpeexEchoState *st; 22 | SpeexPreprocessState *den; 23 | int sampleRate = 8000; 24 | 25 | if (argc != 4) 26 | { 27 | fprintf(stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n"); 28 | exit(1); 29 | } 30 | echo_fd = fopen(argv[2], "rb"); 31 | ref_fd = fopen(argv[1], "rb"); 32 | e_fd = fopen(argv[3], "wb"); 33 | 34 | st = speex_echo_state_init(NN, TAIL); 35 | den = speex_preprocess_state_init(NN, sampleRate); 36 | speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate); 37 | speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st); 38 | 39 | while (!feof(ref_fd) && !feof(echo_fd)) 40 | { 41 | fread(ref_buf, sizeof(short), NN, ref_fd); 42 | fread(echo_buf, sizeof(short), NN, echo_fd); 43 | speex_echo_cancellation(st, ref_buf, echo_buf, e_buf); 44 | speex_preprocess_run(den, e_buf); 45 | fwrite(e_buf, sizeof(short), NN, e_fd); 46 | } 47 | speex_echo_state_destroy(st); 48 | speex_preprocess_state_destroy(den); 49 | fclose(e_fd); 50 | fclose(echo_fd); 51 | fclose(ref_fd); 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/testenc.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #ifdef FIXED_DEBUG 11 | extern long long spx_mips; 12 | #endif 13 | 14 | #define FRAME_SIZE 160 15 | #include 16 | int main(int argc, char **argv) 17 | { 18 | char *inFile, *outFile, *bitsFile; 19 | FILE *fin, *fout, *fbits=NULL; 20 | short in_short[FRAME_SIZE]; 21 | short out_short[FRAME_SIZE]; 22 | int snr_frames = 0; 23 | char cbits[200]; 24 | int nbBits; 25 | int i; 26 | void *st; 27 | void *dec; 28 | SpeexBits bits; 29 | spx_int32_t tmp; 30 | int bitCount=0; 31 | spx_int32_t skip_group_delay; 32 | SpeexCallback callback; 33 | 34 | st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); 35 | dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); 36 | 37 | /* BEGIN: You probably don't need the following in a real application */ 38 | callback.callback_id = SPEEX_INBAND_CHAR; 39 | callback.func = speex_std_char_handler; 40 | callback.data = stderr; 41 | speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); 42 | 43 | callback.callback_id = SPEEX_INBAND_MODE_REQUEST; 44 | callback.func = speex_std_mode_request_handler; 45 | callback.data = st; 46 | speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); 47 | /* END of unnecessary stuff */ 48 | 49 | tmp=1; 50 | speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); 51 | tmp=0; 52 | speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); 53 | tmp=8; 54 | speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); 55 | tmp=1; 56 | speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); 57 | 58 | /* Turn this off if you want to measure SNR (on by default) */ 59 | tmp=1; 60 | speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp); 61 | speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp); 62 | 63 | speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); 64 | speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); 65 | skip_group_delay += tmp; 66 | 67 | if (argc != 4 && argc != 3) 68 | { 69 | fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); 70 | exit(1); 71 | } 72 | inFile = argv[1]; 73 | fin = fopen(inFile, "rb"); 74 | outFile = argv[2]; 75 | fout = fopen(outFile, "wb+"); 76 | if (argc==4) 77 | { 78 | bitsFile = argv[3]; 79 | fbits = fopen(bitsFile, "wb"); 80 | } 81 | speex_bits_init(&bits); 82 | while (!feof(fin)) 83 | { 84 | fread(in_short, sizeof(short), FRAME_SIZE, fin); 85 | if (feof(fin)) 86 | break; 87 | speex_bits_reset(&bits); 88 | 89 | speex_encode_int(st, in_short, &bits); 90 | nbBits = speex_bits_write(&bits, cbits, 200); 91 | bitCount+=bits.nbBits; 92 | 93 | if (argc==4) 94 | fwrite(cbits, 1, nbBits, fbits); 95 | speex_bits_rewind(&bits); 96 | 97 | speex_decode_int(dec, &bits, out_short); 98 | speex_bits_reset(&bits); 99 | 100 | fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); 101 | skip_group_delay = 0; 102 | } 103 | fprintf (stderr, "Total encoded size: %d bits\n", bitCount); 104 | speex_encoder_destroy(st); 105 | speex_decoder_destroy(dec); 106 | speex_bits_destroy(&bits); 107 | 108 | #ifndef DISABLE_FLOAT_API 109 | { 110 | float sigpow,errpow,snr, seg_snr=0; 111 | sigpow = 0; 112 | errpow = 0; 113 | 114 | /* This code just computes SNR, so you don't need it either */ 115 | rewind(fin); 116 | rewind(fout); 117 | 118 | while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) 119 | && 120 | FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) 121 | { 122 | float s=0, e=0; 123 | for (i=0;i 6 | #include 7 | #include 8 | #include 9 | 10 | #ifdef FIXED_DEBUG 11 | extern long long spx_mips; 12 | #endif 13 | 14 | #define FRAME_SIZE 640 15 | #include 16 | int main(int argc, char **argv) 17 | { 18 | char *inFile, *outFile, *bitsFile; 19 | FILE *fin, *fout, *fbits=NULL; 20 | short in_short[FRAME_SIZE]; 21 | short out_short[FRAME_SIZE]; 22 | float in_float[FRAME_SIZE]; 23 | float sigpow,errpow,snr, seg_snr=0; 24 | int snr_frames = 0; 25 | char cbits[200]; 26 | int nbBits; 27 | int i; 28 | void *st; 29 | void *dec; 30 | SpeexBits bits; 31 | spx_int32_t tmp; 32 | int bitCount=0; 33 | spx_int32_t skip_group_delay; 34 | SpeexCallback callback; 35 | 36 | sigpow = 0; 37 | errpow = 0; 38 | 39 | st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB)); 40 | dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB)); 41 | 42 | callback.callback_id = SPEEX_INBAND_CHAR; 43 | callback.func = speex_std_char_handler; 44 | callback.data = stderr; 45 | speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); 46 | 47 | callback.callback_id = SPEEX_INBAND_MODE_REQUEST; 48 | callback.func = speex_std_mode_request_handler; 49 | callback.data = st; 50 | speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); 51 | 52 | tmp=0; 53 | speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); 54 | tmp=0; 55 | speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); 56 | tmp=7; 57 | speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); 58 | tmp=1; 59 | speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); 60 | 61 | speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); 62 | speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); 63 | skip_group_delay += tmp; 64 | 65 | 66 | if (argc != 4 && argc != 3) 67 | { 68 | fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); 69 | exit(1); 70 | } 71 | inFile = argv[1]; 72 | fin = fopen(inFile, "rb"); 73 | outFile = argv[2]; 74 | fout = fopen(outFile, "wb+"); 75 | if (argc==4) 76 | { 77 | bitsFile = argv[3]; 78 | fbits = fopen(bitsFile, "wb"); 79 | } 80 | speex_bits_init(&bits); 81 | while (!feof(fin)) 82 | { 83 | fread(in_short, sizeof(short), FRAME_SIZE, fin); 84 | if (feof(fin)) 85 | break; 86 | for (i=0;i 6 | #include 7 | #include 8 | #include 9 | 10 | #ifdef FIXED_DEBUG 11 | extern long long spx_mips; 12 | #endif 13 | 14 | #define FRAME_SIZE 320 15 | #include 16 | int main(int argc, char **argv) 17 | { 18 | char *inFile, *outFile, *bitsFile; 19 | FILE *fin, *fout, *fbits=NULL; 20 | short in_short[FRAME_SIZE]; 21 | short out_short[FRAME_SIZE]; 22 | float sigpow,errpow,snr, seg_snr=0; 23 | int snr_frames = 0; 24 | char cbits[200]; 25 | int nbBits; 26 | int i; 27 | void *st; 28 | void *dec; 29 | SpeexBits bits; 30 | spx_int32_t tmp; 31 | int bitCount=0; 32 | spx_int32_t skip_group_delay; 33 | SpeexCallback callback; 34 | 35 | sigpow = 0; 36 | errpow = 0; 37 | 38 | st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); 39 | dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); 40 | 41 | callback.callback_id = SPEEX_INBAND_CHAR; 42 | callback.func = speex_std_char_handler; 43 | callback.data = stderr; 44 | speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); 45 | 46 | callback.callback_id = SPEEX_INBAND_MODE_REQUEST; 47 | callback.func = speex_std_mode_request_handler; 48 | callback.data = st; 49 | speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); 50 | 51 | tmp=1; 52 | speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); 53 | tmp=0; 54 | speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); 55 | tmp=8; 56 | speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); 57 | tmp=3; 58 | speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); 59 | /*tmp=3; 60 | speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp); 61 | tmp=6; 62 | speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp); 63 | */ 64 | 65 | speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); 66 | speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); 67 | skip_group_delay += tmp; 68 | 69 | 70 | if (argc != 4 && argc != 3) 71 | { 72 | fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); 73 | exit(1); 74 | } 75 | inFile = argv[1]; 76 | fin = fopen(inFile, "rb"); 77 | outFile = argv[2]; 78 | fout = fopen(outFile, "wb+"); 79 | if (argc==4) 80 | { 81 | bitsFile = argv[3]; 82 | fbits = fopen(bitsFile, "wb"); 83 | } 84 | speex_bits_init(&bits); 85 | while (!feof(fin)) 86 | { 87 | fread(in_short, sizeof(short), FRAME_SIZE, fin); 88 | if (feof(fin)) 89 | break; 90 | speex_bits_reset(&bits); 91 | 92 | speex_encode_int(st, in_short, &bits); 93 | nbBits = speex_bits_write(&bits, cbits, 200); 94 | bitCount+=bits.nbBits; 95 | 96 | if (argc==4) 97 | fwrite(cbits, 1, nbBits, fbits); 98 | speex_bits_rewind(&bits); 99 | 100 | speex_decode_int(dec, &bits, out_short); 101 | speex_bits_reset(&bits); 102 | 103 | fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); 104 | skip_group_delay = 0; 105 | } 106 | fprintf (stderr, "Total encoded size: %d bits\n", bitCount); 107 | speex_encoder_destroy(st); 108 | speex_decoder_destroy(dec); 109 | speex_bits_destroy(&bits); 110 | 111 | rewind(fin); 112 | rewind(fout); 113 | 114 | while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) 115 | && 116 | FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) 117 | { 118 | float s=0, e=0; 119 | for (i=0;i 6 | #include 7 | 8 | union jbpdata { 9 | unsigned int idx; 10 | unsigned char data[4]; 11 | }; 12 | 13 | void synthIn(JitterBufferPacket *in, int idx, int span) { 14 | union jbpdata d; 15 | d.idx = idx; 16 | 17 | in->data = d.data; 18 | in->len = sizeof(d); 19 | in->timestamp = idx * 10; 20 | in->span = span * 10; 21 | in->sequence = idx; 22 | in->user_data = 0; 23 | } 24 | 25 | void jitterFill(JitterBuffer *jb) { 26 | char buffer[65536]; 27 | JitterBufferPacket in, out; 28 | int i; 29 | 30 | out.data = buffer; 31 | 32 | jitter_buffer_reset(jb); 33 | 34 | for(i=0;i<100;++i) { 35 | synthIn(&in, i, 1); 36 | jitter_buffer_put(jb, &in); 37 | 38 | out.len = 65536; 39 | if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) { 40 | printf("Fill test failed iteration %d\n", i); 41 | } 42 | if (out.timestamp != i * 10) { 43 | printf("Fill test expected %d got %d\n", i*10, out.timestamp); 44 | } 45 | jitter_buffer_tick(jb); 46 | } 47 | } 48 | 49 | int main() 50 | { 51 | char buffer[65536]; 52 | JitterBufferPacket in, out; 53 | int i; 54 | 55 | JitterBuffer *jb = jitter_buffer_init(10); 56 | 57 | out.data = buffer; 58 | 59 | /* Frozen sender case */ 60 | jitterFill(jb); 61 | for(i=0;i<100;++i) { 62 | out.len = 65536; 63 | jitter_buffer_get(jb, &out, 10, NULL); 64 | jitter_buffer_tick(jb); 65 | } 66 | synthIn(&in, 100, 1); 67 | jitter_buffer_put(jb, &in); 68 | out.len = 65536; 69 | if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) { 70 | printf("Failed frozen sender resynchronize\n"); 71 | } else { 72 | printf("Frozen sender: Jitter %d\n", out.timestamp - 100*10); 73 | } 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/vbr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file vbr.h 4 | @brief Variable Bit-Rate (VBR) related routines 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | 37 | #ifndef VBR_H 38 | #define VBR_H 39 | 40 | #include "arch.h" 41 | 42 | #define VBR_MEMORY_SIZE 5 43 | 44 | extern const float vbr_nb_thresh[9][11]; 45 | extern const float vbr_hb_thresh[5][11]; 46 | extern const float vbr_uhb_thresh[2][11]; 47 | 48 | /** VBR state. */ 49 | typedef struct VBRState { 50 | float energy_alpha; 51 | float average_energy; 52 | float last_energy; 53 | float last_log_energy[VBR_MEMORY_SIZE]; 54 | float accum_sum; 55 | float last_pitch_coef; 56 | float soft_pitch; 57 | float last_quality; 58 | float noise_level; 59 | float noise_accum; 60 | float noise_accum_count; 61 | int consec_noise; 62 | } VBRState; 63 | 64 | void vbr_init(VBRState *vbr); 65 | 66 | float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef); 67 | 68 | void vbr_destroy(VBRState *vbr); 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/vorbis_psy.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2005 Jean-Marc Valin, CSIRO, Christopher Montgomery 2 | File: vorbis_psy.h 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | - Neither the name of the Xiph.org Foundation nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef VORBIS_PSY_H 33 | #define VORBIS_PSY_H 34 | 35 | #ifdef VORBIS_PSYCHO 36 | 37 | #include "smallft.h" 38 | #define P_BANDS 17 /* 62Hz to 16kHz */ 39 | #define NOISE_COMPAND_LEVELS 40 40 | 41 | 42 | #define todB(x) ((x)>1e-13?log((x)*(x))*4.34294480f:-30) 43 | #define fromdB(x) (exp((x)*.11512925f)) 44 | 45 | /* The bark scale equations are approximations, since the original 46 | table was somewhat hand rolled. The below are chosen to have the 47 | best possible fit to the rolled tables, thus their somewhat odd 48 | appearance (these are more accurate and over a longer range than 49 | the oft-quoted bark equations found in the texts I have). The 50 | approximations are valid from 0 - 30kHz (nyquist) or so. 51 | 52 | all f in Hz, z in Bark */ 53 | 54 | #define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n)) 55 | #define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f) 56 | 57 | /* Frequency to octave. We arbitrarily declare 63.5 Hz to be octave 58 | 0.0 */ 59 | 60 | #define toOC(n) (log(n)*1.442695f-5.965784f) 61 | #define fromOC(o) (exp(((o)+5.965784f)*.693147f)) 62 | 63 | 64 | typedef struct { 65 | 66 | float noisewindowlo; 67 | float noisewindowhi; 68 | int noisewindowlomin; 69 | int noisewindowhimin; 70 | int noisewindowfixed; 71 | float noiseoff[P_BANDS]; 72 | float noisecompand[NOISE_COMPAND_LEVELS]; 73 | 74 | } VorbisPsyInfo; 75 | 76 | 77 | 78 | typedef struct { 79 | int n; 80 | int rate; 81 | struct drft_lookup lookup; 82 | VorbisPsyInfo *vi; 83 | 84 | float *window; 85 | float *noiseoffset; 86 | long *bark; 87 | 88 | } VorbisPsy; 89 | 90 | 91 | VorbisPsy *vorbis_psy_init(int rate, int size); 92 | void vorbis_psy_destroy(VorbisPsy *psy); 93 | void compute_curve(VorbisPsy *psy, float *audio, float *curve); 94 | void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int ord); 95 | 96 | #endif 97 | #endif 98 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/vq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file vq.h 4 | @brief Vector quantization 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef VQ_H 36 | #define VQ_H 37 | 38 | #include "arch.h" 39 | 40 | int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries); 41 | int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries); 42 | 43 | #ifdef _USE_SSE 44 | #include 45 | void vq_nbest(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); 46 | 47 | void vq_nbest_sign(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); 48 | #else 49 | void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); 50 | 51 | void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/vq_arm4.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Jean-Marc Valin */ 2 | /** 3 | @file vq_arm4.h 4 | @brief ARM4-optimized vq routine 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #define OVERRIDE_VQ_NBEST 36 | void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) 37 | { 38 | int i,j; 39 | for (i=0;i>= 1;\n\t" 55 | "A0 = %0;\n\t" 56 | "R0.L = W[%1++%7] || R1.L = W[I0++];\n\t" 57 | "LOOP vq_loop%= LC1 = %5;\n\t" 58 | "LOOP_BEGIN vq_loop%=;\n\t" 59 | "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%7] || R1.L = W[I0++];\n\t" 60 | "LOOP_END vq_loop%=;\n\t" 61 | "%0 = (A0 -= R0.L*R1.L) (IS);\n\t" 62 | "cc = %0 < %2;\n\t" 63 | "if cc %2 = %0;\n\t" 64 | "if cc %3 = R2;\n\t" 65 | "R2 += 1;\n\t" 66 | "LOOP_END entries_loop%=;\n\t" 67 | : "=&D" (dist), "=&a" (codebook), "=&d" (best_dist[0]), "=&d" (nbest[0]), "=&a" (E) 68 | : "a" (len-1), "a" (in), "a" (2), "d" (entries), "d" (len<<1), "1" (codebook), "4" (E), "2" (best_dist[0]), "3" (nbest[0]) 69 | : "R0", "R1", "R2", "I0", "L0", "B0", "A0", "cc", "memory" 70 | ); 71 | } 72 | } else { 73 | int i,k,used; 74 | used = 0; 75 | for (i=0;i>= 1;\n\t" 81 | "A0 = %0;\n\t" 82 | "I0 = %3;\n\t" 83 | "L0 = 0;\n\t" 84 | "R0.L = W[%1++%4] || R1.L = W[I0++];\n\t" 85 | "LOOP vq_loop%= LC0 = %2;\n\t" 86 | "LOOP_BEGIN vq_loop%=;\n\t" 87 | "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%4] || R1.L = W[I0++];\n\t" 88 | "LOOP_END vq_loop%=;\n\t" 89 | "%0 = (A0 -= R0.L*R1.L) (IS);\n\t" 90 | : "=D" (dist), "=a" (codebook) 91 | : "a" (len-1), "a" (in), "a" (2), "1" (codebook), "0" (E[i]) 92 | : "R0", "R1", "I0", "L0", "A0" 93 | ); 94 | if (i= 1) && (k > used || dist < best_dist[k-1]); k--) 97 | { 98 | best_dist[k]=best_dist[k-1]; 99 | nbest[k] = nbest[k-1]; 100 | } 101 | best_dist[k]=dist; 102 | nbest[k]=i; 103 | used++; 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/libspeex/vq_sse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Jean-Marc Valin */ 2 | /** 3 | @file vq_sse.h 4 | @brief SSE-optimized vq routine 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #define OVERRIDE_VQ_NBEST 36 | void vq_nbest(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) 37 | { 38 | int i,j,k,used; 39 | VARDECL(float *dist); 40 | VARDECL(__m128 *in); 41 | __m128 half; 42 | used = 0; 43 | ALLOC(dist, entries, float); 44 | half = _mm_set_ps1(.5f); 45 | ALLOC(in, len, __m128); 46 | for (i=0;i>2;i++) 49 | { 50 | __m128 d = _mm_mul_ps(E[i], half); 51 | for (j=0;j= 1) && (k > used || dist[i] < best_dist[k-1]); k--) 60 | { 61 | best_dist[k]=best_dist[k-1]; 62 | nbest[k] = nbest[k-1]; 63 | } 64 | best_dist[k]=dist[i]; 65 | nbest[k]=i; 66 | used++; 67 | } 68 | } 69 | } 70 | 71 | 72 | 73 | 74 | #define OVERRIDE_VQ_NBEST_SIGN 75 | void vq_nbest_sign(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) 76 | { 77 | int i,j,k,used; 78 | VARDECL(float *dist); 79 | VARDECL(__m128 *in); 80 | __m128 half; 81 | used = 0; 82 | ALLOC(dist, entries, float); 83 | half = _mm_set_ps1(.5f); 84 | ALLOC(in, len, __m128); 85 | for (i=0;i>2;i++) 88 | { 89 | __m128 d = _mm_setzero_ps(); 90 | for (j=0;j0) 98 | { 99 | sign=0; 100 | dist[i]=-dist[i]; 101 | } else 102 | { 103 | sign=1; 104 | } 105 | dist[i] += .5f*((float*)E)[i]; 106 | if (i= 1) && (k > used || dist[i] < best_dist[k-1]); k--) 109 | { 110 | best_dist[k]=best_dist[k-1]; 111 | nbest[k] = nbest[k-1]; 112 | } 113 | best_dist[k]=dist[i]; 114 | nbest[k]=i; 115 | used++; 116 | if (sign) 117 | nbest[k]+=entries; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /VoiceChanger/jni/speex/speex_jni.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | static int codec_open = 0; 9 | 10 | static int dec_frame_size; 11 | static int enc_frame_size; 12 | 13 | static SpeexBits ebits, dbits; 14 | void *enc_state; 15 | void *dec_state; 16 | 17 | static JavaVM *gJavaVM; 18 | 19 | extern "C" 20 | JNIEXPORT jint JNICALL Java_com_dll_speex_encode_Speex_open 21 | (JNIEnv *env, jobject obj, jint compression) { 22 | int tmp; 23 | 24 | if (codec_open++ != 0) 25 | return (jint)0; 26 | 27 | speex_bits_init(&ebits); 28 | speex_bits_init(&dbits); 29 | 30 | enc_state = speex_encoder_init(&speex_nb_mode); 31 | dec_state = speex_decoder_init(&speex_nb_mode); 32 | tmp = compression; 33 | speex_encoder_ctl(enc_state, SPEEX_SET_QUALITY, &tmp); 34 | speex_encoder_ctl(enc_state, SPEEX_GET_FRAME_SIZE, &enc_frame_size); 35 | speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &dec_frame_size); 36 | 37 | return (jint)0; 38 | } 39 | 40 | extern "C" 41 | JNIEXPORT jint Java_com_dll_speex_encode_Speex_encode 42 | (JNIEnv *env, jobject obj, jshortArray lin, jint offset, jbyteArray encoded, jint size) { 43 | 44 | jshort buffer[enc_frame_size]; 45 | jbyte output_buffer[enc_frame_size]; 46 | int nsamples = (size-1)/enc_frame_size + 1; 47 | int i, tot_bytes = 0; 48 | 49 | if (!codec_open) 50 | return 0; 51 | 52 | speex_bits_reset(&ebits); 53 | 54 | for (i = 0; i < nsamples; i++) { 55 | env->GetShortArrayRegion(lin, offset + i*enc_frame_size, enc_frame_size, buffer); 56 | speex_encode_int(enc_state, buffer, &ebits); 57 | } 58 | //env->GetShortArrayRegion(lin, offset, enc_frame_size, buffer); 59 | //speex_encode_int(enc_state, buffer, &ebits); 60 | 61 | tot_bytes = speex_bits_write(&ebits, (char *)output_buffer, 62 | enc_frame_size); 63 | env->SetByteArrayRegion(encoded, 0, tot_bytes, 64 | output_buffer); 65 | 66 | return (jint)tot_bytes; 67 | } 68 | 69 | extern "C" 70 | JNIEXPORT jint JNICALL Java_com_dll_speex_encode_Speex_decode 71 | (JNIEnv *env, jobject obj, jbyteArray encoded, jshortArray lin, jint size) { 72 | 73 | jbyte buffer[dec_frame_size]; 74 | jshort output_buffer[dec_frame_size]; 75 | jsize encoded_length = size; 76 | 77 | if (!codec_open) 78 | return 0; 79 | 80 | env->GetByteArrayRegion(encoded, 0, encoded_length, buffer); 81 | speex_bits_read_from(&dbits, (char *)buffer, encoded_length); 82 | speex_decode_int(dec_state, &dbits, output_buffer); 83 | env->SetShortArrayRegion(lin, 0, dec_frame_size, 84 | output_buffer); 85 | 86 | return (jint)dec_frame_size; 87 | } 88 | 89 | extern "C" 90 | JNIEXPORT jint JNICALL Java_com_dll_speex_encode_Speex_getFrameSize 91 | (JNIEnv *env, jobject obj) { 92 | 93 | if (!codec_open) 94 | return 0; 95 | return (jint)enc_frame_size; 96 | 97 | } 98 | 99 | extern "C" 100 | JNIEXPORT void JNICALL Java_com_dll_speex_encode_Speex_close 101 | (JNIEnv *env, jobject obj) { 102 | 103 | if (--codec_open != 0) 104 | return; 105 | 106 | speex_bits_destroy(&ebits); 107 | speex_bits_destroy(&dbits); 108 | speex_decoder_destroy(dec_state); 109 | speex_encoder_destroy(enc_state); 110 | } 111 | -------------------------------------------------------------------------------- /VoiceChanger/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/libs/android-support-v4.jar -------------------------------------------------------------------------------- /VoiceChanger/libs/armeabi-v7a/libsoundtouch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/libs/armeabi-v7a/libsoundtouch.so -------------------------------------------------------------------------------- /VoiceChanger/libs/armeabi-v7a/libspeex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/libs/armeabi-v7a/libspeex.so -------------------------------------------------------------------------------- /VoiceChanger/libs/armeabi/libsoundtouch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/libs/armeabi/libsoundtouch.so -------------------------------------------------------------------------------- /VoiceChanger/libs/armeabi/libspeex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/libs/armeabi/libspeex.so -------------------------------------------------------------------------------- /VoiceChanger/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi-v7a/libsoundtouch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/obj/local/armeabi-v7a/libsoundtouch.so -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi-v7a/libspeex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/obj/local/armeabi-v7a/libspeex.so -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi-v7a/libstdc++.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi/libsoundtouch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/obj/local/armeabi/libsoundtouch.so -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi/libspeex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/obj/local/armeabi/libspeex.so -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi/libstdc++.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /VoiceChanger/obj/local/armeabi/objs/soundstretch/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/obj/local/armeabi/objs/soundstretch/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /VoiceChanger/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library=true 16 | android.library.reference.1=../../../AndroidUtils 17 | -------------------------------------------------------------------------------- /VoiceChanger/res/drawable-hdpi/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/res/drawable-hdpi/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/res/drawable-ldpi/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/res/drawable-ldpi/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/res/drawable-mdpi/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/res/drawable-mdpi/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/res/drawable-xhdpi/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/res/drawable-xhdpi/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/res/layout/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChanger/res/layout/.gitignore -------------------------------------------------------------------------------- /VoiceChanger/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /VoiceChanger/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /VoiceChanger/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/SpeexPlayer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.dll.speex; 5 | 6 | import java.io.File; 7 | 8 | import com.dll.speex.encode.SpeexDecoder; 9 | 10 | /** 11 | * @author Gauss 12 | * 13 | */ 14 | public class SpeexPlayer { 15 | private File file = null; 16 | private SpeexDecoder speexdec = null; 17 | private boolean isPlaying; 18 | private SpeexPlayerListener mListener; 19 | 20 | public SpeexPlayer(File file) { 21 | 22 | this.file = file; 23 | try { 24 | speexdec = new SpeexDecoder(this.file); 25 | } catch (Exception e) { 26 | e.printStackTrace(); 27 | } 28 | } 29 | 30 | public void startPlay(int streamMode) { 31 | RecordPlayThread rpt = new RecordPlayThread(streamMode); 32 | 33 | Thread th = new Thread(rpt); 34 | th.start(); 35 | } 36 | 37 | public void stopPlay() { 38 | if (speexdec != null) { 39 | speexdec.stop(); 40 | } 41 | } 42 | 43 | public boolean isPlaying() { 44 | return isPlaying; 45 | } 46 | 47 | public void setPlayerListener(SpeexPlayerListener listener) { 48 | this.mListener = listener; 49 | } 50 | 51 | class RecordPlayThread extends Thread { 52 | private int streamMode; 53 | 54 | public RecordPlayThread(int streamMode) { 55 | this.streamMode = streamMode; 56 | } 57 | 58 | public void run() { 59 | boolean hasException = false; 60 | try { 61 | if (speexdec != null) { 62 | isPlaying = true; 63 | speexdec.decode(streamMode); 64 | } 65 | } catch (Exception t) { 66 | hasException = true; 67 | t.printStackTrace(); 68 | } finally { 69 | isPlaying = false; 70 | if (mListener != null) { 71 | if (hasException) { 72 | mListener.onPlayerFailed(getFileName()); 73 | } else { 74 | mListener.onPlayerFinished(getFileName()); 75 | } 76 | } 77 | } 78 | } 79 | }; 80 | 81 | public String getFileName() { 82 | return file.getAbsolutePath(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/SpeexPlayerListener.java: -------------------------------------------------------------------------------- 1 | package com.dll.speex; 2 | 3 | public interface SpeexPlayerListener { 4 | /** 5 | * 播放完成时回调。 6 | * 7 | * @param fileName 8 | */ 9 | public void onPlayerFinished(String fileName); 10 | 11 | /** 12 | * 播放失败时回调。 13 | * 14 | * @param fileName 15 | */ 16 | public void onPlayerFailed(String fileName); 17 | } 18 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/SpeexRecorderListener.java: -------------------------------------------------------------------------------- 1 | package com.dll.speex; 2 | 3 | /** 4 | * Speex录音回调接口 5 | * 6 | * @author DLL email: xiaobinlzy@163.com 7 | * 8 | */ 9 | public interface SpeexRecorderListener { 10 | 11 | /** 12 | * 录音完成之后的回调方法。 13 | * 14 | * @param filePath 15 | * 声音文件路径 16 | * @param millisecond 17 | * 录音时长 18 | */ 19 | public void onRecordingFinished(String filePath, int millisecond); 20 | 21 | /** 22 | * 录音失败时的回调方法。 23 | * 24 | */ 25 | public void onRecordingFailed(); 26 | 27 | /** 28 | * 初始化完成,录音开始的回调方法。 29 | */ 30 | public void onRecordingStart(String filePath); 31 | 32 | /** 33 | * 录音时间超时回调方法。 34 | * 35 | * @param filePath 36 | * 生成的录音文件 37 | */ 38 | public void onRecordingTimeout(String filePath); 39 | } 40 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/encode/Speex.java: -------------------------------------------------------------------------------- 1 | package com.dll.speex.encode; 2 | 3 | class Speex { 4 | 5 | /* 6 | * quality 1 : 4kbps (very noticeable artifacts, usually intelligible) 2 : 6kbps (very 7 | * noticeable artifacts, good intelligibility) 4 : 8kbps (noticeable artifacts sometimes) 6 : 8 | * 11kpbs (artifacts usually only noticeable with headphones) 8 : 15kbps (artifacts not usually 9 | * noticeable) 10 | */ 11 | private static final int DEFAULT_COMPRESSION = 4; 12 | 13 | // private Logger log = LoggerFactory.getLogger(Speex.class); 14 | 15 | Speex() { 16 | } 17 | 18 | public void init() { 19 | load(); 20 | open(DEFAULT_COMPRESSION); 21 | // log.info("speex opened"); 22 | } 23 | 24 | private void load() { 25 | try { 26 | System.loadLibrary("speex"); 27 | } catch (Throwable e) { 28 | e.printStackTrace(); 29 | } 30 | 31 | } 32 | 33 | public native int open(int compression); 34 | 35 | public native int getFrameSize(); 36 | 37 | public native int decode(byte encoded[], short lin[], int size); 38 | 39 | public native int encode(short lin[], int offset, byte encoded[], int size); 40 | 41 | public native void close(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/encode/SpeexEncoder.java: -------------------------------------------------------------------------------- 1 | package com.dll.speex.encode; 2 | 3 | import java.util.Collections; 4 | import java.util.LinkedList; 5 | import java.util.List; 6 | 7 | import com.dll.speex.SpeexRecorder; 8 | import com.dll.speex.writer.SpeexWriter; 9 | 10 | /** 11 | * ��recorder¼�Ƶ�����������ת�룬������writer��װ 12 | * 13 | * @author Gauss 14 | * 15 | */ 16 | public class SpeexEncoder implements Runnable { 17 | 18 | // private Logger log = LoggerFactory.getLogger(SpeexEncoder.class); 19 | private final Object mutex = new Object(); 20 | private Speex speex = new Speex(); 21 | // private long ts; 22 | public static int encoder_packagesize = 4000; 23 | private byte[] processedData = new byte[encoder_packagesize]; 24 | List list = null; 25 | private volatile boolean isRecording; 26 | private String fileName; 27 | private SpeexRecorder mRecorder; 28 | 29 | public SpeexEncoder(String fileName) { 30 | super(); 31 | speex.init(); 32 | list = Collections.synchronizedList(new LinkedList()); 33 | this.fileName = fileName; 34 | } 35 | 36 | public void setRecorder(SpeexRecorder recorder) { 37 | this.mRecorder = recorder; 38 | } 39 | 40 | public void run() { 41 | 42 | // ����writer�߳�дspeex�ļ��� 43 | SpeexWriter fileWriter = new SpeexWriter(fileName); 44 | fileWriter.setRecorder(mRecorder); 45 | Thread consumerThread = new Thread((Runnable) fileWriter); 46 | fileWriter.setRecording(true); 47 | consumerThread.start(); 48 | 49 | android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); 50 | 51 | int getSize = 0; 52 | while (this.isRecording()) { 53 | if (list.size() == 0) { 54 | // log.debug("no data need to do encode"); 55 | try { 56 | Thread.sleep(20); 57 | } catch (InterruptedException e) { 58 | e.printStackTrace(); 59 | } 60 | continue; 61 | } 62 | if (list.size() > 0) { 63 | synchronized (mutex) { 64 | ReadData rawdata = list.remove(0); 65 | getSize = speex.encode(rawdata.ready, 0, processedData, rawdata.size); 66 | 67 | // log.info("after encode......................before=" + 68 | // rawdata.size + " after=" + processedData.length + 69 | // " getsize=" 70 | // + getSize); 71 | } 72 | if (getSize > 0) { 73 | fileWriter.putData(processedData, getSize); 74 | // log.info("............clear...................."); 75 | processedData = new byte[encoder_packagesize]; 76 | } 77 | } 78 | } 79 | // log.debug("encode thread exit"); 80 | fileWriter.setRecording(false); 81 | } 82 | 83 | /** 84 | * ��Recorder������������� 85 | * 86 | * @param data 87 | * @param size 88 | */ 89 | public void putData(short[] data, int size) { 90 | if (size > 0) { 91 | ReadData rd = new ReadData(); 92 | synchronized (mutex) { 93 | rd.size = size; 94 | System.arraycopy(data, 0, rd.ready, 0, size); 95 | list.add(rd); 96 | } 97 | } 98 | } 99 | 100 | public void setRecording(boolean isRecording) { 101 | synchronized (mutex) { 102 | this.isRecording = isRecording; 103 | } 104 | } 105 | 106 | public boolean isRecording() { 107 | synchronized (mutex) { 108 | return isRecording; 109 | } 110 | } 111 | 112 | class ReadData { 113 | private int size; 114 | private short[] ready = new short[encoder_packagesize]; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/writer/SpeexWriteClient.java: -------------------------------------------------------------------------------- 1 | package com.dll.speex.writer; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * A client write tags to local file. 7 | */ 8 | public class SpeexWriteClient { 9 | // private static Logger log = LoggerFactory.getLogger(SpeexWriteClient.class); 10 | 11 | //private long timeBase = 0; 12 | // private int sampleRate = 0; 13 | 14 | // (0=NB, 1=WB and 2=UWB) 15 | private int mode = 0; 16 | 17 | // 8000; 16000; 32000; 8000; 18 | protected int sampleRate = 8000; 19 | 20 | /** Defines the number of channels of the audio input (1=mono, 2=stereo). */ 21 | protected int channels = 1; 22 | 23 | /** Defines the number of frames per speex packet. */ 24 | protected int nframes = 1; 25 | 26 | /** Defines whether or not to use VBR (Variable Bit Rate). */ 27 | protected boolean vbr = false; 28 | 29 | OggSpeexWriter speexWriter = null;// new OggSpeexWriter(mode, sampleRate, 30 | // channels, nframes, vbr); 31 | 32 | public SpeexWriteClient() { 33 | 34 | } 35 | 36 | public void start(String fileName) { 37 | 38 | init(fileName); 39 | } 40 | 41 | private void init(String fileName) { 42 | // File file = new File(saveAsFileName); 43 | 44 | // xiaomi 45 | // Decoding 8000 Hz audio using narrowband mode 46 | // Bitrate is use: 2150 bps 47 | 48 | mode =0; 49 | sampleRate=8000;//people 50 | //sampleRate=11000;//yong 51 | //sampleRate=13500;//Tom 52 | //sampleRate=5500;//Bee 53 | vbr=true; 54 | 55 | //����OGG��װ 56 | speexWriter = new OggSpeexWriter(mode, sampleRate, channels, nframes, vbr); 57 | 58 | try { 59 | speexWriter.open(fileName); 60 | 61 | speexWriter.writeHeader("Encoded with:test by gauss "); 62 | } catch (IOException e) { 63 | e.printStackTrace(); 64 | } 65 | } 66 | 67 | public void stop() { 68 | if (speexWriter != null) { 69 | try { 70 | speexWriter.close(); 71 | } catch (IOException e) { 72 | e.printStackTrace(); 73 | } 74 | speexWriter = null; 75 | 76 | } 77 | // log.debug("writer closed!"); 78 | } 79 | 80 | public void writeTag(byte[] buf, int size) { 81 | // log.info("here should be:===========================640,actual=" + size); 82 | try { 83 | speexWriter.writePacket(buf, 0, size); 84 | } catch (IOException e) { 85 | e.printStackTrace(); 86 | } 87 | 88 | } 89 | 90 | public void setSampleRate(int sampleRate) { 91 | this.sampleRate = sampleRate; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/speex/writer/SpeexWriter.java: -------------------------------------------------------------------------------- 1 | package com.dll.speex.writer; 2 | 3 | import java.util.Collections; 4 | import java.util.LinkedList; 5 | import java.util.List; 6 | 7 | import com.dll.speex.SpeexRecorder; 8 | import com.dll.speex.SpeexRecorderListener; 9 | 10 | /** 11 | * 12 | * @author Gauss ʹ��OGG��װ��д�ļ� 13 | * 14 | */ 15 | public class SpeexWriter implements Runnable { 16 | 17 | // private Logger log = LoggerFactory.getLogger(SpeexWriter.class); 18 | private final Object mutex = new Object(); 19 | 20 | // д�ļ� 21 | private SpeexWriteClient client = new SpeexWriteClient(); 22 | private volatile boolean isRecording; 23 | private processedData pData; 24 | private List list; 25 | private SpeexRecorder mRecorder; 26 | 27 | public static int write_packageSize = 1024; 28 | 29 | public SpeexWriter(String fileName) { 30 | super(); 31 | list = Collections.synchronizedList(new LinkedList()); 32 | 33 | client.setSampleRate(8000); 34 | 35 | client.start(fileName); 36 | } 37 | 38 | public void setRecorder(SpeexRecorder recorder) { 39 | this.mRecorder = recorder; 40 | } 41 | 42 | public void run() { 43 | // log.debug("write thread runing"); 44 | while (this.isRecording() || list.size() > 0) { 45 | 46 | if (list.size() > 0) { 47 | pData = list.remove(0); 48 | // gauss_packageSize/2 49 | // log.info("pData size=" + pData.size); 50 | 51 | client.writeTag(pData.processed, pData.size); 52 | 53 | // log.debug("list size = {}", list.size()); 54 | } else { 55 | try { 56 | Thread.sleep(20); 57 | } catch (InterruptedException e) { 58 | e.printStackTrace(); 59 | } 60 | } 61 | 62 | } 63 | 64 | // log.debug("write thread exit"); 65 | stop(); 66 | 67 | if (mRecorder != null) { 68 | SpeexRecorderListener listener = mRecorder.getRecorderListener(); 69 | if (listener != null) { 70 | if (mRecorder.hasException()) { 71 | listener.onRecordingFailed(); 72 | } else if (mRecorder.isTimeout()) { 73 | listener.onRecordingTimeout(mRecorder.getFileName()); 74 | } else { 75 | listener.onRecordingFinished(mRecorder.getFileName(), mRecorder.getSpeechTime()); 76 | } 77 | } 78 | } 79 | } 80 | 81 | public void putData(final byte[] buf, int size) { 82 | 83 | // log.debug("after convert. size=====================[640]:" + size); 84 | 85 | processedData data = new processedData(); 86 | // data.ts = ts; 87 | data.size = size; 88 | System.arraycopy(buf, 0, data.processed, 0, size); 89 | list.add(data); 90 | } 91 | 92 | public void stop() { 93 | client.stop(); 94 | } 95 | 96 | public void setRecording(boolean isRecording) { 97 | synchronized (mutex) { 98 | this.isRecording = isRecording; 99 | if (this.isRecording) { 100 | mutex.notify(); 101 | } 102 | } 103 | } 104 | 105 | public boolean isRecording() { 106 | synchronized (mutex) { 107 | return isRecording; 108 | } 109 | } 110 | 111 | class processedData { 112 | // private long ts; 113 | private int size; 114 | private byte[] processed = new byte[write_packageSize]; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/util/FilePathUtil.java: -------------------------------------------------------------------------------- 1 | package com.dll.util; 2 | 3 | import java.io.File; 4 | 5 | import android.content.Context; 6 | 7 | /** 8 | * 文件路径的获取和拼接 9 | * 10 | * @author DLL email: xiaobinlzy@163.com 11 | * 12 | */ 13 | public class FilePathUtil { 14 | 15 | /** 16 | * 生成存储文件的路径,如果有sd卡则获取sd卡路径,否则获取应用缓存区路径。 17 | * 18 | * @param context 19 | * 应用Context 20 | * @param folderPath 21 | * 文件夹路径 22 | * @param fileName 23 | * 文件名 24 | * @return 生成的文件路径 25 | */ 26 | public static String makeFilePath(Context context, String folderPath, String fileName) { 27 | File file = null; 28 | if (android.os.Environment.getExternalStorageState().equals( 29 | android.os.Environment.MEDIA_MOUNTED)) { 30 | file = new File(android.os.Environment.getExternalStorageDirectory(), 31 | folderPath); 32 | } else { 33 | file = context.getApplicationContext().getCacheDir(); 34 | } 35 | if (!file.exists() || !file.isDirectory()) { 36 | file.mkdirs(); 37 | } 38 | StringBuilder absoluteFolderPath = new StringBuilder(file.getAbsolutePath()); 39 | if (!absoluteFolderPath.toString().endsWith("/")) { 40 | absoluteFolderPath.append("/"); 41 | } 42 | if (fileName != null) { 43 | absoluteFolderPath.append(fileName); 44 | } 45 | return absoluteFolderPath.toString(); 46 | } 47 | 48 | /** 49 | * 清空某一路径下的文件 50 | * 51 | * @param context 52 | * @param filePath 53 | */ 54 | public static void clearFilePath(Context context, File filePath) { 55 | if (!filePath.exists()) { 56 | return; 57 | } 58 | if (filePath.isFile()) { 59 | filePath.delete(); 60 | return; 61 | } 62 | if (filePath.isDirectory()) { 63 | File[] folders = filePath.listFiles(); 64 | for (int i = 0; i < folders.length; i++) { 65 | clearFilePath(context, folders[i]); 66 | } 67 | } 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/voicechanger/PlayerListener.java: -------------------------------------------------------------------------------- 1 | package com.dll.voicechanger; 2 | 3 | /** 4 | * 播放事件监听接口 5 | * 6 | * @author DLL email: xiaobinlzy@163.com 7 | * 8 | */ 9 | public interface PlayerListener { 10 | 11 | /** 12 | * 播放完成时回调,总是在主线程中被调用。 13 | * 14 | * @param fileName 15 | */ 16 | public void onPlayerFinished(String fileName); 17 | 18 | /** 19 | * 播放失败时回调,总是在主线程中被调用。 20 | * 21 | * @param fileName 22 | */ 23 | public void onPlayerFailed(String fileName); 24 | 25 | /** 26 | * 播放被人为停止时回调,总是在主线程中被调用。 27 | * 28 | * @param fileName 29 | */ 30 | public void onPlayerStoped(String fileName); 31 | } 32 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/voicechanger/RecorderListener.java: -------------------------------------------------------------------------------- 1 | package com.dll.voicechanger; 2 | 3 | /** 4 | * {@link RecorderManager}的回调接口。 5 | * 6 | * @author DLL email: xiaobinlzy@163.com 7 | * 8 | */ 9 | public interface RecorderListener { 10 | 11 | /** 12 | * 录音完成之后的回调方法,会在主线程中执行。 13 | * 14 | * @param filePath 15 | * 声音文件路径 16 | * @param millisecond 17 | * 录音时长 18 | */ 19 | public void onRecordingFinished(String filePath, int millisecond); 20 | 21 | /** 22 | * 录音失败时的回调方法,会在主线程中执行。 23 | * 24 | */ 25 | public void onRecordingFailed(); 26 | 27 | /** 28 | * 初始化完成,录音开始的回调方法,会在主线程中执行。 29 | */ 30 | public void onRecordingStart(String filePath); 31 | 32 | /** 33 | * 录音时间超时回调方法,会在主线程中执行。 34 | * 35 | * @param filePath 36 | * 生成的录音文件 37 | */ 38 | public void onRecordingTimeout(String filePath); 39 | } 40 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/voicechanger/SoundTouch.java: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Example class that invokes native SoundTouch routines through the JNI 4 | /// interface. 5 | /// 6 | /// Author : Copyright (c) Olli Parviainen 7 | /// Author e-mail : oparviai 'at' iki.fi 8 | /// WWW : http://www.surina.net 9 | /// 10 | //////////////////////////////////////////////////////////////////////////////// 11 | // 12 | // $Id: SoundTouch.java 165 2012-12-28 19:55:23Z oparviai $ 13 | // 14 | //////////////////////////////////////////////////////////////////////////////// 15 | 16 | package com.dll.voicechanger; 17 | 18 | public final class SoundTouch { 19 | // Load the native library upon startup 20 | 21 | private long mObjectPtr; 22 | 23 | static { 24 | System.loadLibrary("soundtouch"); 25 | } 26 | 27 | public static SoundTouch getInstance() { 28 | return new SoundTouch(); 29 | } 30 | 31 | /** 32 | * 记得调用{@link #release()}释放内存 33 | */ 34 | public SoundTouch() { 35 | mObjectPtr = initSoundTouchObject(); 36 | } 37 | 38 | // Native interface function that returns SoundTouch version string. 39 | // This invokes the native c++ routine defined in "soundtouch-jni.cpp". 40 | 41 | private native long initSoundTouchObject(); 42 | 43 | private native void freeSoundTouchObject(long objectPtr); 44 | 45 | private native final String getVersionString(); 46 | 47 | private native void setSampleRate(int sampleRate, long objectPtr); 48 | 49 | private native void setChannels(int channel, long objectPtr); 50 | 51 | private native void setTempo(float newTempo, long objectPtr); 52 | 53 | private native void setPitch(float newPitch, long objectPtr); 54 | 55 | private native void setRate(float newRate, long objectPtr); 56 | 57 | private native void putSamples(short[] samples, int length, long objectPtr); 58 | 59 | private native short[] receiveSamples(long objectPtr); 60 | 61 | public void setSampleRate(int sampleRate) { 62 | setSampleRate(sampleRate, mObjectPtr); 63 | } 64 | 65 | public void setChannels(int channel) { 66 | setChannels(channel, mObjectPtr); 67 | } 68 | 69 | public void setTempo(float newTempo) { 70 | setTempo(newTempo, mObjectPtr); 71 | } 72 | 73 | public void setPitch(float newPitch) { 74 | setPitch(newPitch, mObjectPtr); 75 | } 76 | 77 | public void setRate(float newRate) { 78 | setRate(newRate, mObjectPtr); 79 | } 80 | 81 | public void putSamples(short[] samples, int length) { 82 | putSamples(samples, length, mObjectPtr); 83 | } 84 | 85 | public short[] receiveSamples() { 86 | return receiveSamples(mObjectPtr); 87 | } 88 | 89 | public synchronized void release() { 90 | freeSoundTouchObject(mObjectPtr); 91 | mObjectPtr = 0; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /VoiceChanger/src/com/dll/voicechanger/VoiceChanger.java: -------------------------------------------------------------------------------- 1 | package com.dll.voicechanger; 2 | 3 | /** 4 | * 负责记录改变声音参数的类 5 | * 6 | * @author DLL email: xiaobinlzy@163.com 7 | * 8 | */ 9 | public class VoiceChanger { 10 | 11 | private float mRate = 1; 12 | private float mTempo = 1; 13 | private float mPitch = 0; 14 | 15 | public VoiceChanger() { 16 | } 17 | 18 | /** 19 | * 设置速率,变速变声 20 | * 21 | * @param rate 22 | * 音频变化率,标准值为1 23 | */ 24 | public void setRate(float rate) { 25 | this.mRate = rate; 26 | } 27 | 28 | /** 29 | * 设置语速,变速不变声 30 | * 31 | * @param tempo 32 | * 语速变化率,标准值为1 33 | */ 34 | public void setTempo(float tempo) { 35 | this.mTempo = tempo; 36 | } 37 | 38 | /** 39 | * 设置音高 40 | * 41 | * @param pitch 42 | * 音高变化,从-12到12,标准值为0 43 | */ 44 | public void setPitch(float pitch) { 45 | this.mPitch = pitch; 46 | } 47 | 48 | /** 49 | * 获取音频速率 50 | * 51 | * @return 52 | */ 53 | public float getRate() { 54 | return mRate; 55 | } 56 | 57 | /** 58 | * 获取变调 59 | * 60 | * @return 61 | */ 62 | public float getPitch() { 63 | return mPitch; 64 | } 65 | 66 | /** 67 | * 获取语速 68 | * 69 | * @return 70 | */ 71 | public float getTempo() { 72 | return mTempo; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /VoiceChangerDemo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /VoiceChangerDemo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | VoiceChangerDemo 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /VoiceChangerDemo/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /VoiceChangerDemo/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /VoiceChangerDemo/assets/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChangerDemo/assets/.gitignore -------------------------------------------------------------------------------- /VoiceChangerDemo/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChangerDemo/libs/android-support-v4.jar -------------------------------------------------------------------------------- /VoiceChangerDemo/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /VoiceChangerDemo/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library.reference.1=../VoiceChanger 16 | -------------------------------------------------------------------------------- /VoiceChangerDemo/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChangerDemo/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /VoiceChangerDemo/res/drawable-ldpi/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChangerDemo/res/drawable-ldpi/.gitignore -------------------------------------------------------------------------------- /VoiceChangerDemo/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChangerDemo/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /VoiceChangerDemo/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaobinlzy/VoiceChanger_Android/244b6591d753593cbce04d7e2448db475df4a8b0/VoiceChangerDemo/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /VoiceChangerDemo/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 |