├── soundtouch ├── source │ ├── SoundTouch │ │ ├── .deps │ │ │ ├── AAFilter.Plo │ │ │ ├── BPMDetect.Plo │ │ │ ├── FIRFilter.Plo │ │ │ ├── PeakFinder.Plo │ │ │ ├── TDStretch.Plo │ │ │ ├── mmx_optimized.Plo │ │ │ ├── sse_optimized.Plo │ │ │ ├── cpu_detect_x86_gcc.Plo │ │ │ ├── FIFOSampleBuffer.Plo │ │ │ ├── RateTransposer.Plo │ │ │ └── SoundTouch.Plo │ │ ├── SoundTouch.dsw │ │ ├── SoundTouch.sln │ │ ├── Makefile.am │ │ ├── cpu_detect.h │ │ ├── AAFilter.h │ │ ├── PeakFinder.h │ │ ├── cpu_detect_x86_win.cpp │ │ ├── SoundTouch.dsp │ │ ├── cpu_detect_x86_gcc.cpp │ │ ├── FIRFilter.h │ │ ├── AAFilter.cpp │ │ ├── RateTransposer.h │ │ └── PeakFinder.cpp │ ├── SoundStretch │ │ ├── .deps │ │ │ ├── soundstretch-WavFile.Po │ │ │ ├── soundstretch-main.Po │ │ │ └── soundstretch-RunParameters.Po │ │ ├── soundstretch │ │ ├── soundstretch.dsw │ │ ├── soundstretch.sln │ │ ├── Makefile.am │ │ ├── RunParameters.h │ │ ├── soundstretch.dsp │ │ └── soundstretch.vcproj │ ├── Makefile.am │ └── SoundTouchDLL │ │ ├── SoundTouchDLL.sln │ │ ├── SoundTouchDLL.rc │ │ ├── SoundTouchDLL.vcproj │ │ └── SoundTouchDLL.h ├── include │ ├── stamp-h1 │ ├── Makefile.am │ ├── soundtouch_config.h.in~ │ ├── soundtouch_config.h.in │ ├── soundtouch_config.h │ ├── STTypes.h │ ├── BPMDetect.h │ ├── FIFOSampleBuffer.h │ └── FIFOSamplePipe.h ├── config │ ├── README.TXT │ └── am_include.mk ├── soundtouch.pc.in ├── soundtouch-1.4.pc.in ├── soundtouch-1.4.pc ├── createsrcpack ├── bootstrap ├── make-win.bat ├── soundtouch.m4 ├── Makefile.am ├── autom4te.cache │ └── requests └── configure.ac ├── Setup ├── .gitignore ├── src ├── soundtouchmodule.h ├── soundtouchmodule.c ├── pybpmdetect.h ├── pysoundtouch.h ├── pybpmdetect.cpp └── pysoundtouch.cpp ├── LICENSE ├── setup.py └── README.md /soundtouch/source/SoundTouch/.deps/AAFilter.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/BPMDetect.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/FIRFilter.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/PeakFinder.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/TDStretch.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/mmx_optimized.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/sse_optimized.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/include/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for include/soundtouch_config.h 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/.deps/soundstretch-WavFile.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/.deps/soundstretch-main.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/cpu_detect_x86_gcc.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /Setup: -------------------------------------------------------------------------------- 1 | soundtouch_include_dir = /usr/local/include/soundtouch 2 | soundtouch_libs = SoundTouch 3 | soundtouch_lib_dir = /usr/local/lib 4 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/soundstretch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrising/pysoundtouch/HEAD/soundtouch/source/SoundStretch/soundstretch -------------------------------------------------------------------------------- /soundtouch/config/README.TXT: -------------------------------------------------------------------------------- 1 | Files in this directory are used by GNU autoconf/automake system. 2 | These files aren't used/needed in the Windows environment. 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Compiled Dynamic libraries 8 | *.so 9 | *.dylib 10 | *.dll 11 | 12 | # Compiled Static libraries 13 | *.lai 14 | *.la 15 | *.a 16 | *.lib 17 | 18 | # Executables 19 | *.exe 20 | *.out 21 | *.app 22 | -------------------------------------------------------------------------------- /soundtouch/soundtouch.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: SoundTouch 7 | Description: SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or files 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lSoundTouch 10 | Cflags: -I${includedir}/soundtouch 11 | 12 | -------------------------------------------------------------------------------- /soundtouch/soundtouch-1.4.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: SoundTouch 7 | Description: SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or files 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lSoundTouch 10 | Cflags: -I${includedir}/soundtouch 11 | 12 | -------------------------------------------------------------------------------- /soundtouch/soundtouch-1.4.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: SoundTouch 7 | Description: SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or files 8 | Version: 1.4.0 9 | Libs: -L${libdir} -lSoundTouch 10 | Cflags: -I${includedir}/soundtouch 11 | 12 | -------------------------------------------------------------------------------- /soundtouch/createsrcpack: -------------------------------------------------------------------------------- 1 | # Helper script for building a source code release package 2 | # $Id: createsrcpack 43 2008-12-25 17:54:41Z oparviai $ 3 | 4 | rm -Rf soundtouch 5 | rm soundtouch.zip 6 | mkdir soundtouch 7 | cp -R * soundtouch 8 | cd soundtouch 9 | rm -rf `find . -type d -name .svn` 10 | rm createsrcpack 11 | chmod u+x bootstrap 12 | ./bootstrap 13 | rm -rf autom4te.cache 14 | cd .. 15 | zip -r9 soundtouch.zip soundtouch 16 | -------------------------------------------------------------------------------- /src/soundtouchmodule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * python interface to soundtouch (the open-source audio processing library) 3 | * Expose BMP detection and Shifting to python 4 | */ 5 | 6 | #ifndef __SOUNDTOUCH_MODULE_H__ 7 | #define __SOUNDTOUCH_MODULE_H__ 8 | 9 | #include 10 | 11 | /* module accessible functions */ 12 | extern "C" { 13 | PyObject* py_soundtouch_new(PyObject* self, PyObject* args); 14 | PyObject* py_bpmdetect_new(PyObject* self, PyObject* args); 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/SoundTouch.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | # 4 | # $Id: SoundTouch.dsw 11 2008-02-10 16:26:55Z oparviai $ 5 | 6 | ############################################################################### 7 | 8 | Project: "SoundTouch"=.\SoundTouch.dsp - Package Owner=<4> 9 | 10 | Package=<5> 11 | {{{ 12 | }}} 13 | 14 | Package=<4> 15 | {{{ 16 | }}} 17 | 18 | ############################################################################### 19 | 20 | Global: 21 | 22 | Package=<5> 23 | {{{ 24 | }}} 25 | 26 | Package=<3> 27 | {{{ 28 | }}} 29 | 30 | ############################################################################### 31 | 32 | -------------------------------------------------------------------------------- /src/soundtouchmodule.c: -------------------------------------------------------------------------------- 1 | /* 2 | * python interface to soundtouch (the open-source audio processing library) 3 | * Expose BMP detection and Shifting to python 4 | */ 5 | 6 | #include 7 | #include "soundtouchmodule.h" 8 | 9 | static PyMethodDef soundtouch_methods[] = { 10 | { "SoundTouch", py_soundtouch_new, METH_VARARGS, "" }, 11 | { "BPMDetect", py_bpmdetect_new, METH_VARARGS, "" }, 12 | { NULL, 0, 0, NULL } 13 | }; 14 | 15 | PyMODINIT_FUNC 16 | initsoundtouch(void) { 17 | PyObject *module, *dict; 18 | 19 | module = Py_InitModule("soundtouch", soundtouch_methods); 20 | dict = PyModule_GetDict(module); 21 | 22 | PyDict_SetItemString(dict, "__version__", 23 | PyString_FromString(VERSION)); 24 | 25 | if (PyErr_Occurred()) 26 | PyErr_SetString(PyExc_ImportError, "soundtouch: init failed"); 27 | } 28 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/SoundTouch.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "SoundTouch.vcproj", "{0A626C77-0515-4131-AA80-E0BFFC479FEB}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {0A626C77-0515-4131-AA80-E0BFFC479FEB}.Debug.ActiveCfg = Debug|Win32 13 | {0A626C77-0515-4131-AA80-E0BFFC479FEB}.Debug.Build.0 = Debug|Win32 14 | {0A626C77-0515-4131-AA80-E0BFFC479FEB}.Release.ActiveCfg = Release|Win32 15 | {0A626C77-0515-4131-AA80-E0BFFC479FEB}.Release.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/soundstretch.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "SoundTouch"=..\SoundTouch\SoundTouch.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "soundstretch"=.\soundstretch.dsp - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | Begin Project Dependency 27 | Project_Dep_Name SoundTouch 28 | End Project Dependency 29 | }}} 30 | 31 | ############################################################################### 32 | 33 | Global: 34 | 35 | Package=<5> 36 | {{{ 37 | }}} 38 | 39 | Package=<3> 40 | {{{ 41 | }}} 42 | 43 | ############################################################################### 44 | 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 jrising 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/pybpmdetect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * python interface to soundtouch (the open-source audio processing library) 3 | * BPM Detection 4 | */ 5 | 6 | #ifndef __PY_BMPDETECT_H__ 7 | #define __PY_BMPDETECT_H__ 8 | 9 | #include 10 | #include 11 | 12 | #define BUFFER_SIZE 44100 13 | 14 | // Definition of the bpmdetect object 15 | typedef struct { 16 | PyObject_HEAD 17 | soundtouch::BPMDetect* bpmdetect; 18 | int channels; // 1 or 2 19 | union { 20 | char chars[BUFFER_SIZE]; 21 | short shorts[BUFFER_SIZE/2]; 22 | } buffer; 23 | } py_bpmdetect; /* Soundtouch */ 24 | 25 | #define PY_BPMDETECT(x) ((py_bpmdetect *) x) 26 | 27 | extern PyTypeObject py_bpmdetect_t; 28 | 29 | // Deallocate the BPMDetect object 30 | static void py_bpmdetect_dealloc(PyObject* self, PyObject* args); 31 | 32 | // Read in a number of samples for beat detection 33 | static PyObject* py_bpmdetect_put_samples(PyObject* self, PyObject* args); 34 | 35 | // Perform the beat detection algorithm 36 | static PyObject* py_bpmdetect_get_bpm(PyObject* self, PyObject* args); 37 | 38 | // Extract information from the bpmdetect object 39 | static PyObject* py_bpmdetect_getattr(PyObject* self, char* name); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /soundtouch/source/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to create Makefile.in 2 | ## 3 | ## $Id: Makefile.am 38 2008-12-25 17:00:23Z 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 | include $(top_srcdir)/config/am_include.mk 23 | 24 | SUBDIRS=SoundTouch SoundStretch 25 | 26 | # set to something if you want other stuff to be included in the distribution tarball 27 | #EXTRA_DIST= 28 | 29 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /soundtouch/bootstrap: -------------------------------------------------------------------------------- 1 | # $Id: bootstrap 43 2008-12-25 17:54:41Z oparviai $ 2 | 3 | #!/bin/sh 4 | 5 | if [ "$1" = "--clean" ] 6 | then 7 | if [ -a Makefile ] 8 | then 9 | make maintainer-clean 10 | elif [ -a configure ] 11 | then 12 | configure && $0 --clean 13 | else 14 | bootstrap && configure && $0 --clean 15 | fi 16 | 17 | rm -rf configure libtool aclocal.m4 `find . -name Makefile.in` autom4te*.cache config/config.guess config/config.h.in config/config.sub config/depcomp config/install-sh config/ltmain.sh config/missing config/mkinstalldirs config/stamp-h config/stamp-h.in 18 | 19 | #gettextie files 20 | #rm -f ABOUT-NLS config/config.rpath config/m4/codeset.m4 config/m4/gettext.m4 config/m4/glibc21.m4 config/m4/iconv.m4 config/m4/intdiv0.m4 config/m4/inttypes-pri.m4 config/m4/inttypes.m4 config/m4/inttypes_h.m4 config/m4/isc-posix.m4 config/m4/lcmessage.m4 config/m4/lib-ld.m4 config/m4/lib-link.m4 config/m4/lib-prefix.m4 config/m4/progtest.m4 config/m4/stdint_h.m4 config/m4/uintmax_t.m4 config/m4/ulonglong.m4 po/Makefile.in.in po/Rules-quot po/boldquot.sed po/en@boldquot.header po/en@quot.header po/insert-header.sin po/quot.sed po/remove-potcdate.sin 21 | 22 | else 23 | export AUTOMAKE="automake --add-missing --foreign --copy" 24 | autoreconf -fisv && rm -f `find . -name "*~"` && rm -f ChangeLog 25 | exit $? 26 | fi 27 | -------------------------------------------------------------------------------- /soundtouch/make-win.bat: -------------------------------------------------------------------------------- 1 | @REM 2 | @REM SoundTouch & SoundStretch Build script for Win32 platform 3 | @REM 4 | @REM You'll need Visual C++ 6.0 installed to compile - also execute the 5 | @REM "vcvars32.bat" in VC install directotry before running this one. 6 | @REM 7 | @REM Copyright (c) Olli Parviainen 8 | @REM File Created: 09/Sep/2003 9 | @REM 10 | @REM $Id: make-win.bat 44 2008-12-25 18:12:41Z oparviai $ 11 | 12 | @rem **************************** 13 | @rem try first for VS6.0 support 14 | 15 | @if "%MsDevDir%"=="" goto nomsdevdir 16 | 17 | md bin 18 | md lib 19 | msdev source\SoundTouch\SoundTouch.dsw /MAKE ALL 20 | msdev source\SoundStretch\SoundStretch.dsw /MAKE ALL 21 | 22 | goto end 23 | 24 | :nomsdevdir 25 | 26 | @rem ********************************** 27 | @rem try with devenv for VS2003 support 28 | 29 | @if "%DevEnvDir%"=="" goto nodevdir 30 | 31 | md bin 32 | md lib 33 | devenv source\SoundTouch\SoundTouch.vcproj /build debug 34 | devenv source\SoundTouch\SoundTouch.vcproj /build release 35 | devenv source\SoundStretch\SoundStretch.vcproj /build debug 36 | devenv source\SoundStretch\SoundStretch.vcproj /build release 37 | 38 | @goto end 39 | 40 | 41 | :nodevdir 42 | 43 | @echo off 44 | echo ********************************************************************* 45 | echo ** 46 | echo ** ERROR: Visual Studio path not set. 47 | echo ** 48 | echo ** Run "vcvars32.bat" from Visual Studio installation directory, e.g. 49 | echo ** "\Program Files\Microsoft Visual Studio\VC98\Bin", then try again. 50 | echo ** 51 | echo ********************************************************************* 52 | 53 | :end 54 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/soundstretch.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "soundstretch", "soundstretch.vcproj", "{5AACDFFA-D491-44B8-A332-DA7ACCAAF2AF}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | {68A5DD20-7057-448B-8FE0-B6AC8D205509} = {68A5DD20-7057-448B-8FE0-B6AC8D205509} 5 | EndProjectSection 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "..\SoundTouch\SoundTouch.vcproj", "{68A5DD20-7057-448B-8FE0-B6AC8D205509}" 8 | ProjectSection(ProjectDependencies) = postProject 9 | EndProjectSection 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfiguration) = preSolution 13 | Debug = Debug 14 | Release = Release 15 | EndGlobalSection 16 | GlobalSection(ProjectDependencies) = postSolution 17 | EndGlobalSection 18 | GlobalSection(ProjectConfiguration) = postSolution 19 | {5AACDFFA-D491-44B8-A332-DA7ACCAAF2AF}.Debug.ActiveCfg = Debug|Win32 20 | {5AACDFFA-D491-44B8-A332-DA7ACCAAF2AF}.Debug.Build.0 = Debug|Win32 21 | {5AACDFFA-D491-44B8-A332-DA7ACCAAF2AF}.Release.ActiveCfg = Release|Win32 22 | {5AACDFFA-D491-44B8-A332-DA7ACCAAF2AF}.Release.Build.0 = Release|Win32 23 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug.ActiveCfg = Debug|Win32 24 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug.Build.0 = Debug|Win32 25 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release.ActiveCfg = Release|Win32 26 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release.Build.0 = Release|Win32 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityAddIns) = postSolution 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouchDLL/SoundTouchDLL.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouchDLL", "SoundTouchDLL.vcproj", "{164DE61D-6391-4265-8273-30740117D356}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | {68A5DD20-7057-448B-8FE0-B6AC8D205509} = {68A5DD20-7057-448B-8FE0-B6AC8D205509} 5 | EndProjectSection 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "..\SoundTouch\SoundTouch.vcproj", "{68A5DD20-7057-448B-8FE0-B6AC8D205509}" 8 | ProjectSection(ProjectDependencies) = postProject 9 | EndProjectSection 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfiguration) = preSolution 13 | Debug = Debug 14 | Release = Release 15 | EndGlobalSection 16 | GlobalSection(ProjectDependencies) = postSolution 17 | EndGlobalSection 18 | GlobalSection(ProjectConfiguration) = postSolution 19 | {164DE61D-6391-4265-8273-30740117D356}.Debug.ActiveCfg = Debug|Win32 20 | {164DE61D-6391-4265-8273-30740117D356}.Debug.Build.0 = Debug|Win32 21 | {164DE61D-6391-4265-8273-30740117D356}.Release.ActiveCfg = Release|Win32 22 | {164DE61D-6391-4265-8273-30740117D356}.Release.Build.0 = Release|Win32 23 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug.ActiveCfg = Debug|Win32 24 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug.Build.0 = Debug|Win32 25 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release.ActiveCfg = Release|Win32 26 | {68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release.Build.0 = Release|Win32 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityAddIns) = postSolution 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /soundtouch/config/am_include.mk: -------------------------------------------------------------------------------- 1 | ## vim:tw=78 2 | ## Process this file with automake to create Makefile.in 3 | ## 4 | ## $Id: am_include.mk 37 2008-12-25 16:33:39Z oparviai $ 5 | ## 6 | ## Copyright (C) 2003 - David W. Durham 7 | ## 8 | ## This file is part of SoundTouch, an audio processing library for pitch/time adjustments 9 | ## 10 | ## SoundTouch is free software; you can redistribute it and/or modify it under the 11 | ## terms of the GNU General Public License as published by the Free Software 12 | ## Foundation; either version 2 of the License, or (at your option) any later 13 | ## version. 14 | ## 15 | ## SoundTouch is distributed in the hope that it will be useful, but WITHOUT ANY 16 | ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 17 | ## A PARTICULAR PURPOSE. See the GNU General Public License for more details. 18 | ## 19 | ## You should have received a copy of the GNU General Public License along with 20 | ## this program; if not, write to the Free Software Foundation, Inc., 59 Temple 21 | ## Place - Suite 330, Boston, MA 02111-1307, USA 22 | 23 | ## These are common definitions used in all Makefiles 24 | ## It is actually included when a makefile.am is coverted to Makefile.in 25 | ## by automake, so it's ok to have @MACROS@ that will be set by configure 26 | 27 | 28 | ## INCLUDES is automatically added to CXXFLAGS at compile time. The 29 | ## $(top_srcdir) macro is set by configure. It's important to use $(top_srcdir) 30 | ## in case a user decides to build in a separate directory from the base package 31 | ## directory. Using absolute, or relative paths is a bad idea. 32 | INCLUDES=-I$(top_srcdir)/include 33 | 34 | 35 | # doc directory 36 | pkgdocdir=$(prefix)/doc/@PACKAGE@ 37 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Setup script for the SoundTouch module distribution.""" 4 | 5 | import os, re, sys, string 6 | 7 | from distutils.core import setup 8 | from distutils.extension import Extension 9 | 10 | os.environ['CC'] = 'g++' 11 | os.environ['CXX'] = 'g++' 12 | #os.environ['CPP'] = 'g++' 13 | #os.environ['LDSHARED'] = 'g++' 14 | 15 | VERSION_MAJOR = 0 16 | VERSION_MINOR = 1.0 17 | pysoundtouch_version = str(VERSION_MAJOR) + "." + str(VERSION_MINOR) 18 | 19 | def get_setup(): 20 | data = {} 21 | r = re.compile(r'(\S+)\s*=\s*(.+)') 22 | 23 | if not os.path.isfile('Setup'): 24 | print "No 'Setup' file. Perhaps you need to run the configure script." 25 | sys.exit(1) 26 | 27 | f = open('Setup', 'r') 28 | 29 | for line in f.readlines(): 30 | m = r.search(line) 31 | if not m: 32 | print "Error in setup file:", line 33 | sys.exit(1) 34 | key = m.group(1) 35 | val = m.group(2) 36 | data[key] = val 37 | 38 | return data 39 | 40 | data = get_setup() 41 | 42 | defines = [('VERSION_MAJOR', VERSION_MAJOR), 43 | ('VERSION_MINOR', VERSION_MINOR), 44 | ('VERSION', '"%s"' % pysoundtouch_version)] 45 | 46 | soundtouchmodule = Extension( 47 | name='soundtouchmodule', 48 | sources=['src/soundtouchmodule.c', 'src/pysoundtouch.cpp', 'src/pybpmdetect.cpp', 'src/WavFile.cpp'], 49 | define_macros = defines, 50 | include_dirs=[data['soundtouch_include_dir']], 51 | library_dirs=[data['soundtouch_lib_dir']], 52 | libraries=string.split(data['soundtouch_libs'])) 53 | 54 | setup ( # Distribution metadata 55 | name = "pysoundtouch", 56 | version = pysoundtouch_version, 57 | description = "A wrapper for the SoundTouch libraries.", 58 | author = "James Rising", 59 | author_email = "jarising@gmail.com", 60 | url = "http://existencia.org/pro/", 61 | license = "GPL", 62 | 63 | ext_modules = [soundtouchmodule]) 64 | -------------------------------------------------------------------------------- /src/pysoundtouch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * python interface to soundtouch (the open-source audio processing library) 3 | * Pitch, tempo, and rate shifting 4 | */ 5 | 6 | #ifndef __PY_SOUNDTOUCH_H__ 7 | #define __PY_SOUNDTOUCH_H__ 8 | 9 | #define __cplusplus 10 | 11 | #include 12 | #include 13 | 14 | #define BUFFER_SIZE 44100 15 | 16 | // Definition of the soundtouch object 17 | typedef struct { 18 | PyObject_HEAD 19 | int channels; // 1 or 2 20 | soundtouch::SoundTouch* soundtouch; 21 | union { 22 | char chars[BUFFER_SIZE]; 23 | short shorts[BUFFER_SIZE/2]; 24 | } buffer; 25 | } py_soundtouch; /* Soundtouch */ 26 | 27 | #define PY_SOUNDTOUCH(x) ((py_soundtouch *) x) 28 | 29 | extern PyTypeObject py_soundtouch_t; 30 | 31 | // Deallocate the SoundTouch object 32 | static void py_soundtouch_dealloc(PyObject* self, PyObject* args); 33 | 34 | // Adjust attributes of samples that have been entered 35 | static PyObject* py_soundtouch_set_rate(PyObject* self, PyObject* args); 36 | static PyObject* py_soundtouch_set_tempo(PyObject* self, PyObject* args); 37 | static PyObject* py_soundtouch_set_pitch(PyObject* self, PyObject* args); 38 | static PyObject* py_soundtouch_set_pitch_shift(PyObject* self, PyObject* args); 39 | 40 | // Move all waiting samples to the output 41 | static PyObject* py_soundtouch_flush(PyObject* self, PyObject* args); 42 | 43 | // Clear the buffer of samples 44 | static PyObject* py_soundtouch_clear(PyObject* self, PyObject* args); 45 | 46 | // Add new samples to be processed 47 | static PyObject* py_soundtouch_put_samples(PyObject* self, PyObject* args); 48 | 49 | // Extract processed samples from the output 50 | static PyObject* py_soundtouch_get_samples(PyObject* self, PyObject* args); 51 | 52 | // Return how many samples are available for output 53 | static PyObject* py_soundtouch_ready_count(PyObject* self, PyObject* args); 54 | 55 | // Return how many samples will be available given the current data 56 | static PyObject* py_soundtouch_waiting_count(PyObject* self, PyObject* args); 57 | 58 | // Get additional attributes from the SoundTouch object 59 | static PyObject* py_soundtouch_getattr(PyObject* self, char* name); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to create Makefile.in 2 | ## 3 | ## $Id: Makefile.am 37 2008-12-25 16:33:39Z 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 | 23 | include $(top_srcdir)/config/am_include.mk 24 | 25 | 26 | # set to something if you want other stuff to be included in the distribution tarball 27 | EXTRA_DIST=3dnow_win.cpp cpu_detect_x86_win.cpp SoundTouch.dsp SoundTouch.dsw SoundTouch.sln SoundTouch.vcproj 28 | 29 | noinst_HEADERS=AAFilter.h cpu_detect.h cpu_detect_x86_gcc.cpp FIRFilter.h RateTransposer.h TDStretch.h PeakFinder.h 30 | 31 | lib_LTLIBRARIES=libSoundTouch.la 32 | # 33 | libSoundTouch_la_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp mmx_optimized.cpp sse_optimized.cpp RateTransposer.cpp SoundTouch.cpp TDStretch.cpp cpu_detect_x86_gcc.cpp BPMDetect.cpp PeakFinder.cpp 34 | 35 | 36 | # Note by authore: '-msse2' might not work in non-X86 compilations. If someone can 37 | # fix this script to automatically check for CPU architecture, please submit a patch 38 | # to me. 39 | AM_CXXFLAGS=-O3 -msse2 -fcheck-new -I../../include 40 | 41 | 42 | # other linking flags to add 43 | # noinst_LTLIBRARIES = libSoundTouchOpt.la 44 | # libSoundTouch_la_LIBADD = libSoundTouchOpt.la 45 | # libSoundTouchOpt_la_SOURCES = mmx_optimized.cpp sse_optimized.cpp 46 | # libSoundTouchOpt_la_CXXFLAGS = -O3 -msse2 -fcheck-new -I../../include 47 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to create Makefile.in 2 | ## 3 | ## $Id: Makefile.am 43 2008-12-25 17:54:41Z 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 | include $(top_srcdir)/config/am_include.mk 23 | 24 | 25 | ## bin_PROGRAMS is the macro that tells automake the name of the programs to 26 | ## install in the bin directory (/usr/local/bin) by default. By setting 27 | ## --prefix= at configure time the user can change this (eg: ./configure 28 | ## --prefix=/usr will install soundstretch under /usr/bin/soundstretch ) 29 | bin_PROGRAMS=soundstretch 30 | 31 | noinst_HEADERS=RunParameters.h WavFile.h 32 | 33 | # extra files to include in distrubution tarball 34 | EXTRA_DIST=soundstretch.dsp soundstretch.dsw soundstretch.sln soundstretch.vcproj 35 | 36 | ## for every name listed under bin_PROGRAMS, you have a _SOURCES. This lists 37 | ## all the sources in the current directory that are used to build soundstretch. 38 | soundstretch_SOURCES=main.cpp RunParameters.cpp WavFile.cpp 39 | 40 | ## soundstretch_LDADD is a list of extras to pass at link time. All the objects 41 | ## created by the above soundstretch_SOURCES are automatically linked in, so here I 42 | ## list object files from other directories as well as flags passed to the 43 | ## linker. 44 | soundstretch_LDADD=../SoundTouch/libSoundTouch.la -lm 45 | 46 | ## linker flags 47 | soundstretch_LDFLAGS=-s 48 | 49 | ## additional compiler flags 50 | soundstretch_CXXFLAGS=-O3 51 | 52 | #clean-local: 53 | # -rm -f additional-files-to-remove-on-make-clean 54 | -------------------------------------------------------------------------------- /soundtouch/include/soundtouch_config.h.in~: -------------------------------------------------------------------------------- 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 | /* Name of package */ 47 | #undef PACKAGE 48 | 49 | /* Define to the address where bug reports for this package should be sent. */ 50 | #undef PACKAGE_BUGREPORT 51 | 52 | /* Define to the full name of this package. */ 53 | #undef PACKAGE_NAME 54 | 55 | /* Define to the full name and version of this package. */ 56 | #undef PACKAGE_STRING 57 | 58 | /* Define to the one symbol short name of this package. */ 59 | #undef PACKAGE_TARNAME 60 | 61 | /* Define to the version of this package. */ 62 | #undef PACKAGE_VERSION 63 | 64 | /* Define as the return type of signal handlers (`int' or `void'). */ 65 | #undef RETSIGTYPE 66 | 67 | /* Define to 1 if you have the ANSI C header files. */ 68 | #undef STDC_HEADERS 69 | 70 | /* Version number of package */ 71 | #undef VERSION 72 | 73 | /* Define to empty if `const' does not conform to ANSI C. */ 74 | #undef const 75 | 76 | /* Define to `__inline__' or `__inline' if that's what the C compiler 77 | calls it, or to nothing if 'inline' is not supported under any name. */ 78 | #ifndef __cplusplus 79 | #undef inline 80 | #endif 81 | 82 | /* Define to rpl_malloc if the replacement function should be used. */ 83 | #undef malloc 84 | -------------------------------------------------------------------------------- /soundtouch/source/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 | -------------------------------------------------------------------------------- /soundtouch/include/soundtouch_config.h.in: -------------------------------------------------------------------------------- 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 | /* Name of package */ 47 | #undef PACKAGE 48 | 49 | /* Define to the address where bug reports for this package should be sent. */ 50 | #undef PACKAGE_BUGREPORT 51 | 52 | /* Define to the full name of this package. */ 53 | #undef PACKAGE_NAME 54 | 55 | /* Define to the full name and version of this package. */ 56 | #undef PACKAGE_STRING 57 | 58 | /* Define to the one symbol short name of this package. */ 59 | #undef PACKAGE_TARNAME 60 | 61 | /* Define to the home page for this package. */ 62 | #undef PACKAGE_URL 63 | 64 | /* Define to the version of this package. */ 65 | #undef PACKAGE_VERSION 66 | 67 | /* Define as the return type of signal handlers (`int' or `void'). */ 68 | #undef RETSIGTYPE 69 | 70 | /* Define to 1 if you have the ANSI C header files. */ 71 | #undef STDC_HEADERS 72 | 73 | /* Version number of package */ 74 | #undef VERSION 75 | 76 | /* Define to empty if `const' does not conform to ANSI C. */ 77 | #undef const 78 | 79 | /* Define to `__inline__' or `__inline' if that's what the C compiler 80 | calls it, or to nothing if 'inline' is not supported under any name. */ 81 | #ifndef __cplusplus 82 | #undef inline 83 | #endif 84 | 85 | /* Define to rpl_malloc if the replacement function should be used. */ 86 | #undef malloc 87 | -------------------------------------------------------------------------------- /soundtouch/soundtouch.m4: -------------------------------------------------------------------------------- 1 | # m4 configure test script for the SoundTouch library 2 | # (c)2003 David W. Durham 3 | # 4 | # $Id: soundtouch.m4 20 2008-02-17 14:20:52Z oparviai $ 5 | # 6 | # This file can be included with other packages that need to test 7 | # for libSoundTouch. 8 | # 9 | # It will #define HAVE_LIBSOUNDTOUCH iff the library is found 10 | # It will AC_SUBST SOUNDTOUCH_LIBS and SOUNDTOUCH_CXXFLAGS as well 11 | # It also defines some flags to the configure script for specifying 12 | # the location to search for libSoundTouch 13 | # 14 | # A user of libSoundTouch should add @SOUNDTOUCH_LIBS@ and 15 | # @SOUNDTOUCH_CXXFLAGS@ to the appropriate variables in his 16 | # Makefile.am files 17 | # 18 | # This script works with autoconf-2.5x and automake-1.6 but I have 19 | # not tested it with older versions. 20 | 21 | 22 | dnl min version not supported yet 23 | dnl AM_PATH_SOUNDTOUCH([MINMUM-VERSION, [(additional) ACTION-IF-FOUND] [, ACTION-IF-NOT-FOUND]]]) 24 | 25 | AH_TEMPLATE([HAVE_LIBSOUNDTOUCH], [defined by $0]) 26 | SOUNDTOUCH_CXXFLAGS="" 27 | SOUNDTOUCH_LIBS="" 28 | 29 | AC_DEFUN([AM_PATH_SOUNDTOUCH],[ 30 | AC_ARG_WITH(soundtouch-prefix,[ --with-soundtouch-prefix=DIR Prefix where SoundTouch was installed (optional)], [soundtouch_prefix="$withval"],[soundtouch_prefix=""]) 31 | 32 | AC_ARG_ENABLE(soundtouch-check,[ --disable-soundtouch-check Do not look for the SoundTouch Library],[enable_soundtouch_check="$enableval"],[enable_soundtouch_check="yes"]) 33 | 34 | if test "$enable_soundtouch_check" = "yes" 35 | then 36 | saved_CPPFLAGS="$CPPFLAGS" 37 | saved_LDFLAGS="$LDFLAGS" 38 | 39 | CPPFLAGS="$CPPFLAGS -I$soundtouch_prefix/include" 40 | LDFLAGS="$LDFLAGS -L$soundtouch_prefix/lib" 41 | 42 | dnl make sure SoundTouch.h header file exists 43 | dnl could use AC_CHECK_HEADERS to check for all of them, but the supporting .h file names may change later 44 | AC_CHECK_HEADER([soundtouch/SoundTouch.h],[ 45 | dnl SoundTouch.h found 46 | dnl make sure libSoundTouch is linkable 47 | AC_CHECK_LIB([SoundTouch],[soundtouch_ac_test],[ 48 | dnl libSoundTouch found 49 | SOUNDTOUCH_CXXFLAGS="-I$soundtouch_prefix/include" 50 | SOUNDTOUCH_LIBS="-L$soundtouch_prefix/lib -lSoundTouch" 51 | AC_DEFINE([HAVE_LIBSOUNDTOUCH]) 52 | 53 | dnl run action-if-found 54 | ifelse([$2], , :, [$2]) 55 | ],[ 56 | dnl run action-if-not-found 57 | ifelse([$3], , :, [$3]) 58 | ]) 59 | ],[ 60 | dnl run action-if-not-found 61 | ifelse([$3], , :, [$3]) 62 | ]) 63 | 64 | CPPFLAGS="$saved_CPPFLAGS" 65 | LDFLAGS="$saved_LDFLAGS" 66 | fi 67 | 68 | AC_SUBST(SOUNDTOUCH_CXXFLAGS) 69 | AC_SUBST(SOUNDTOUCH_LIBS) 70 | ]) 71 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/RunParameters.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// A class for parsing the 'soundstretch' application command line parameters 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 | // Last changed : $Date: 2009-05-17 19:48:30 +0300 (Sun, 17 May 2009) $ 12 | // File revision : $Revision: 4 $ 13 | // 14 | // $Id: RunParameters.h 72 2009-05-17 16:48:30Z oparviai $ 15 | // 16 | //////////////////////////////////////////////////////////////////////////////// 17 | // 18 | // License : 19 | // 20 | // SoundTouch audio processing library 21 | // Copyright (c) Olli Parviainen 22 | // 23 | // This library is free software; you can redistribute it and/or 24 | // modify it under the terms of the GNU Lesser General Public 25 | // License as published by the Free Software Foundation; either 26 | // version 2.1 of the License, or (at your option) any later version. 27 | // 28 | // This library is distributed in the hope that it will be useful, 29 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 31 | // Lesser General Public License for more details. 32 | // 33 | // You should have received a copy of the GNU Lesser General Public 34 | // License along with this library; if not, write to the Free Software 35 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 36 | // 37 | //////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef RUNPARAMETERS_H 40 | #define RUNPARAMETERS_H 41 | 42 | #include "STTypes.h" 43 | #include 44 | 45 | using namespace std; 46 | 47 | /// Parses command line parameters into program parameters 48 | class RunParameters 49 | { 50 | private: 51 | void throwIllegalParamExp(const string &str) const; 52 | void throwLicense() const; 53 | void parseSwitchParam(const string &str); 54 | void checkLimits(); 55 | float parseSwitchValue(const string &str) const; 56 | 57 | public: 58 | char *inFileName; 59 | char *outFileName; 60 | float tempoDelta; 61 | float pitchDelta; 62 | float rateDelta; 63 | int quick; 64 | int noAntiAlias; 65 | float goalBPM; 66 | BOOL detectBPM; 67 | BOOL speech; 68 | 69 | RunParameters(const int nParams, const char * const paramStr[]); 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /soundtouch/include/soundtouch_config.h: -------------------------------------------------------------------------------- 1 | /* include/soundtouch_config.h. Generated from soundtouch_config.h.in by configure. */ 2 | /* include/soundtouch_config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Use Float as Sample type */ 5 | #define FLOAT_SAMPLES 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_DLFCN_H 1 9 | 10 | /* Define to 1 if you have the header file. */ 11 | #define HAVE_INTTYPES_H 1 12 | 13 | /* Define to 1 if you have the `m' library (-lm). */ 14 | #define HAVE_LIBM 1 15 | 16 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 17 | to 0 otherwise. */ 18 | #define HAVE_MALLOC 1 19 | 20 | /* Define to 1 if you have the header file. */ 21 | #define HAVE_MEMORY_H 1 22 | 23 | /* Define to 1 if you have the header file. */ 24 | #define HAVE_STDINT_H 1 25 | 26 | /* Define to 1 if you have the header file. */ 27 | #define HAVE_STDLIB_H 1 28 | 29 | /* Define to 1 if you have the header file. */ 30 | #define HAVE_STRINGS_H 1 31 | 32 | /* Define to 1 if you have the header file. */ 33 | #define HAVE_STRING_H 1 34 | 35 | /* Define to 1 if you have the header file. */ 36 | #define HAVE_SYS_STAT_H 1 37 | 38 | /* Define to 1 if you have the header file. */ 39 | #define HAVE_SYS_TYPES_H 1 40 | 41 | /* Define to 1 if you have the header file. */ 42 | #define HAVE_UNISTD_H 1 43 | 44 | /* Use Integer as Sample type */ 45 | /* #undef INTEGER_SAMPLES */ 46 | 47 | /* Name of package */ 48 | #define PACKAGE "soundtouch" 49 | 50 | /* Define to the address where bug reports for this package should be sent. */ 51 | #define PACKAGE_BUGREPORT "http://www.surina.net/soundtouch" 52 | 53 | /* Define to the full name of this package. */ 54 | #define PACKAGE_NAME "SoundTouch" 55 | 56 | /* Define to the full name and version of this package. */ 57 | #define PACKAGE_STRING "SoundTouch 1.4.0" 58 | 59 | /* Define to the one symbol short name of this package. */ 60 | #define PACKAGE_TARNAME "soundtouch" 61 | 62 | /* Define to the home page for this package. */ 63 | #define PACKAGE_URL "" 64 | 65 | /* Define to the version of this package. */ 66 | #define PACKAGE_VERSION "1.4.0" 67 | 68 | /* Define as the return type of signal handlers (`int' or `void'). */ 69 | #define RETSIGTYPE void 70 | 71 | /* Define to 1 if you have the ANSI C header files. */ 72 | #define STDC_HEADERS 1 73 | 74 | /* Version number of package */ 75 | #define VERSION "1.4.0" 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 | -------------------------------------------------------------------------------- /soundtouch/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to create Makefile.in 2 | ## 3 | ## $Id: Makefile.am 38 2008-12-25 17:00:23Z 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 | ## Descend into SUBDIRS and run make. Look at the Makefile.am files in the 26 | ## subdirectories Start at frontend_fox/Makefile.am to see how everything works. 27 | SUBDIRS=include source 28 | 29 | 30 | # list files that are documentation to be packaged in a release tarball and installed 31 | pkgdoc_DATA=COPYING.TXT README.html 32 | 33 | # extra data files that are to be pacakged in a release tarball and installed into the data directory 34 | #pkgdata_DATA= 35 | 36 | # sets up for soundtouch.m4 to be installed 37 | m4datadir=$(datadir)/aclocal 38 | m4data_DATA=soundtouch.m4 39 | 40 | ## These extra files and directories will be included in the distribution. by 41 | ## using make-dist by default many common filenames are automatically included 42 | ## such as AUTHORS, COPYING, etc the bootstrap script really shouldn't be a part 43 | ## of a final package, but it is useful for developers who might want to make 44 | ## changes to the configure scripts or makefiles. 45 | # NOTE: wouldn't have to list the .TXT file if it were named without the .TXT 46 | EXTRA_DIST= \ 47 | soundtouch.m4 \ 48 | config/m4 \ 49 | bootstrap \ 50 | make-win.bat \ 51 | COPYING.TXT \ 52 | README.html 53 | 54 | pkgconfigdir = $(libdir)/pkgconfig 55 | pkgconfig_DATA = soundtouch-1.4.pc 56 | 57 | ## This removes stuff from the distribution which may be present 58 | ## from a cvs checkout or other build reasons 59 | dist-hook: 60 | rm -rf `find $(distdir) -type d -name CVS` # remove all CVS directories 61 | echo rm -rf `find $(distdir) -type f -name \.\#\*` # CVS revision files left around for some reason 62 | 63 | ## This happens at 'make distclean' 64 | #distcleancheck: 65 | # rm -rf files-that-may-also-need-to-be-deleted-on-'make distclean' 66 | 67 | 68 | # flag to aclocal where to find m4 macros for tests 69 | ACLOCAL_AMFLAGS = -I config/m4 70 | AUTOMAKE_OPTIONS = foreign 71 | -------------------------------------------------------------------------------- /soundtouch/autom4te.cache/requests: -------------------------------------------------------------------------------- 1 | # This file was generated by Autom4te Tue Aug 3 21:06:07 PDT 2010. 2 | # It contains the lists of macros which have been traced. 3 | # It can be safely removed. 4 | 5 | @request = ( 6 | bless( [ 7 | '0', 8 | 1, 9 | [ 10 | '/usr/share/autoconf' 11 | ], 12 | [ 13 | '/usr/share/autoconf/autoconf/autoconf.m4f', 14 | 'aclocal.m4', 15 | 'configure.ac' 16 | ], 17 | { 18 | 'AM_PROG_F77_C_O' => 1, 19 | '_LT_AC_TAGCONFIG' => 1, 20 | 'm4_pattern_forbid' => 1, 21 | 'AC_INIT' => 1, 22 | 'AC_CANONICAL_TARGET' => 1, 23 | '_AM_COND_IF' => 1, 24 | 'AC_CONFIG_LIBOBJ_DIR' => 1, 25 | 'AC_SUBST' => 1, 26 | 'AC_CANONICAL_HOST' => 1, 27 | 'AC_FC_SRCEXT' => 1, 28 | 'AC_PROG_LIBTOOL' => 1, 29 | 'AM_INIT_AUTOMAKE' => 1, 30 | 'AC_CONFIG_SUBDIRS' => 1, 31 | 'AM_AUTOMAKE_VERSION' => 1, 32 | 'LT_CONFIG_LTDL_DIR' => 1, 33 | 'AC_CONFIG_LINKS' => 1, 34 | 'AC_REQUIRE_AUX_FILE' => 1, 35 | 'LT_SUPPORTED_TAG' => 1, 36 | 'm4_sinclude' => 1, 37 | 'AM_MAINTAINER_MODE' => 1, 38 | 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, 39 | '_m4_warn' => 1, 40 | 'AM_PROG_CXX_C_O' => 1, 41 | '_AM_COND_ENDIF' => 1, 42 | 'AM_ENABLE_MULTILIB' => 1, 43 | 'AM_SILENT_RULES' => 1, 44 | 'AC_CONFIG_FILES' => 1, 45 | 'include' => 1, 46 | 'LT_INIT' => 1, 47 | 'AM_GNU_GETTEXT' => 1, 48 | 'AC_LIBSOURCE' => 1, 49 | 'AC_CANONICAL_BUILD' => 1, 50 | 'AM_PROG_FC_C_O' => 1, 51 | 'AC_FC_FREEFORM' => 1, 52 | 'AH_OUTPUT' => 1, 53 | 'AC_CONFIG_AUX_DIR' => 1, 54 | '_AM_SUBST_NOTMAKE' => 1, 55 | 'AM_PROG_CC_C_O' => 1, 56 | 'm4_pattern_allow' => 1, 57 | 'sinclude' => 1, 58 | 'AM_CONDITIONAL' => 1, 59 | 'AC_CANONICAL_SYSTEM' => 1, 60 | 'AC_CONFIG_HEADERS' => 1, 61 | 'AC_DEFINE_TRACE_LITERAL' => 1, 62 | 'm4_include' => 1, 63 | '_AM_COND_ELSE' => 1, 64 | 'AC_SUBST_TRACE' => 1 65 | } 66 | ], 'Autom4te::Request' ) 67 | ); 68 | 69 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouchDLL/SoundTouchDLL.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | #endif // English (U.S.) resources 50 | ///////////////////////////////////////////////////////////////////////////// 51 | 52 | 53 | ///////////////////////////////////////////////////////////////////////////// 54 | // Finnish resources 55 | 56 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FIN) 57 | #ifdef _WIN32 58 | LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT 59 | #pragma code_page(1252) 60 | #endif //_WIN32 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Version 65 | // 66 | 67 | VS_VERSION_INFO VERSIONINFO 68 | FILEVERSION 1,5,0,0 69 | PRODUCTVERSION 1,5,0,0 70 | FILEFLAGSMASK 0x17L 71 | #ifdef _DEBUG 72 | FILEFLAGS 0x1L 73 | #else 74 | FILEFLAGS 0x0L 75 | #endif 76 | FILEOS 0x4L 77 | FILETYPE 0x2L 78 | FILESUBTYPE 0x0L 79 | BEGIN 80 | BLOCK "StringFileInfo" 81 | BEGIN 82 | BLOCK "000004b0" 83 | BEGIN 84 | VALUE "FileDescription", "SoundTouch Dynamic Link Library" 85 | VALUE "FileVersion", "1, 5, 0, 0" 86 | VALUE "InternalName", "SoundTouch" 87 | VALUE "LegalCopyright", "Copyright (C) Olli Parviainen 1999-2009" 88 | VALUE "OriginalFilename", "SoundTouch.dll" 89 | VALUE "ProductName", " SoundTouch Dynamic Link Library" 90 | VALUE "ProductVersion", "1, 5, 0, 0" 91 | END 92 | END 93 | BLOCK "VarFileInfo" 94 | BEGIN 95 | VALUE "Translation", 0x0, 1200 96 | END 97 | END 98 | 99 | #endif // Finnish resources 100 | ///////////////////////////////////////////////////////////////////////////// 101 | 102 | 103 | 104 | #ifndef APSTUDIO_INVOKED 105 | ///////////////////////////////////////////////////////////////////////////// 106 | // 107 | // Generated from the TEXTINCLUDE 3 resource. 108 | // 109 | 110 | 111 | ///////////////////////////////////////////////////////////////////////////// 112 | #endif // not APSTUDIO_INVOKED 113 | 114 | -------------------------------------------------------------------------------- /soundtouch/source/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: 2008-02-10 18:26:55 +0200 (Sun, 10 Feb 2008) $ 17 | // File revision : $Revision: 4 $ 18 | // 19 | // $Id: AAFilter.h 11 2008-02-10 16:26:55Z 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 | 49 | namespace soundtouch 50 | { 51 | 52 | class AAFilter 53 | { 54 | protected: 55 | class FIRFilter *pFIR; 56 | 57 | /// Low-pass filter cut-off frequency, negative = invalid 58 | double cutoffFreq; 59 | 60 | /// num of filter taps 61 | uint length; 62 | 63 | /// Calculate the FIR coefficients realizing the given cutoff-frequency 64 | void calculateCoeffs(); 65 | public: 66 | AAFilter(uint length); 67 | 68 | ~AAFilter(); 69 | 70 | /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling 71 | /// frequency (nyquist frequency = 0.5). The filter will cut off the 72 | /// frequencies than that. 73 | void setCutoffFreq(double newCutoffFreq); 74 | 75 | /// Sets number of FIR filter taps, i.e. ~filter complexity 76 | void setLength(uint newLength); 77 | 78 | uint getLength() const; 79 | 80 | /// Applies the filter to the given sequence of samples. 81 | /// Note : The amount of outputted samples is by value of 'filter length' 82 | /// smaller than the amount of input samples. 83 | uint evaluate(SAMPLETYPE *dest, 84 | const SAMPLETYPE *src, 85 | uint numSamples, 86 | uint numChannels) const; 87 | }; 88 | 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /src/pybpmdetect.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * python interface to soundtouch (the open-source audio processing library) 3 | * 4 | * The structure of this code was based on pymad-0.5.4 5 | * This is a C++ file. 6 | */ 7 | 8 | #include 9 | 10 | extern "C" { 11 | #include "soundtouchmodule.h" 12 | } 13 | #include "pybpmdetect.h" 14 | 15 | #if PY_VERSION_HEX < 0x01060000 16 | #define PyObject_DEL(op) PyMem_DEL((op)) 17 | #endif 18 | 19 | PyTypeObject py_bpmdetect_t = { 20 | PyObject_HEAD_INIT(&PyType_Type) 21 | 0, 22 | "BPMDetect", 23 | sizeof(py_bpmdetect), 24 | 0, 25 | /* standard methods */ 26 | (destructor) py_bpmdetect_dealloc, 27 | (printfunc) 0, 28 | (getattrfunc) py_bpmdetect_getattr, 29 | (setattrfunc) 0, 30 | (cmpfunc) 0, 31 | (reprfunc) 0, 32 | /* type categories */ 33 | 0, /* as number */ 34 | 0, /* as sequence */ 35 | 0, /* as mapping */ 36 | 0, /* hash */ 37 | 0, /* binary */ 38 | 0, /* repr */ 39 | 0, /* getattro */ 40 | 0, /* setattro */ 41 | 0, /* as buffer */ 42 | 0, /* tp_flags */ 43 | NULL 44 | }; 45 | 46 | // Constructor 47 | PyObject* py_bpmdetect_new(PyObject* self, PyObject* args) { 48 | py_bpmdetect* ps = NULL; 49 | uint sampleRate, channels; 50 | 51 | // Needs to be constructed with sampling rate and number of channels 52 | if (!PyArg_ParseTuple(args, "II:Soundtouch", &sampleRate, &channels)) { 53 | PyErr_SetString(PyExc_RuntimeError, "Requires sampling rate and number of channels (sample size must be 2)"); 54 | return NULL; 55 | } 56 | 57 | // Create the object 58 | ps = PyObject_NEW(py_bpmdetect, &py_bpmdetect_t); 59 | ps->bpmdetect = new soundtouch::BPMDetect((int) channels, (int) sampleRate); 60 | ps->channels = (int) channels; 61 | 62 | return (PyObject*) ps; 63 | } 64 | 65 | // Deallocate the BPMDetect object 66 | static void py_bpmdetect_dealloc(PyObject* self, PyObject* args) { 67 | py_bpmdetect* ps = PY_BPMDETECT(self); 68 | 69 | if (ps->bpmdetect) { 70 | delete ps->bpmdetect; 71 | ps->bpmdetect = NULL; 72 | } 73 | 74 | PyObject_DEL(self); 75 | } 76 | 77 | // Read in a number of samples for beat detection 78 | static PyObject* py_bpmdetect_put_samples(PyObject* self, PyObject* args) { 79 | py_bpmdetect* ps = PY_BPMDETECT(self); 80 | int buflen; 81 | char* transfer; 82 | 83 | // Needs to be called with a string of samples 84 | if (!PyArg_ParseTuple(args, "s#", &transfer, &buflen)) { 85 | PyErr_SetString(PyExc_TypeError, "invalid argument"); 86 | return NULL; 87 | } 88 | 89 | // Move all into our char-short union 90 | for (int ii = 0; ii < buflen; ii++) 91 | ps->buffer.chars[ii] = transfer[ii]; 92 | 93 | // Input them into the BMP detector 94 | ps->bpmdetect->inputSamples(ps->buffer.shorts, (uint) buflen / (2 * ps->channels)); 95 | 96 | Py_INCREF(Py_None); 97 | return Py_None; 98 | } 99 | 100 | // Perform the beat detection algorithm 101 | // return the beats per minute 102 | static PyObject* py_bpmdetect_get_bpm(PyObject* self, PyObject* args) { 103 | py_bpmdetect* ps = PY_BPMDETECT(self); 104 | 105 | // Return the BPM of the input samples 106 | float bpm = ps->bpmdetect->getBpm(); 107 | 108 | return PyFloat_FromDouble(bpm); 109 | } 110 | 111 | /* housekeeping */ 112 | 113 | static PyMethodDef bpmdetect_methods[] = { 114 | { "put_samples", py_bpmdetect_put_samples, METH_VARARGS, "" }, 115 | { "get_bpm", py_bpmdetect_get_bpm, METH_VARARGS, "" }, 116 | { NULL, 0, 0, NULL } 117 | }; 118 | 119 | // Extract information from the bpmdetect object 120 | static PyObject* py_bpmdetect_getattr(PyObject* self, char* name) { 121 | return Py_FindMethod(bpmdetect_methods, self, name); 122 | } 123 | -------------------------------------------------------------------------------- /soundtouch/source/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: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $ 13 | // File revision : $Revision: 4 $ 14 | // 15 | // $Id: PeakFinder.h 63 2009-02-21 16:00:14Z 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 the 'ground' level, i.e. smallest level between two neighbouring peaks, to right- 67 | /// or left-hand side of the given peak position. 68 | int findGround(const float *data, /// Data vector. 69 | int peakpos, /// Peak position index within the data vector. 70 | int direction /// Direction where to proceed from the peak: 1 = right, -1 = left. 71 | ) const; 72 | 73 | /// get exact center of peak near given position by calculating local mass of center 74 | double getPeakCenter(const float *data, int peakpos, bool loose = 0) const; 75 | 76 | public: 77 | /// Constructor. 78 | PeakFinder(); 79 | 80 | /// Detect exact peak position of the data vector by finding the largest peak 'hump' 81 | /// and calculating the mass-center location of the peak hump. 82 | /// 83 | /// \return The location of the largest base harmonic peak hump. 84 | double detectPeak(const float *data, /// Data vector to be analyzed. The data vector has 85 | /// to be at least 'maxPos' items long. 86 | int minPos, ///< Min allowed peak location within the vector data. 87 | int maxPos, ///< Max allowed peak location within the vector data. 88 | bool loose = 0 89 | ); 90 | }; 91 | 92 | } 93 | 94 | #endif // _PeakFinder_H_ 95 | -------------------------------------------------------------------------------- /soundtouch/configure.ac: -------------------------------------------------------------------------------- 1 | dnl SoundTouch configure.ac, by David W. Durham 2 | dnl 3 | dnl $Id: configure.ac 38 2008-12-25 17:00:23Z oparviai $ 4 | dnl 5 | dnl This file is part of SoundTouch, an audio processing library for pitch/time adjustments 6 | dnl 7 | dnl SoundTouch is free software; you can redistribute it and/or modify it under the 8 | dnl terms of the GNU General Public License as published by the Free Software 9 | dnl Foundation; either version 2 of the License, or (at your option) any later 10 | dnl version. 11 | dnl 12 | dnl SoundTouch is distributed in the hope that it will be useful, but WITHOUT ANY 13 | dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 | dnl details. 16 | dnl 17 | dnl You should have received a copy of the GNU General Public License along with 18 | dnl this program; if not, write to the Free Software Foundation, Inc., 59 Temple 19 | dnl Place - Suite 330, Boston, MA 02111-1307, USA 20 | # Process this file with autoconf to produce a configure script. 21 | 22 | AC_INIT(SoundTouch, 1.4.0, [http://www.surina.net/soundtouch]) 23 | AC_CONFIG_AUX_DIR(config) 24 | AM_CONFIG_HEADER([include/soundtouch_config.h]) 25 | AM_INIT_AUTOMAKE 26 | AC_DISABLE_SHARED dnl This makes libtool only build static libs 27 | #AC_GNU_SOURCE dnl enable posix extensions in glibc 28 | 29 | AC_LANG(C++) 30 | 31 | 32 | 33 | 34 | 35 | dnl ############################################################################ 36 | dnl # Checks for programs # 37 | dnl ############################################################################ 38 | AC_PROG_CXX 39 | #AC_PROG_AWK 40 | AC_PROG_CC 41 | AC_PROG_CPP 42 | AC_PROG_CXXCPP 43 | AC_PROG_INSTALL 44 | #AC_PROG_LN_S 45 | AC_PROG_MAKE_SET 46 | 47 | AM_PROG_LIBTOOL dnl turn on using libtool 48 | 49 | 50 | 51 | 52 | dnl ############################################################################ 53 | dnl # Checks for header files # 54 | dnl ############################################################################ 55 | AC_HEADER_STDC 56 | #AC_HEADER_SYS_WAIT 57 | # add any others you want to check for here 58 | #AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h sys/ioctl.h sys/vfs.h unistd.h]) 59 | 60 | 61 | 62 | 63 | 64 | 65 | dnl ############################################################################ 66 | dnl # Checks for typedefs, structures, and compiler characteristics $ 67 | dnl ############################################################################ 68 | AC_C_CONST 69 | AC_C_INLINE 70 | #AC_TYPE_OFF_T 71 | #AC_TYPE_SIZE_T 72 | 73 | 74 | AC_ARG_ENABLE(integer-samples, 75 | [AC_HELP_STRING([--enable-integer-samples], 76 | [use integer samples instead of floats 77 | [default=yes]])],, 78 | [enable_integer_samples=no]) 79 | 80 | 81 | if test "x$enable_integer_samples" = "xyes"; then 82 | echo "****** Integer sample type enabled ******" 83 | AC_DEFINE(INTEGER_SAMPLES,1,[Use Integer as Sample type]) 84 | else 85 | echo "****** Float sample type enabled ******" 86 | AC_DEFINE(FLOAT_SAMPLES,1,[Use Float as Sample type]) 87 | fi 88 | 89 | 90 | 91 | dnl ############################################################################ 92 | dnl # Checks for library functions/classes # 93 | dnl ############################################################################ 94 | AC_FUNC_MALLOC 95 | AC_TYPE_SIGNAL 96 | 97 | dnl make -lm get added to the LIBS 98 | AC_CHECK_LIB(m, sqrt,,AC_MSG_ERROR([compatible libc math library not found])) 99 | 100 | dnl add whatever functions you might want to check for here 101 | #AC_CHECK_FUNCS([floor ftruncate memmove memset mkdir modf pow realpath sqrt strchr strdup strerror strrchr strstr strtol]) 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | dnl ############################################################################ 110 | dnl # Internationaliation and Localiation # 111 | dnl ############################################################################ 112 | #AM_GNU_GETTEXT_VERSION([0.11.5]) 113 | #AM_GNU_GETTEXT([external]) 114 | 115 | 116 | 117 | 118 | 119 | dnl ############################################################################ 120 | dnl # Final # 121 | dnl ############################################################################ 122 | 123 | AC_CONFIG_FILES([ 124 | Makefile 125 | source/Makefile 126 | source/SoundTouch/Makefile 127 | source/SoundStretch/Makefile 128 | include/Makefile 129 | ]) 130 | 131 | AC_OUTPUT( 132 | soundtouch-1.4.pc 133 | ) 134 | 135 | dnl use 'echo' to put stuff here if you want a message to the builder 136 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouchDLL/SoundTouchDLL.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 19 | 31 | 33 | 42 | 44 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 66 | 72 | 84 | 86 | 97 | 99 | 104 | 106 | 108 | 110 | 112 | 114 | 116 | 118 | 120 | 121 | 122 | 123 | 124 | 125 | 129 | 131 | 132 | 133 | 137 | 139 | 140 | 142 | 143 | 144 | 148 | 150 | 151 | 152 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/cpu_detect_x86_win.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Win32 version of the x86 CPU detect routine. 4 | /// 5 | /// This file is to be compiled in Windows platform with Microsoft Visual C++ 6 | /// Compiler. Please see 'cpu_detect_x86_gcc.cpp' for the gcc compiler version 7 | /// for all GNU platforms. 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: 2009-02-13 18:22:48 +0200 (Fri, 13 Feb 2009) $ 16 | // File revision : $Revision: 4 $ 17 | // 18 | // $Id: cpu_detect_x86_win.cpp 62 2009-02-13 16:22:48Z 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 | #include "cpu_detect.h" 44 | 45 | #ifndef WIN32 46 | #error wrong platform - this source code file is exclusively for Win32 platform 47 | #endif 48 | 49 | ////////////////////////////////////////////////////////////////////////////// 50 | // 51 | // processor instructions extension detection routines 52 | // 53 | ////////////////////////////////////////////////////////////////////////////// 54 | 55 | // Flag variable indicating whick ISA extensions are disabled (for debugging) 56 | static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions 57 | 58 | 59 | // Disables given set of instruction extensions. See SUPPORT_... defines. 60 | void disableExtensions(uint dwDisableMask) 61 | { 62 | _dwDisabledISA = dwDisableMask; 63 | } 64 | 65 | 66 | 67 | /// Checks which instruction set extensions are supported by the CPU. 68 | uint detectCPUextensions(void) 69 | { 70 | uint res = 0; 71 | 72 | if (_dwDisabledISA == 0xffffffff) return 0; 73 | 74 | _asm 75 | { 76 | ; check if 'cpuid' instructions is available by toggling eflags bit 21 77 | ; 78 | xor esi, esi ; clear esi = result register 79 | 80 | pushfd ; save eflags to stack 81 | mov eax,dword ptr [esp] ; load eax from stack (with eflags) 82 | mov ecx, eax ; save the original eflags values to ecx 83 | xor eax, 0x00200000 ; toggle bit 21 84 | mov dword ptr [esp],eax ; store toggled eflags to stack 85 | popfd ; load eflags from stack 86 | 87 | pushfd ; save updated eflags to stack 88 | mov eax,dword ptr [esp] ; load eax from stack 89 | popfd ; pop stack to restore stack pointer 90 | 91 | xor edx, edx ; clear edx for defaulting no mmx 92 | cmp eax, ecx ; compare to original eflags values 93 | jz end ; jumps to 'end' if cpuid not present 94 | 95 | ; cpuid instruction available, test for presence of mmx instructions 96 | mov eax, 1 97 | cpuid 98 | test edx, 0x00800000 99 | jz end ; branch if MMX not available 100 | 101 | or esi, SUPPORT_MMX ; otherwise add MMX support bit 102 | 103 | test edx, 0x02000000 104 | jz test3DNow ; branch if SSE not available 105 | 106 | or esi, SUPPORT_SSE ; otherwise add SSE support bit 107 | 108 | test3DNow: 109 | ; test for precense of AMD extensions 110 | mov eax, 0x80000000 111 | cpuid 112 | cmp eax, 0x80000000 113 | jbe end ; branch if no AMD extensions detected 114 | 115 | ; test for precense of 3DNow! extension 116 | mov eax, 0x80000001 117 | cpuid 118 | test edx, 0x80000000 119 | jz end ; branch if 3DNow! not detected 120 | 121 | or esi, SUPPORT_3DNOW ; otherwise add 3DNow support bit 122 | 123 | end: 124 | 125 | mov res, esi 126 | } 127 | 128 | return res & ~_dwDisabledISA; 129 | } 130 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/soundstretch.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="soundstretch" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=soundstretch - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "soundstretch.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "soundstretch.mak" CFG="soundstretch - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "soundstretch - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE "soundstretch - Win32 Debug" (based on "Win32 (x86) Console Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "soundstretch - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Ignore_Export_Lib 0 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 45 | # ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c 46 | # SUBTRACT CPP /YX 47 | # ADD BASE RSC /l 0x40b /d "NDEBUG" 48 | # ADD RSC /l 0x40b /d "NDEBUG" 49 | BSC32=bscmake.exe 50 | # ADD BASE BSC32 /nologo 51 | # ADD BSC32 /nologo 52 | LINK32=link.exe 53 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 | # ADD LINK32 SoundTouch.lib /nologo /subsystem:console /profile /map /debug /machine:I386 /libpath:"..\..\lib" 55 | # Begin Special Build Tool 56 | SOURCE="$(InputPath)" 57 | PostBuild_Cmds=copy Release\soundstretch.exe ..\..\bin\ 58 | # End Special Build Tool 59 | 60 | !ELSEIF "$(CFG)" == "soundstretch - Win32 Debug" 61 | 62 | # PROP BASE Use_MFC 0 63 | # PROP BASE Use_Debug_Libraries 1 64 | # PROP BASE Output_Dir "Debug" 65 | # PROP BASE Intermediate_Dir "Debug" 66 | # PROP BASE Target_Dir "" 67 | # PROP Use_MFC 0 68 | # PROP Use_Debug_Libraries 1 69 | # PROP Output_Dir "Debug" 70 | # PROP Intermediate_Dir "Debug" 71 | # PROP Ignore_Export_Lib 0 72 | # PROP Target_Dir "" 73 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c 74 | # ADD CPP /nologo /Zp16 /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c 75 | # SUBTRACT CPP /YX 76 | # ADD BASE RSC /l 0x40b /d "_DEBUG" 77 | # ADD RSC /l 0x40b /d "_DEBUG" 78 | BSC32=bscmake.exe 79 | # ADD BASE BSC32 /nologo 80 | # ADD BSC32 /nologo 81 | LINK32=link.exe 82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 83 | # ADD LINK32 SoundTouchD.lib /nologo /subsystem:console /map /debug /machine:I386 /nodefaultlib:"libc" /out:"Debug/soundstretchD.exe" /pdbtype:sept /libpath:"..\..\lib" 84 | # SUBTRACT LINK32 /pdb:none 85 | # Begin Special Build Tool 86 | SOURCE="$(InputPath)" 87 | PostBuild_Cmds=copy Debug\soundstretchD.exe ..\..\bin\ 88 | # End Special Build Tool 89 | 90 | !ENDIF 91 | 92 | # Begin Target 93 | 94 | # Name "soundstretch - Win32 Release" 95 | # Name "soundstretch - Win32 Debug" 96 | # Begin Group "Source Files" 97 | 98 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 99 | # Begin Source File 100 | 101 | SOURCE=.\main.cpp 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=.\RunParameters.cpp 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=.\WavFile.cpp 110 | # End Source File 111 | # End Group 112 | # Begin Group "Header Files" 113 | 114 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 115 | # Begin Source File 116 | 117 | SOURCE=.\RunParameters.h 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\..\..\include\SoundTouch.h 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=..\..\..\include\STTypes.h 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=.\WavFile.h 130 | # End Source File 131 | # End Group 132 | # Begin Group "Resource Files" 133 | 134 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 135 | # End Group 136 | # End Target 137 | # End Project 138 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/SoundTouch.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="SoundTouch" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=SoundTouch - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "SoundTouch.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "SoundTouch.mak" CFG="SoundTouch - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "SoundTouch - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "SoundTouch - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "SoundTouch - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 45 | # ADD BASE RSC /l 0x40b /d "NDEBUG" 46 | # ADD RSC /l 0x40b /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | # Begin Special Build Tool 54 | SOURCE="$(InputPath)" 55 | PostBuild_Cmds=copy .\Release\SoundTouch.lib ..\..\lib\ 56 | # End Special Build Tool 57 | 58 | !ELSEIF "$(CFG)" == "SoundTouch - Win32 Debug" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Debug" 63 | # PROP BASE Intermediate_Dir "Debug" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "Debug" 68 | # PROP Intermediate_Dir "Debug" 69 | # PROP Target_Dir "" 70 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 71 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c 72 | # ADD BASE RSC /l 0x40b /d "_DEBUG" 73 | # ADD RSC /l 0x40b /d "_DEBUG" 74 | BSC32=bscmake.exe 75 | # ADD BASE BSC32 /nologo 76 | # ADD BSC32 /nologo 77 | LIB32=link.exe -lib 78 | # ADD BASE LIB32 /nologo 79 | # ADD LIB32 /nologo /out:"Debug\SoundTouchD.lib" 80 | # Begin Special Build Tool 81 | SOURCE="$(InputPath)" 82 | PostBuild_Cmds=copy .\Debug\SoundTouchD.lib ..\..\lib\ 83 | # End Special Build Tool 84 | 85 | !ENDIF 86 | 87 | # Begin Target 88 | 89 | # Name "SoundTouch - Win32 Release" 90 | # Name "SoundTouch - Win32 Debug" 91 | # Begin Group "Source Files" 92 | 93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 94 | # Begin Group "bpm" 95 | 96 | # PROP Default_Filter "" 97 | # Begin Source File 98 | 99 | SOURCE=.\BPMDetect.cpp 100 | # End Source File 101 | # Begin Source File 102 | 103 | SOURCE=.\PeakFinder.cpp 104 | # End Source File 105 | # End Group 106 | # Begin Source File 107 | 108 | SOURCE=.\3dnow_win.cpp 109 | # End Source File 110 | # Begin Source File 111 | 112 | SOURCE=.\AAFilter.cpp 113 | # End Source File 114 | # Begin Source File 115 | 116 | SOURCE=.\cpu_detect_x86_win.cpp 117 | # End Source File 118 | # Begin Source File 119 | 120 | SOURCE=.\FIFOSampleBuffer.cpp 121 | # End Source File 122 | # Begin Source File 123 | 124 | SOURCE=.\FIRFilter.cpp 125 | # End Source File 126 | # Begin Source File 127 | 128 | SOURCE=.\mmx_optimized.cpp 129 | # End Source File 130 | # Begin Source File 131 | 132 | SOURCE=.\RateTransposer.cpp 133 | # End Source File 134 | # Begin Source File 135 | 136 | SOURCE=.\SoundTouch.cpp 137 | # End Source File 138 | # Begin Source File 139 | 140 | SOURCE=.\sse_optimized.cpp 141 | # End Source File 142 | # Begin Source File 143 | 144 | SOURCE=.\TDStretch.cpp 145 | # End Source File 146 | # End Group 147 | # Begin Group "Header Files" 148 | 149 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 150 | # Begin Source File 151 | 152 | SOURCE=.\AAFilter.h 153 | # End Source File 154 | # Begin Source File 155 | 156 | SOURCE=.\cpu_detect.h 157 | # End Source File 158 | # Begin Source File 159 | 160 | SOURCE=..\..\include\FIFOSampleBuffer.h 161 | # End Source File 162 | # Begin Source File 163 | 164 | SOURCE=..\..\include\FIFOSamplePipe.h 165 | # End Source File 166 | # Begin Source File 167 | 168 | SOURCE=.\FIRFilter.h 169 | # End Source File 170 | # Begin Source File 171 | 172 | SOURCE=.\RateTransposer.h 173 | # End Source File 174 | # Begin Source File 175 | 176 | SOURCE=..\..\include\SoundTouch.h 177 | # End Source File 178 | # Begin Source File 179 | 180 | SOURCE=..\..\include\STTypes.h 181 | # End Source File 182 | # Begin Source File 183 | 184 | SOURCE=.\TDStretch.h 185 | # End Source File 186 | # End Group 187 | # End Target 188 | # End Project 189 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/cpu_detect_x86_gcc.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Generic version of the x86 CPU extension detection routine. 4 | /// 5 | /// This file is for GNU & other non-Windows compilers, see 'cpu_detect_x86_win.cpp' 6 | /// for the Microsoft compiler version. 7 | /// 8 | /// Author : Copyright (c) Olli Parviainen 9 | /// Author e-mail : oparviai 'at' iki.fi 10 | /// SoundTouch WWW: http://www.surina.net/soundtouch 11 | /// 12 | //////////////////////////////////////////////////////////////////////////////// 13 | // 14 | // Last changed : $Date: 2009-02-25 19:13:51 +0200 (Wed, 25 Feb 2009) $ 15 | // File revision : $Revision: 4 $ 16 | // 17 | // $Id: cpu_detect_x86_gcc.cpp 67 2009-02-25 17:13:51Z oparviai $ 18 | // 19 | //////////////////////////////////////////////////////////////////////////////// 20 | // 21 | // License : 22 | // 23 | // SoundTouch audio processing library 24 | // Copyright (c) Olli Parviainen 25 | // 26 | // This library is free software; you can redistribute it and/or 27 | // modify it under the terms of the GNU Lesser General Public 28 | // License as published by the Free Software Foundation; either 29 | // version 2.1 of the License, or (at your option) any later version. 30 | // 31 | // This library is distributed in the hope that it will be useful, 32 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | // Lesser General Public License for more details. 35 | // 36 | // You should have received a copy of the GNU Lesser General Public 37 | // License along with this library; if not, write to the Free Software 38 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 39 | // 40 | //////////////////////////////////////////////////////////////////////////////// 41 | 42 | #include 43 | #include 44 | #include "cpu_detect.h" 45 | #include "STTypes.h" 46 | 47 | using namespace std; 48 | 49 | #include 50 | 51 | ////////////////////////////////////////////////////////////////////////////// 52 | // 53 | // processor instructions extension detection routines 54 | // 55 | ////////////////////////////////////////////////////////////////////////////// 56 | 57 | // Flag variable indicating whick ISA extensions are disabled (for debugging) 58 | static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions 59 | 60 | // Disables given set of instruction extensions. See SUPPORT_... defines. 61 | void disableExtensions(uint dwDisableMask) 62 | { 63 | _dwDisabledISA = dwDisableMask; 64 | } 65 | 66 | 67 | 68 | /// Checks which instruction set extensions are supported by the CPU. 69 | uint detectCPUextensions(void) 70 | { 71 | #if (!(ALLOW_X86_OPTIMIZATIONS) || !(__GNUC__)) 72 | 73 | return 0; // always disable extensions on non-x86 platforms. 74 | 75 | #else 76 | uint res = 0; 77 | 78 | if (_dwDisabledISA == 0xffffffff) return 0; 79 | 80 | asm volatile( 81 | "\n\txor %%esi, %%esi" // clear %%esi = result register 82 | // check if 'cpuid' instructions is available by toggling eflags bit 21 83 | 84 | "\n\tpushf" // save eflags to stack 85 | "\n\tmovl (%%esp), %%eax" // load eax from stack (with eflags) 86 | "\n\tmovl %%eax, %%ecx" // save the original eflags values to ecx 87 | "\n\txor $0x00200000, %%eax" // toggle bit 21 88 | "\n\tmovl %%eax, (%%esp)" // store toggled eflags to stack 89 | "\n\tpopf" // load eflags from stack 90 | "\n\tpushf" // save updated eflags to stack 91 | "\n\tmovl (%%esp), %%eax" // load eax from stack 92 | "\n\tpopf" // pop stack to restore esp 93 | "\n\txor %%edx, %%edx" // clear edx for defaulting no mmx 94 | "\n\tcmp %%ecx, %%eax" // compare to original eflags values 95 | "\n\tjz end" // jumps to 'end' if cpuid not present 96 | // cpuid instruction available, test for presence of mmx instructions 97 | 98 | "\n\tmovl $1, %%eax" 99 | "\n\tcpuid" 100 | "\n\ttest $0x00800000, %%edx" 101 | "\n\tjz end" // branch if MMX not available 102 | 103 | "\n\tor $0x01, %%esi" // otherwise add MMX support bit 104 | 105 | "\n\ttest $0x02000000, %%edx" 106 | "\n\tjz test3DNow" // branch if SSE not available 107 | 108 | "\n\tor $0x08, %%esi" // otherwise add SSE support bit 109 | 110 | "\n\ttest3DNow:" 111 | // test for precense of AMD extensions 112 | "\n\tmov $0x80000000, %%eax" 113 | "\n\tcpuid" 114 | "\n\tcmp $0x80000000, %%eax" 115 | "\n\tjbe end" // branch if no AMD extensions detected 116 | 117 | // test for precense of 3DNow! extension 118 | "\n\tmov $0x80000001, %%eax" 119 | "\n\tcpuid" 120 | "\n\ttest $0x80000000, %%edx" 121 | "\n\tjz end" // branch if 3DNow! not detected 122 | 123 | "\n\tor $0x02, %%esi" // otherwise add 3DNow support bit 124 | 125 | "\n\tend:" 126 | 127 | "\n\tmov %%esi, %0" 128 | 129 | : "=r" (res) 130 | : /* no inputs */ 131 | : "%edx", "%eax", "%ecx", "%esi" ); 132 | 133 | return res & ~_dwDisabledISA; 134 | #endif 135 | } 136 | -------------------------------------------------------------------------------- /soundtouch/include/STTypes.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Common type definitions for SoundTouch audio processing library. 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 | // Last changed : $Date: 2009-05-17 14:30:57 +0300 (Sun, 17 May 2009) $ 12 | // File revision : $Revision: 3 $ 13 | // 14 | // $Id: STTypes.h 70 2009-05-17 11:30:57Z oparviai $ 15 | // 16 | //////////////////////////////////////////////////////////////////////////////// 17 | // 18 | // License : 19 | // 20 | // SoundTouch audio processing library 21 | // Copyright (c) Olli Parviainen 22 | // 23 | // This library is free software; you can redistribute it and/or 24 | // modify it under the terms of the GNU Lesser General Public 25 | // License as published by the Free Software Foundation; either 26 | // version 2.1 of the License, or (at your option) any later version. 27 | // 28 | // This library is distributed in the hope that it will be useful, 29 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 31 | // Lesser General Public License for more details. 32 | // 33 | // You should have received a copy of the GNU Lesser General Public 34 | // License along with this library; if not, write to the Free Software 35 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 36 | // 37 | //////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef STTypes_H 40 | #define STTypes_H 41 | 42 | typedef unsigned int uint; 43 | typedef unsigned long ulong; 44 | 45 | #ifdef __GNUC__ 46 | // In GCC, include soundtouch_config.h made by config scritps 47 | #include "soundtouch_config.h" 48 | #endif 49 | 50 | #ifndef _WINDEF_ 51 | // if these aren't defined already by Windows headers, define now 52 | 53 | typedef int BOOL; 54 | 55 | #define FALSE 0 56 | #define TRUE 1 57 | 58 | #endif // _WINDEF_ 59 | 60 | 61 | namespace soundtouch 62 | { 63 | 64 | /// Activate these undef's to overrule the possible sampletype 65 | /// setting inherited from some other header file: 66 | //#undef INTEGER_SAMPLES 67 | //#undef FLOAT_SAMPLES 68 | 69 | #if !(INTEGER_SAMPLES || FLOAT_SAMPLES) 70 | 71 | /// Choose either 32bit floating point or 16bit integer sampletype 72 | /// by choosing one of the following defines, unless this selection 73 | /// has already been done in some other file. 74 | //// 75 | /// Notes: 76 | /// - In Windows environment, choose the sample format with the 77 | /// following defines. 78 | /// - In GNU environment, the floating point samples are used by 79 | /// default, but integer samples can be chosen by giving the 80 | /// following switch to the configure script: 81 | /// ./configure --enable-integer-samples 82 | /// However, if you still prefer to select the sample format here 83 | /// also in GNU environment, then please #undef the INTEGER_SAMPLE 84 | /// and FLOAT_SAMPLE defines first as in comments above. 85 | //#define INTEGER_SAMPLES 1 //< 16bit integer samples 86 | #define FLOAT_SAMPLES 1 //< 32bit float samples 87 | 88 | #endif 89 | 90 | #if (WIN32 || __i386__ || __x86_64__) 91 | /// Define this to allow X86-specific assembler/intrinsic optimizations. 92 | /// Notice that library contains also usual C++ versions of each of these 93 | /// these routines, so if you're having difficulties getting the optimized 94 | /// routines compiled for whatever reason, you may disable these optimizations 95 | /// to make the library compile. 96 | 97 | //#define ALLOW_X86_OPTIMIZATIONS 1 98 | 99 | #endif 100 | 101 | // If defined, allows the SIMD-optimized routines to take minor shortcuts 102 | // for improved performance. Undefine to require faithfully similar SIMD 103 | // calculations as in normal C implementation. 104 | #define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1 105 | 106 | 107 | #ifdef INTEGER_SAMPLES 108 | // 16bit integer sample type 109 | typedef short SAMPLETYPE; 110 | // data type for sample accumulation: Use 32bit integer to prevent overflows 111 | typedef long LONG_SAMPLETYPE; 112 | 113 | #ifdef FLOAT_SAMPLES 114 | // check that only one sample type is defined 115 | #error "conflicting sample types defined" 116 | #endif // FLOAT_SAMPLES 117 | 118 | #ifdef ALLOW_X86_OPTIMIZATIONS 119 | // Allow MMX optimizations 120 | #define ALLOW_MMX 1 121 | #endif 122 | 123 | #else 124 | 125 | // floating point samples 126 | typedef float SAMPLETYPE; 127 | // data type for sample accumulation: Use double to utilize full precision. 128 | typedef double LONG_SAMPLETYPE; 129 | 130 | #ifdef ALLOW_X86_OPTIMIZATIONS 131 | // Allow 3DNow! and SSE optimizations 132 | #if WIN32 133 | #define ALLOW_3DNOW 1 134 | #endif 135 | 136 | #define ALLOW_SSE 1 137 | #endif 138 | 139 | #endif // INTEGER_SAMPLES 140 | }; 141 | 142 | 143 | // When this #define is active, eliminates a clicking sound when the "rate" or "pitch" 144 | // parameter setting crosses from value <1 to >=1 or vice versa during processing. 145 | // Default is off as such crossover is untypical case and involves a slight sound 146 | // quality compromise. 147 | //#define PREVENT_CLICK_AT_RATE_CROSSOVER 1 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/FIRFilter.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// General FIR digital filter routines with MMX optimization. 4 | /// 5 | /// Note : MMX optimized functions reside in a separate, platform-specific file, 6 | /// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' 7 | /// 8 | /// Author : Copyright (c) Olli Parviainen 9 | /// Author e-mail : oparviai 'at' iki.fi 10 | /// SoundTouch WWW: http://www.surina.net/soundtouch 11 | /// 12 | //////////////////////////////////////////////////////////////////////////////// 13 | // 14 | // Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $ 15 | // File revision : $Revision: 4 $ 16 | // 17 | // $Id: FIRFilter.h 63 2009-02-21 16:00:14Z oparviai $ 18 | // 19 | //////////////////////////////////////////////////////////////////////////////// 20 | // 21 | // License : 22 | // 23 | // SoundTouch audio processing library 24 | // Copyright (c) Olli Parviainen 25 | // 26 | // This library is free software; you can redistribute it and/or 27 | // modify it under the terms of the GNU Lesser General Public 28 | // License as published by the Free Software Foundation; either 29 | // version 2.1 of the License, or (at your option) any later version. 30 | // 31 | // This library is distributed in the hope that it will be useful, 32 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | // Lesser General Public License for more details. 35 | // 36 | // You should have received a copy of the GNU Lesser General Public 37 | // License along with this library; if not, write to the Free Software 38 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 39 | // 40 | //////////////////////////////////////////////////////////////////////////////// 41 | 42 | #ifndef FIRFilter_H 43 | #define FIRFilter_H 44 | 45 | #include 46 | #include "STTypes.h" 47 | 48 | namespace soundtouch 49 | { 50 | 51 | class FIRFilter 52 | { 53 | protected: 54 | // Number of FIR filter taps 55 | uint length; 56 | // Number of FIR filter taps divided by 8 57 | uint lengthDiv8; 58 | 59 | // Result divider factor in 2^k format 60 | uint resultDivFactor; 61 | 62 | // Result divider value. 63 | SAMPLETYPE resultDivider; 64 | 65 | // Memory for filter coefficients 66 | SAMPLETYPE *filterCoeffs; 67 | 68 | virtual uint evaluateFilterStereo(SAMPLETYPE *dest, 69 | const SAMPLETYPE *src, 70 | uint numSamples) const; 71 | virtual uint evaluateFilterMono(SAMPLETYPE *dest, 72 | const SAMPLETYPE *src, 73 | uint numSamples) const; 74 | 75 | public: 76 | FIRFilter(); 77 | virtual ~FIRFilter(); 78 | 79 | /// Operator 'new' is overloaded so that it automatically creates a suitable instance 80 | /// depending on if we've a MMX-capable CPU available or not. 81 | static void * operator new(size_t s); 82 | 83 | static FIRFilter *newInstance(); 84 | 85 | /// Applies the filter to the given sequence of samples. 86 | /// Note : The amount of outputted samples is by value of 'filter_length' 87 | /// smaller than the amount of input samples. 88 | /// 89 | /// \return Number of samples copied to 'dest'. 90 | uint evaluate(SAMPLETYPE *dest, 91 | const SAMPLETYPE *src, 92 | uint numSamples, 93 | uint numChannels) const; 94 | 95 | uint getLength() const; 96 | 97 | virtual void setCoefficients(const SAMPLETYPE *coeffs, 98 | uint newLength, 99 | uint uResultDivFactor); 100 | }; 101 | 102 | 103 | // Optional subclasses that implement CPU-specific optimizations: 104 | 105 | #ifdef ALLOW_MMX 106 | 107 | /// Class that implements MMX optimized functions exclusive for 16bit integer samples type. 108 | class FIRFilterMMX : public FIRFilter 109 | { 110 | protected: 111 | short *filterCoeffsUnalign; 112 | short *filterCoeffsAlign; 113 | 114 | virtual uint evaluateFilterStereo(short *dest, const short *src, uint numSamples) const; 115 | public: 116 | FIRFilterMMX(); 117 | ~FIRFilterMMX(); 118 | 119 | virtual void setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor); 120 | }; 121 | 122 | #endif // ALLOW_MMX 123 | 124 | 125 | #ifdef ALLOW_3DNOW 126 | 127 | /// Class that implements 3DNow! optimized functions exclusive for floating point samples type. 128 | class FIRFilter3DNow : public FIRFilter 129 | { 130 | protected: 131 | float *filterCoeffsUnalign; 132 | float *filterCoeffsAlign; 133 | 134 | virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const; 135 | public: 136 | FIRFilter3DNow(); 137 | ~FIRFilter3DNow(); 138 | virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor); 139 | }; 140 | 141 | #endif // ALLOW_3DNOW 142 | 143 | 144 | #ifdef ALLOW_SSE 145 | /// Class that implements SSE optimized functions exclusive for floating point samples type. 146 | class FIRFilterSSE : public FIRFilter 147 | { 148 | protected: 149 | float *filterCoeffsUnalign; 150 | float *filterCoeffsAlign; 151 | 152 | virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const; 153 | public: 154 | FIRFilterSSE(); 155 | ~FIRFilterSSE(); 156 | 157 | virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor); 158 | }; 159 | 160 | #endif // ALLOW_SSE 161 | 162 | } 163 | 164 | #endif // FIRFilter_H 165 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/AAFilter.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// FIR low-pass (anti-alias) filter with filter coefficient design routine and 4 | /// MMX optimization. 5 | /// 6 | /// Anti-alias filter is used to prevent folding of high frequencies when 7 | /// transposing the sample rate with interpolation. 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: 2009-01-11 13:34:24 +0200 (Sun, 11 Jan 2009) $ 16 | // File revision : $Revision: 4 $ 17 | // 18 | // $Id: AAFilter.cpp 45 2009-01-11 11:34:24Z 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 | #include 44 | #include 45 | #include 46 | #include 47 | #include "AAFilter.h" 48 | #include "FIRFilter.h" 49 | 50 | using namespace soundtouch; 51 | 52 | #define PI 3.141592655357989 53 | #define TWOPI (2 * PI) 54 | 55 | /***************************************************************************** 56 | * 57 | * Implementation of the class 'AAFilter' 58 | * 59 | *****************************************************************************/ 60 | 61 | AAFilter::AAFilter(uint len) 62 | { 63 | pFIR = FIRFilter::newInstance(); 64 | cutoffFreq = 0.5; 65 | setLength(len); 66 | } 67 | 68 | 69 | 70 | AAFilter::~AAFilter() 71 | { 72 | delete pFIR; 73 | } 74 | 75 | 76 | 77 | // Sets new anti-alias filter cut-off edge frequency, scaled to 78 | // sampling frequency (nyquist frequency = 0.5). 79 | // The filter will cut frequencies higher than the given frequency. 80 | void AAFilter::setCutoffFreq(double newCutoffFreq) 81 | { 82 | cutoffFreq = newCutoffFreq; 83 | calculateCoeffs(); 84 | } 85 | 86 | 87 | 88 | // Sets number of FIR filter taps 89 | void AAFilter::setLength(uint newLength) 90 | { 91 | length = newLength; 92 | calculateCoeffs(); 93 | } 94 | 95 | 96 | 97 | // Calculates coefficients for a low-pass FIR filter using Hamming window 98 | void AAFilter::calculateCoeffs() 99 | { 100 | uint i; 101 | double cntTemp, temp, tempCoeff,h, w; 102 | double fc2, wc; 103 | double scaleCoeff, sum; 104 | double *work; 105 | SAMPLETYPE *coeffs; 106 | 107 | assert(length >= 2); 108 | assert(length % 4 == 0); 109 | assert(cutoffFreq >= 0); 110 | assert(cutoffFreq <= 0.5); 111 | 112 | work = new double[length]; 113 | coeffs = new SAMPLETYPE[length]; 114 | 115 | fc2 = 2.0 * cutoffFreq; 116 | wc = PI * fc2; 117 | tempCoeff = TWOPI / (double)length; 118 | 119 | sum = 0; 120 | for (i = 0; i < length; i ++) 121 | { 122 | cntTemp = (double)i - (double)(length / 2); 123 | 124 | temp = cntTemp * wc; 125 | if (temp != 0) 126 | { 127 | h = fc2 * sin(temp) / temp; // sinc function 128 | } 129 | else 130 | { 131 | h = 1.0; 132 | } 133 | w = 0.54 + 0.46 * cos(tempCoeff * cntTemp); // hamming window 134 | 135 | temp = w * h; 136 | work[i] = temp; 137 | 138 | // calc net sum of coefficients 139 | sum += temp; 140 | } 141 | 142 | // ensure the sum of coefficients is larger than zero 143 | assert(sum > 0); 144 | 145 | // ensure we've really designed a lowpass filter... 146 | assert(work[length/2] > 0); 147 | assert(work[length/2 + 1] > -1e-6); 148 | assert(work[length/2 - 1] > -1e-6); 149 | 150 | // Calculate a scaling coefficient in such a way that the result can be 151 | // divided by 16384 152 | scaleCoeff = 16384.0f / sum; 153 | 154 | for (i = 0; i < length; i ++) 155 | { 156 | // scale & round to nearest integer 157 | temp = work[i] * scaleCoeff; 158 | temp += (temp >= 0) ? 0.5 : -0.5; 159 | // ensure no overfloods 160 | assert(temp >= -32768 && temp <= 32767); 161 | coeffs[i] = (SAMPLETYPE)temp; 162 | } 163 | 164 | // Set coefficients. Use divide factor 14 => divide result by 2^14 = 16384 165 | pFIR->setCoefficients(coeffs, length, 14); 166 | 167 | delete[] work; 168 | delete[] coeffs; 169 | } 170 | 171 | 172 | // Applies the filter to the given sequence of samples. 173 | // Note : The amount of outputted samples is by value of 'filter length' 174 | // smaller than the amount of input samples. 175 | uint AAFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples, uint numChannels) const 176 | { 177 | return pFIR->evaluate(dest, src, numSamples, numChannels); 178 | } 179 | 180 | 181 | uint AAFilter::getLength() const 182 | { 183 | return pFIR->getLength(); 184 | } 185 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/RateTransposer.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Sample rate transposer. Changes sample rate by using linear interpolation 4 | /// together with anti-alias filtering (first order interpolation with anti- 5 | /// alias filtering should be quite adequate for this application). 6 | /// 7 | /// Use either of the derived classes of 'RateTransposerInteger' or 8 | /// 'RateTransposerFloat' for corresponding integer/floating point tranposing 9 | /// algorithm implementation. 10 | /// 11 | /// Author : Copyright (c) Olli Parviainen 12 | /// Author e-mail : oparviai 'at' iki.fi 13 | /// SoundTouch WWW: http://www.surina.net/soundtouch 14 | /// 15 | //////////////////////////////////////////////////////////////////////////////// 16 | // 17 | // Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $ 18 | // File revision : $Revision: 4 $ 19 | // 20 | // $Id: RateTransposer.h 63 2009-02-21 16:00:14Z oparviai $ 21 | // 22 | //////////////////////////////////////////////////////////////////////////////// 23 | // 24 | // License : 25 | // 26 | // SoundTouch audio processing library 27 | // Copyright (c) Olli Parviainen 28 | // 29 | // This library is free software; you can redistribute it and/or 30 | // modify it under the terms of the GNU Lesser General Public 31 | // License as published by the Free Software Foundation; either 32 | // version 2.1 of the License, or (at your option) any later version. 33 | // 34 | // This library is distributed in the hope that it will be useful, 35 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 37 | // Lesser General Public License for more details. 38 | // 39 | // You should have received a copy of the GNU Lesser General Public 40 | // License along with this library; if not, write to the Free Software 41 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 42 | // 43 | //////////////////////////////////////////////////////////////////////////////// 44 | 45 | #ifndef RateTransposer_H 46 | #define RateTransposer_H 47 | 48 | #include 49 | #include "AAFilter.h" 50 | #include "FIFOSamplePipe.h" 51 | #include "FIFOSampleBuffer.h" 52 | 53 | #include "STTypes.h" 54 | 55 | namespace soundtouch 56 | { 57 | 58 | /// A common linear samplerate transposer class. 59 | /// 60 | /// Note: Use function "RateTransposer::newInstance()" to create a new class 61 | /// instance instead of the "new" operator; that function automatically 62 | /// chooses a correct implementation depending on if integer or floating 63 | /// arithmetics are to be used. 64 | class RateTransposer : public FIFOProcessor 65 | { 66 | protected: 67 | /// Anti-alias filter object 68 | AAFilter *pAAFilter; 69 | 70 | float fRate; 71 | 72 | int numChannels; 73 | 74 | /// Buffer for collecting samples to feed the anti-alias filter between 75 | /// two batches 76 | FIFOSampleBuffer storeBuffer; 77 | 78 | /// Buffer for keeping samples between transposing & anti-alias filter 79 | FIFOSampleBuffer tempBuffer; 80 | 81 | /// Output sample buffer 82 | FIFOSampleBuffer outputBuffer; 83 | 84 | BOOL bUseAAFilter; 85 | 86 | virtual void resetRegisters() = 0; 87 | 88 | virtual uint transposeStereo(SAMPLETYPE *dest, 89 | const SAMPLETYPE *src, 90 | uint numSamples) = 0; 91 | virtual uint transposeMono(SAMPLETYPE *dest, 92 | const SAMPLETYPE *src, 93 | uint numSamples) = 0; 94 | inline uint transpose(SAMPLETYPE *dest, 95 | const SAMPLETYPE *src, 96 | uint numSamples); 97 | 98 | void downsample(const SAMPLETYPE *src, 99 | uint numSamples); 100 | void upsample(const SAMPLETYPE *src, 101 | uint numSamples); 102 | 103 | /// Transposes sample rate by applying anti-alias filter to prevent folding. 104 | /// Returns amount of samples returned in the "dest" buffer. 105 | /// The maximum amount of samples that can be returned at a time is set by 106 | /// the 'set_returnBuffer_size' function. 107 | void processSamples(const SAMPLETYPE *src, 108 | uint numSamples); 109 | 110 | 111 | public: 112 | RateTransposer(); 113 | virtual ~RateTransposer(); 114 | 115 | /// Operator 'new' is overloaded so that it automatically creates a suitable instance 116 | /// depending on if we're to use integer or floating point arithmetics. 117 | static void *operator new(size_t s); 118 | 119 | /// Use this function instead of "new" operator to create a new instance of this class. 120 | /// This function automatically chooses a correct implementation, depending on if 121 | /// integer ot floating point arithmetics are to be used. 122 | static RateTransposer *newInstance(); 123 | 124 | /// Returns the output buffer object 125 | FIFOSamplePipe *getOutput() { return &outputBuffer; }; 126 | 127 | /// Returns the store buffer object 128 | FIFOSamplePipe *getStore() { return &storeBuffer; }; 129 | 130 | /// Return anti-alias filter object 131 | AAFilter *getAAFilter(); 132 | 133 | /// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable 134 | void enableAAFilter(BOOL newMode); 135 | 136 | /// Returns nonzero if anti-alias filter is enabled. 137 | BOOL isAAFilterEnabled() const; 138 | 139 | /// Sets new target rate. Normal rate = 1.0, smaller values represent slower 140 | /// rate, larger faster rates. 141 | virtual void setRate(float newRate); 142 | 143 | /// Sets the number of channels, 1 = mono, 2 = stereo 144 | void setChannels(int channels); 145 | 146 | /// Adds 'numSamples' pcs of samples from the 'samples' memory position into 147 | /// the input of the object. 148 | void putSamples(const SAMPLETYPE *samples, uint numSamples); 149 | 150 | /// Clears all the samples in the object 151 | void clear(); 152 | 153 | /// Returns nonzero if there aren't any samples available for outputting. 154 | int isEmpty() const; 155 | }; 156 | 157 | } 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /soundtouch/include/BPMDetect.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Beats-per-minute (BPM) detection routine. 4 | /// 5 | /// The beat detection algorithm works as follows: 6 | /// - Use function 'inputSamples' to input a chunks of samples to the class for 7 | /// analysis. It's a good idea to enter a large sound file or stream in smallish 8 | /// chunks of around few kilosamples in order not to extinguish too much RAM memory. 9 | /// - Input sound data is decimated to approx 500 Hz to reduce calculation burden, 10 | /// which is basically ok as low (bass) frequencies mostly determine the beat rate. 11 | /// Simple averaging is used for anti-alias filtering because the resulting signal 12 | /// quality isn't of that high importance. 13 | /// - Decimated sound data is enveloped, i.e. the amplitude shape is detected by 14 | /// taking absolute value that's smoothed by sliding average. Signal levels that 15 | /// are below a couple of times the general RMS amplitude level are cut away to 16 | /// leave only notable peaks there. 17 | /// - Repeating sound patterns (e.g. beats) are detected by calculating short-term 18 | /// autocorrelation function of the enveloped signal. 19 | /// - After whole sound data file has been analyzed as above, the bpm level is 20 | /// detected by function 'getBpm' that finds the highest peak of the autocorrelation 21 | /// function, calculates it's precise location and converts this reading to bpm's. 22 | /// 23 | /// Author : Copyright (c) Olli Parviainen 24 | /// Author e-mail : oparviai 'at' iki.fi 25 | /// SoundTouch WWW: http://www.surina.net/soundtouch 26 | /// 27 | //////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $ 30 | // File revision : $Revision: 4 $ 31 | // 32 | // $Id: BPMDetect.h 63 2009-02-21 16:00:14Z oparviai $ 33 | // 34 | //////////////////////////////////////////////////////////////////////////////// 35 | // 36 | // License : 37 | // 38 | // SoundTouch audio processing library 39 | // Copyright (c) Olli Parviainen 40 | // 41 | // This library is free software; you can redistribute it and/or 42 | // modify it under the terms of the GNU Lesser General Public 43 | // License as published by the Free Software Foundation; either 44 | // version 2.1 of the License, or (at your option) any later version. 45 | // 46 | // This library is distributed in the hope that it will be useful, 47 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 48 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 49 | // Lesser General Public License for more details. 50 | // 51 | // You should have received a copy of the GNU Lesser General Public 52 | // License along with this library; if not, write to the Free Software 53 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 54 | // 55 | //////////////////////////////////////////////////////////////////////////////// 56 | 57 | #ifndef _BPMDetect_H_ 58 | #define _BPMDetect_H_ 59 | 60 | #include "STTypes.h" 61 | #include "FIFOSampleBuffer.h" 62 | 63 | namespace soundtouch 64 | { 65 | 66 | /// Minimum allowed BPM rate. Used to restrict accepted result above a reasonable limit. 67 | #define MIN_BPM 29 68 | 69 | /// Maximum allowed BPM rate. Used to restrict accepted result below a reasonable limit. 70 | #define MAX_BPM 230 71 | 72 | 73 | /// Class for calculating BPM rate for audio data. 74 | class BPMDetect 75 | { 76 | protected: 77 | /// Auto-correlation accumulator bins. 78 | float *xcorr; 79 | 80 | /// Amplitude envelope sliding average approximation level accumulator 81 | float envelopeAccu; 82 | 83 | /// RMS volume sliding average approximation level accumulator 84 | float RMSVolumeAccu; 85 | 86 | /// Sample average counter. 87 | int decimateCount; 88 | 89 | /// Sample average accumulator for FIFO-like decimation. 90 | soundtouch::LONG_SAMPLETYPE decimateSum; 91 | 92 | /// Decimate sound by this coefficient to reach approx. 500 Hz. 93 | int decimateBy; 94 | 95 | /// Auto-correlation window length 96 | int windowLen; 97 | 98 | /// Number of channels (1 = mono, 2 = stereo) 99 | int channels; 100 | 101 | /// sample rate 102 | int sampleRate; 103 | 104 | /// Beginning of auto-correlation window: Autocorrelation isn't being updated for 105 | /// the first these many correlation bins. 106 | int windowStart; 107 | 108 | /// FIFO-buffer for decimated processing samples. 109 | soundtouch::FIFOSampleBuffer *buffer; 110 | 111 | /// Updates auto-correlation function for given number of decimated samples that 112 | /// are read from the internal 'buffer' pipe (samples aren't removed from the pipe 113 | /// though). 114 | void updateXCorr(int process_samples /// How many samples are processed. 115 | ); 116 | 117 | /// Decimates samples to approx. 500 Hz. 118 | /// 119 | /// \return Number of output samples. 120 | int decimate(soundtouch::SAMPLETYPE *dest, ///< Destination buffer 121 | const soundtouch::SAMPLETYPE *src, ///< Source sample buffer 122 | int numsamples ///< Number of source samples. 123 | ); 124 | 125 | /// Calculates amplitude envelope for the buffer of samples. 126 | /// Result is output to 'samples'. 127 | void calcEnvelope(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/output data buffer 128 | int numsamples ///< Number of samples in buffer 129 | ); 130 | 131 | public: 132 | /// Constructor. 133 | BPMDetect(int numChannels, ///< Number of channels in sample data. 134 | int sampleRate ///< Sample rate in Hz. 135 | ); 136 | 137 | /// Destructor. 138 | virtual ~BPMDetect(); 139 | 140 | /// Inputs a block of samples for analyzing: Envelopes the samples and then 141 | /// updates the autocorrelation estimation. When whole song data has been input 142 | /// in smaller blocks using this function, read the resulting bpm with 'getBpm' 143 | /// function. 144 | /// 145 | /// Notice that data in 'samples' array can be disrupted in processing. 146 | void inputSamples(const soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer 147 | int numSamples ///< Number of samples in buffer 148 | ); 149 | 150 | 151 | /// Analyzes the results and returns the BPM rate. Use this function to read result 152 | /// after whole song data has been input to the class by consecutive calls of 153 | /// 'inputSamples' function. 154 | /// 155 | /// \return Beats-per-minute rate, or zero if detection failed. 156 | float getBpm(); 157 | }; 158 | 159 | } 160 | 161 | #endif // _BPMDetect_H_ 162 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/soundstretch.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 21 | 38 | 40 | 54 | 58 | 61 | 63 | 65 | 69 | 71 | 73 | 75 | 77 | 79 | 80 | 88 | 105 | 107 | 119 | 123 | 126 | 128 | 130 | 134 | 136 | 138 | 140 | 142 | 144 | 145 | 146 | 147 | 148 | 149 | 152 | 154 | 156 | 163 | 164 | 166 | 171 | 172 | 173 | 175 | 177 | 184 | 185 | 187 | 192 | 193 | 194 | 196 | 198 | 205 | 206 | 208 | 213 | 214 | 215 | 216 | 219 | 221 | 222 | 224 | 225 | 226 | 229 | 230 | 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /soundtouch/source/SoundStretch/.deps/soundstretch-RunParameters.Po: -------------------------------------------------------------------------------- 1 | soundstretch-RunParameters.o: RunParameters.cpp \ 2 | /usr/include/c++/4.4/stdexcept /usr/include/c++/4.4/exception \ 3 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h \ 4 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h \ 5 | /usr/include/features.h /usr/include/bits/predefs.h \ 6 | /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 7 | /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ 8 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h \ 9 | /usr/include/c++/4.4/string /usr/include/c++/4.4/bits/stringfwd.h \ 10 | /usr/include/c++/4.4/bits/char_traits.h \ 11 | /usr/include/c++/4.4/bits/stl_algobase.h /usr/include/c++/4.4/cstddef \ 12 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h \ 13 | /usr/include/c++/4.4/bits/functexcept.h \ 14 | /usr/include/c++/4.4/exception_defines.h \ 15 | /usr/include/c++/4.4/bits/cpp_type_traits.h \ 16 | /usr/include/c++/4.4/ext/type_traits.h \ 17 | /usr/include/c++/4.4/ext/numeric_traits.h \ 18 | /usr/include/c++/4.4/bits/stl_pair.h /usr/include/c++/4.4/bits/move.h \ 19 | /usr/include/c++/4.4/bits/concept_check.h \ 20 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h \ 21 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h \ 22 | /usr/include/c++/4.4/bits/stl_iterator.h \ 23 | /usr/include/c++/4.4/debug/debug.h /usr/include/c++/4.4/bits/postypes.h \ 24 | /usr/include/c++/4.4/cwchar /usr/include/wchar.h /usr/include/stdio.h \ 25 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h \ 26 | /usr/include/bits/wchar.h /usr/include/xlocale.h \ 27 | /usr/include/c++/4.4/bits/allocator.h \ 28 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h \ 29 | /usr/include/c++/4.4/ext/new_allocator.h /usr/include/c++/4.4/new \ 30 | /usr/include/c++/4.4/bits/localefwd.h \ 31 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h \ 32 | /usr/include/c++/4.4/clocale /usr/include/locale.h \ 33 | /usr/include/bits/locale.h /usr/include/c++/4.4/iosfwd \ 34 | /usr/include/c++/4.4/cctype /usr/include/ctype.h \ 35 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 36 | /usr/include/endian.h /usr/include/bits/endian.h \ 37 | /usr/include/bits/byteswap.h /usr/include/c++/4.4/bits/ostream_insert.h \ 38 | /usr/include/c++/4.4/cxxabi-forced.h \ 39 | /usr/include/c++/4.4/bits/stl_function.h \ 40 | /usr/include/c++/4.4/backward/binders.h \ 41 | /usr/include/c++/4.4/bits/basic_string.h \ 42 | /usr/include/c++/4.4/ext/atomicity.h \ 43 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h \ 44 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h \ 45 | /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ 46 | /usr/include/bits/sched.h /usr/include/bits/time.h /usr/include/signal.h \ 47 | /usr/include/bits/sigset.h /usr/include/bits/pthreadtypes.h \ 48 | /usr/include/bits/setjmp.h /usr/include/unistd.h \ 49 | /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ 50 | /usr/include/bits/confname.h /usr/include/getopt.h \ 51 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h \ 52 | /usr/include/c++/4.4/initializer_list \ 53 | /usr/include/c++/4.4/bits/basic_string.tcc /usr/include/stdlib.h \ 54 | /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ 55 | /usr/include/sys/types.h /usr/include/sys/select.h \ 56 | /usr/include/bits/select.h /usr/include/sys/sysmacros.h \ 57 | /usr/include/alloca.h RunParameters.h ../../include/STTypes.h \ 58 | ../../include/soundtouch_config.h 59 | 60 | /usr/include/c++/4.4/stdexcept: 61 | 62 | /usr/include/c++/4.4/exception: 63 | 64 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h: 65 | 66 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h: 67 | 68 | /usr/include/features.h: 69 | 70 | /usr/include/bits/predefs.h: 71 | 72 | /usr/include/sys/cdefs.h: 73 | 74 | /usr/include/bits/wordsize.h: 75 | 76 | /usr/include/gnu/stubs.h: 77 | 78 | /usr/include/gnu/stubs-64.h: 79 | 80 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h: 81 | 82 | /usr/include/c++/4.4/string: 83 | 84 | /usr/include/c++/4.4/bits/stringfwd.h: 85 | 86 | /usr/include/c++/4.4/bits/char_traits.h: 87 | 88 | /usr/include/c++/4.4/bits/stl_algobase.h: 89 | 90 | /usr/include/c++/4.4/cstddef: 91 | 92 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h: 93 | 94 | /usr/include/c++/4.4/bits/functexcept.h: 95 | 96 | /usr/include/c++/4.4/exception_defines.h: 97 | 98 | /usr/include/c++/4.4/bits/cpp_type_traits.h: 99 | 100 | /usr/include/c++/4.4/ext/type_traits.h: 101 | 102 | /usr/include/c++/4.4/ext/numeric_traits.h: 103 | 104 | /usr/include/c++/4.4/bits/stl_pair.h: 105 | 106 | /usr/include/c++/4.4/bits/move.h: 107 | 108 | /usr/include/c++/4.4/bits/concept_check.h: 109 | 110 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h: 111 | 112 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h: 113 | 114 | /usr/include/c++/4.4/bits/stl_iterator.h: 115 | 116 | /usr/include/c++/4.4/debug/debug.h: 117 | 118 | /usr/include/c++/4.4/bits/postypes.h: 119 | 120 | /usr/include/c++/4.4/cwchar: 121 | 122 | /usr/include/wchar.h: 123 | 124 | /usr/include/stdio.h: 125 | 126 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h: 127 | 128 | /usr/include/bits/wchar.h: 129 | 130 | /usr/include/xlocale.h: 131 | 132 | /usr/include/c++/4.4/bits/allocator.h: 133 | 134 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h: 135 | 136 | /usr/include/c++/4.4/ext/new_allocator.h: 137 | 138 | /usr/include/c++/4.4/new: 139 | 140 | /usr/include/c++/4.4/bits/localefwd.h: 141 | 142 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h: 143 | 144 | /usr/include/c++/4.4/clocale: 145 | 146 | /usr/include/locale.h: 147 | 148 | /usr/include/bits/locale.h: 149 | 150 | /usr/include/c++/4.4/iosfwd: 151 | 152 | /usr/include/c++/4.4/cctype: 153 | 154 | /usr/include/ctype.h: 155 | 156 | /usr/include/bits/types.h: 157 | 158 | /usr/include/bits/typesizes.h: 159 | 160 | /usr/include/endian.h: 161 | 162 | /usr/include/bits/endian.h: 163 | 164 | /usr/include/bits/byteswap.h: 165 | 166 | /usr/include/c++/4.4/bits/ostream_insert.h: 167 | 168 | /usr/include/c++/4.4/cxxabi-forced.h: 169 | 170 | /usr/include/c++/4.4/bits/stl_function.h: 171 | 172 | /usr/include/c++/4.4/backward/binders.h: 173 | 174 | /usr/include/c++/4.4/bits/basic_string.h: 175 | 176 | /usr/include/c++/4.4/ext/atomicity.h: 177 | 178 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h: 179 | 180 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h: 181 | 182 | /usr/include/pthread.h: 183 | 184 | /usr/include/sched.h: 185 | 186 | /usr/include/time.h: 187 | 188 | /usr/include/bits/sched.h: 189 | 190 | /usr/include/bits/time.h: 191 | 192 | /usr/include/signal.h: 193 | 194 | /usr/include/bits/sigset.h: 195 | 196 | /usr/include/bits/pthreadtypes.h: 197 | 198 | /usr/include/bits/setjmp.h: 199 | 200 | /usr/include/unistd.h: 201 | 202 | /usr/include/bits/posix_opt.h: 203 | 204 | /usr/include/bits/environments.h: 205 | 206 | /usr/include/bits/confname.h: 207 | 208 | /usr/include/getopt.h: 209 | 210 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h: 211 | 212 | /usr/include/c++/4.4/initializer_list: 213 | 214 | /usr/include/c++/4.4/bits/basic_string.tcc: 215 | 216 | /usr/include/stdlib.h: 217 | 218 | /usr/include/bits/waitflags.h: 219 | 220 | /usr/include/bits/waitstatus.h: 221 | 222 | /usr/include/sys/types.h: 223 | 224 | /usr/include/sys/select.h: 225 | 226 | /usr/include/bits/select.h: 227 | 228 | /usr/include/sys/sysmacros.h: 229 | 230 | /usr/include/alloca.h: 231 | 232 | RunParameters.h: 233 | 234 | ../../include/STTypes.h: 235 | 236 | ../../include/soundtouch_config.h: 237 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouchDLL/SoundTouchDLL.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// SoundTouch DLL wrapper - wraps SoundTouch routines into a Dynamic Load 4 | /// Library interface. 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 | // $Id: SoundTouchDLL.h 65 2009-02-23 08:33:13Z oparviai $ 13 | // 14 | //////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // License : 17 | // 18 | // SoundTouch audio processing library 19 | // Copyright (c) Olli Parviainen 20 | // 21 | // This library is free software; you can redistribute it and/or 22 | // modify it under the terms of the GNU Lesser General Public 23 | // License as published by the Free Software Foundation; either 24 | // version 2.1 of the License, or (at your option) any later version. 25 | // 26 | // This library is distributed in the hope that it will be useful, 27 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | // Lesser General Public License for more details. 30 | // 31 | // You should have received a copy of the GNU Lesser General Public 32 | // License along with this library; if not, write to the Free Software 33 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 34 | // 35 | //////////////////////////////////////////////////////////////////////////////// 36 | 37 | #ifndef _SoundTouchDLL_h_ 38 | #define _SoundTouchDLL_h_ 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | #ifdef DLL_EXPORTS 45 | #define SOUNDTOUCHDLL_API __declspec(dllexport) 46 | #else 47 | #define SOUNDTOUCHDLL_API __declspec(dllimport) 48 | #endif 49 | 50 | typedef void * HANDLE; 51 | 52 | /// Create a new instance of SoundTouch processor. 53 | SOUNDTOUCHDLL_API HANDLE __stdcall soundtouch_createInstance(); 54 | 55 | /// Destroys a SoundTouch processor instance. 56 | SOUNDTOUCHDLL_API void __stdcall soundtouch_destroyInstance(HANDLE h); 57 | 58 | /// Get SoundTouch library version string 59 | SOUNDTOUCHDLL_API const char *__stdcall soundtouch_getVersionString(); 60 | 61 | /// Get SoundTouch library version Id 62 | SOUNDTOUCHDLL_API unsigned int __stdcall soundtouch_getVersionId(); 63 | 64 | /// Sets new rate control value. Normal rate = 1.0, smaller values 65 | /// represent slower rate, larger faster rates. 66 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setRate(HANDLE h, float newRate); 67 | 68 | /// Sets new tempo control value. Normal tempo = 1.0, smaller values 69 | /// represent slower tempo, larger faster tempo. 70 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setTempo(HANDLE h, float newTempo); 71 | 72 | /// Sets new rate control value as a difference in percents compared 73 | /// to the original rate (-50 .. +100 %); 74 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setRateChange(HANDLE h, float newRate); 75 | 76 | /// Sets new tempo control value as a difference in percents compared 77 | /// to the original tempo (-50 .. +100 %); 78 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setTempoChange(HANDLE h, float newTempo); 79 | 80 | /// Sets new pitch control value. Original pitch = 1.0, smaller values 81 | /// represent lower pitches, larger values higher pitch. 82 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitch(HANDLE h, float newPitch); 83 | 84 | /// Sets pitch change in octaves compared to the original pitch 85 | /// (-1.00 .. +1.00); 86 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitchOctaves(HANDLE h, float newPitch); 87 | 88 | /// Sets pitch change in semi-tones compared to the original pitch 89 | /// (-12 .. +12); 90 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitchSemiTones(HANDLE h, float newPitch); 91 | 92 | 93 | /// Sets the number of channels, 1 = mono, 2 = stereo 94 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setChannels(HANDLE h, unsigned int numChannels); 95 | 96 | /// Sets sample rate. 97 | SOUNDTOUCHDLL_API void __stdcall soundtouch_setSampleRate(HANDLE h, unsigned int srate); 98 | 99 | /// Flushes the last samples from the processing pipeline to the output. 100 | /// Clears also the internal processing buffers. 101 | // 102 | /// Note: This function is meant for extracting the last samples of a sound 103 | /// stream. This function may introduce additional blank samples in the end 104 | /// of the sound stream, and thus it's not recommended to call this function 105 | /// in the middle of a sound stream. 106 | SOUNDTOUCHDLL_API void __stdcall soundtouch_flush(HANDLE h); 107 | 108 | /// Adds 'numSamples' pcs of samples from the 'samples' memory position into 109 | /// the input of the object. Notice that sample rate _has_to_ be set before 110 | /// calling this function, otherwise throws a runtime_error exception. 111 | SOUNDTOUCHDLL_API void __stdcall soundtouch_putSamples(HANDLE h, 112 | const float *samples, ///< Pointer to sample buffer. 113 | unsigned int numSamples ///< Number of samples in buffer. Notice 114 | ///< that in case of stereo-sound a single sample 115 | ///< contains data for both channels. 116 | ); 117 | 118 | /// Clears all the samples in the object's output and internal processing 119 | /// buffers. 120 | SOUNDTOUCHDLL_API void __stdcall soundtouch_clear(HANDLE h); 121 | 122 | /// Changes a setting controlling the processing system behaviour. See the 123 | /// 'SETTING_...' defines for available setting ID's. 124 | /// 125 | /// \return 'TRUE' if the setting was succesfully changed 126 | SOUNDTOUCHDLL_API BOOL __stdcall soundtouch_setSetting(HANDLE h, 127 | int settingId, ///< Setting ID number. see SETTING_... defines. 128 | int value ///< New setting value. 129 | ); 130 | 131 | /// Reads a setting controlling the processing system behaviour. See the 132 | /// 'SETTING_...' defines for available setting ID's. 133 | /// 134 | /// \return the setting value. 135 | SOUNDTOUCHDLL_API int __stdcall soundtouch_getSetting(HANDLE h, 136 | int settingId ///< Setting ID number, see SETTING_... defines. 137 | ); 138 | 139 | 140 | /// Returns number of samples currently unprocessed. 141 | SOUNDTOUCHDLL_API unsigned int __stdcall soundtouch_numUnprocessedSamples(HANDLE h); 142 | 143 | /// Adjusts book-keeping so that given number of samples are removed from beginning of the 144 | /// sample buffer without copying them anywhere. 145 | /// 146 | /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly 147 | /// with 'ptrBegin' function. 148 | SOUNDTOUCHDLL_API unsigned int __stdcall soundtouch_receiveSamples(HANDLE h, 149 | float *outBuffer, ///< Buffer where to copy output samples. 150 | unsigned int maxSamples ///< How many samples to receive at max. 151 | ); 152 | 153 | /// Returns number of samples currently available. 154 | SOUNDTOUCHDLL_API unsigned int __stdcall soundtouch_numSamples(HANDLE h); 155 | 156 | /// Returns nonzero if there aren't any samples available for outputting. 157 | SOUNDTOUCHDLL_API int __stdcall soundtouch_isEmpty(HANDLE h); 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #endif // _SoundTouchDLL_h_ 164 | 165 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/FIFOSampleBuffer.Plo: -------------------------------------------------------------------------------- 1 | FIFOSampleBuffer.lo: FIFOSampleBuffer.cpp /usr/include/stdlib.h \ 2 | /usr/include/features.h /usr/include/bits/predefs.h \ 3 | /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 4 | /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ 5 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h \ 6 | /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ 7 | /usr/include/endian.h /usr/include/bits/endian.h \ 8 | /usr/include/bits/byteswap.h /usr/include/xlocale.h \ 9 | /usr/include/sys/types.h /usr/include/bits/types.h \ 10 | /usr/include/bits/typesizes.h /usr/include/time.h \ 11 | /usr/include/sys/select.h /usr/include/bits/select.h \ 12 | /usr/include/bits/sigset.h /usr/include/bits/time.h \ 13 | /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ 14 | /usr/include/alloca.h /usr/include/memory.h /usr/include/string.h \ 15 | /usr/include/assert.h /usr/include/c++/4.4/stdexcept \ 16 | /usr/include/c++/4.4/exception \ 17 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h \ 18 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h \ 19 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h \ 20 | /usr/include/c++/4.4/string /usr/include/c++/4.4/bits/stringfwd.h \ 21 | /usr/include/c++/4.4/bits/char_traits.h \ 22 | /usr/include/c++/4.4/bits/stl_algobase.h /usr/include/c++/4.4/cstddef \ 23 | /usr/include/c++/4.4/bits/functexcept.h \ 24 | /usr/include/c++/4.4/exception_defines.h \ 25 | /usr/include/c++/4.4/bits/cpp_type_traits.h \ 26 | /usr/include/c++/4.4/ext/type_traits.h \ 27 | /usr/include/c++/4.4/ext/numeric_traits.h \ 28 | /usr/include/c++/4.4/bits/stl_pair.h /usr/include/c++/4.4/bits/move.h \ 29 | /usr/include/c++/4.4/bits/concept_check.h \ 30 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h \ 31 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h \ 32 | /usr/include/c++/4.4/bits/stl_iterator.h \ 33 | /usr/include/c++/4.4/debug/debug.h /usr/include/c++/4.4/bits/postypes.h \ 34 | /usr/include/c++/4.4/cwchar /usr/include/wchar.h /usr/include/stdio.h \ 35 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h \ 36 | /usr/include/bits/wchar.h /usr/include/c++/4.4/bits/allocator.h \ 37 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h \ 38 | /usr/include/c++/4.4/ext/new_allocator.h /usr/include/c++/4.4/new \ 39 | /usr/include/c++/4.4/bits/localefwd.h \ 40 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h \ 41 | /usr/include/c++/4.4/clocale /usr/include/locale.h \ 42 | /usr/include/bits/locale.h /usr/include/c++/4.4/iosfwd \ 43 | /usr/include/c++/4.4/cctype /usr/include/ctype.h \ 44 | /usr/include/c++/4.4/bits/ostream_insert.h \ 45 | /usr/include/c++/4.4/cxxabi-forced.h \ 46 | /usr/include/c++/4.4/bits/stl_function.h \ 47 | /usr/include/c++/4.4/backward/binders.h \ 48 | /usr/include/c++/4.4/bits/basic_string.h \ 49 | /usr/include/c++/4.4/ext/atomicity.h \ 50 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h \ 51 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h \ 52 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 53 | /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ 54 | /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ 55 | /usr/include/bits/confname.h /usr/include/getopt.h \ 56 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h \ 57 | /usr/include/c++/4.4/initializer_list \ 58 | /usr/include/c++/4.4/bits/basic_string.tcc \ 59 | ../../include/FIFOSampleBuffer.h ../../include/FIFOSamplePipe.h \ 60 | ../../include/STTypes.h ../../include/soundtouch_config.h 61 | 62 | /usr/include/stdlib.h: 63 | 64 | /usr/include/features.h: 65 | 66 | /usr/include/bits/predefs.h: 67 | 68 | /usr/include/sys/cdefs.h: 69 | 70 | /usr/include/bits/wordsize.h: 71 | 72 | /usr/include/gnu/stubs.h: 73 | 74 | /usr/include/gnu/stubs-64.h: 75 | 76 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h: 77 | 78 | /usr/include/bits/waitflags.h: 79 | 80 | /usr/include/bits/waitstatus.h: 81 | 82 | /usr/include/endian.h: 83 | 84 | /usr/include/bits/endian.h: 85 | 86 | /usr/include/bits/byteswap.h: 87 | 88 | /usr/include/xlocale.h: 89 | 90 | /usr/include/sys/types.h: 91 | 92 | /usr/include/bits/types.h: 93 | 94 | /usr/include/bits/typesizes.h: 95 | 96 | /usr/include/time.h: 97 | 98 | /usr/include/sys/select.h: 99 | 100 | /usr/include/bits/select.h: 101 | 102 | /usr/include/bits/sigset.h: 103 | 104 | /usr/include/bits/time.h: 105 | 106 | /usr/include/sys/sysmacros.h: 107 | 108 | /usr/include/bits/pthreadtypes.h: 109 | 110 | /usr/include/alloca.h: 111 | 112 | /usr/include/memory.h: 113 | 114 | /usr/include/string.h: 115 | 116 | /usr/include/assert.h: 117 | 118 | /usr/include/c++/4.4/stdexcept: 119 | 120 | /usr/include/c++/4.4/exception: 121 | 122 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h: 123 | 124 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h: 125 | 126 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h: 127 | 128 | /usr/include/c++/4.4/string: 129 | 130 | /usr/include/c++/4.4/bits/stringfwd.h: 131 | 132 | /usr/include/c++/4.4/bits/char_traits.h: 133 | 134 | /usr/include/c++/4.4/bits/stl_algobase.h: 135 | 136 | /usr/include/c++/4.4/cstddef: 137 | 138 | /usr/include/c++/4.4/bits/functexcept.h: 139 | 140 | /usr/include/c++/4.4/exception_defines.h: 141 | 142 | /usr/include/c++/4.4/bits/cpp_type_traits.h: 143 | 144 | /usr/include/c++/4.4/ext/type_traits.h: 145 | 146 | /usr/include/c++/4.4/ext/numeric_traits.h: 147 | 148 | /usr/include/c++/4.4/bits/stl_pair.h: 149 | 150 | /usr/include/c++/4.4/bits/move.h: 151 | 152 | /usr/include/c++/4.4/bits/concept_check.h: 153 | 154 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h: 155 | 156 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h: 157 | 158 | /usr/include/c++/4.4/bits/stl_iterator.h: 159 | 160 | /usr/include/c++/4.4/debug/debug.h: 161 | 162 | /usr/include/c++/4.4/bits/postypes.h: 163 | 164 | /usr/include/c++/4.4/cwchar: 165 | 166 | /usr/include/wchar.h: 167 | 168 | /usr/include/stdio.h: 169 | 170 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h: 171 | 172 | /usr/include/bits/wchar.h: 173 | 174 | /usr/include/c++/4.4/bits/allocator.h: 175 | 176 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h: 177 | 178 | /usr/include/c++/4.4/ext/new_allocator.h: 179 | 180 | /usr/include/c++/4.4/new: 181 | 182 | /usr/include/c++/4.4/bits/localefwd.h: 183 | 184 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h: 185 | 186 | /usr/include/c++/4.4/clocale: 187 | 188 | /usr/include/locale.h: 189 | 190 | /usr/include/bits/locale.h: 191 | 192 | /usr/include/c++/4.4/iosfwd: 193 | 194 | /usr/include/c++/4.4/cctype: 195 | 196 | /usr/include/ctype.h: 197 | 198 | /usr/include/c++/4.4/bits/ostream_insert.h: 199 | 200 | /usr/include/c++/4.4/cxxabi-forced.h: 201 | 202 | /usr/include/c++/4.4/bits/stl_function.h: 203 | 204 | /usr/include/c++/4.4/backward/binders.h: 205 | 206 | /usr/include/c++/4.4/bits/basic_string.h: 207 | 208 | /usr/include/c++/4.4/ext/atomicity.h: 209 | 210 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h: 211 | 212 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h: 213 | 214 | /usr/include/pthread.h: 215 | 216 | /usr/include/sched.h: 217 | 218 | /usr/include/bits/sched.h: 219 | 220 | /usr/include/signal.h: 221 | 222 | /usr/include/bits/setjmp.h: 223 | 224 | /usr/include/unistd.h: 225 | 226 | /usr/include/bits/posix_opt.h: 227 | 228 | /usr/include/bits/environments.h: 229 | 230 | /usr/include/bits/confname.h: 231 | 232 | /usr/include/getopt.h: 233 | 234 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h: 235 | 236 | /usr/include/c++/4.4/initializer_list: 237 | 238 | /usr/include/c++/4.4/bits/basic_string.tcc: 239 | 240 | ../../include/FIFOSampleBuffer.h: 241 | 242 | ../../include/FIFOSamplePipe.h: 243 | 244 | ../../include/STTypes.h: 245 | 246 | ../../include/soundtouch_config.h: 247 | -------------------------------------------------------------------------------- /soundtouch/include/FIFOSampleBuffer.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// A buffer class for temporarily storaging sound samples, operates as a 4 | /// first-in-first-out pipe. 5 | /// 6 | /// Samples are added to the end of the sample buffer with the 'putSamples' 7 | /// function, and are received from the beginning of the buffer by calling 8 | /// the 'receiveSamples' function. The class automatically removes the 9 | /// output samples from the buffer as well as grows the storage size 10 | /// whenever necessary. 11 | /// 12 | /// Author : Copyright (c) Olli Parviainen 13 | /// Author e-mail : oparviai 'at' iki.fi 14 | /// SoundTouch WWW: http://www.surina.net/soundtouch 15 | /// 16 | //////////////////////////////////////////////////////////////////////////////// 17 | // 18 | // Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $ 19 | // File revision : $Revision: 4 $ 20 | // 21 | // $Id: FIFOSampleBuffer.h 63 2009-02-21 16:00:14Z oparviai $ 22 | // 23 | //////////////////////////////////////////////////////////////////////////////// 24 | // 25 | // License : 26 | // 27 | // SoundTouch audio processing library 28 | // Copyright (c) Olli Parviainen 29 | // 30 | // This library is free software; you can redistribute it and/or 31 | // modify it under the terms of the GNU Lesser General Public 32 | // License as published by the Free Software Foundation; either 33 | // version 2.1 of the License, or (at your option) any later version. 34 | // 35 | // This library is distributed in the hope that it will be useful, 36 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 37 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38 | // Lesser General Public License for more details. 39 | // 40 | // You should have received a copy of the GNU Lesser General Public 41 | // License along with this library; if not, write to the Free Software 42 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 43 | // 44 | //////////////////////////////////////////////////////////////////////////////// 45 | 46 | #ifndef FIFOSampleBuffer_H 47 | #define FIFOSampleBuffer_H 48 | 49 | #include "FIFOSamplePipe.h" 50 | 51 | namespace soundtouch 52 | { 53 | 54 | /// Sample buffer working in FIFO (first-in-first-out) principle. The class takes 55 | /// care of storage size adjustment and data moving during input/output operations. 56 | /// 57 | /// Notice that in case of stereo audio, one sample is considered to consist of 58 | /// both channel data. 59 | class FIFOSampleBuffer : public FIFOSamplePipe 60 | { 61 | private: 62 | /// Sample buffer. 63 | SAMPLETYPE *buffer; 64 | 65 | // Raw unaligned buffer memory. 'buffer' is made aligned by pointing it to first 66 | // 16-byte aligned location of this buffer 67 | SAMPLETYPE *bufferUnaligned; 68 | 69 | /// Sample buffer size in bytes 70 | uint sizeInBytes; 71 | 72 | /// How many samples are currently in buffer. 73 | uint samplesInBuffer; 74 | 75 | /// Channels, 1=mono, 2=stereo. 76 | uint channels; 77 | 78 | /// Current position pointer to the buffer. This pointer is increased when samples are 79 | /// removed from the pipe so that it's necessary to actually rewind buffer (move data) 80 | /// only new data when is put to the pipe. 81 | uint bufferPos; 82 | 83 | /// Rewind the buffer by moving data from position pointed by 'bufferPos' to real 84 | /// beginning of the buffer. 85 | void rewind(); 86 | 87 | /// Ensures that the buffer has capacity for at least this many samples. 88 | void ensureCapacity(uint capacityRequirement); 89 | 90 | /// Returns current capacity. 91 | uint getCapacity() const; 92 | 93 | public: 94 | 95 | /// Constructor 96 | FIFOSampleBuffer(int numChannels = 2 ///< Number of channels, 1=mono, 2=stereo. 97 | ///< Default is stereo. 98 | ); 99 | 100 | /// destructor 101 | ~FIFOSampleBuffer(); 102 | 103 | /// Returns a pointer to the beginning of the output samples. 104 | /// This function is provided for accessing the output samples directly. 105 | /// Please be careful for not to corrupt the book-keeping! 106 | /// 107 | /// When using this function to output samples, also remember to 'remove' the 108 | /// output samples from the buffer by calling the 109 | /// 'receiveSamples(numSamples)' function 110 | virtual SAMPLETYPE *ptrBegin(); 111 | 112 | /// Returns a pointer to the end of the used part of the sample buffer (i.e. 113 | /// where the new samples are to be inserted). This function may be used for 114 | /// inserting new samples into the sample buffer directly. Please be careful 115 | /// not corrupt the book-keeping! 116 | /// 117 | /// When using this function as means for inserting new samples, also remember 118 | /// to increase the sample count afterwards, by calling the 119 | /// 'putSamples(numSamples)' function. 120 | SAMPLETYPE *ptrEnd( 121 | uint slackCapacity ///< How much free capacity (in samples) there _at least_ 122 | ///< should be so that the caller can succesfully insert the 123 | ///< desired samples to the buffer. If necessary, the function 124 | ///< grows the buffer size to comply with this requirement. 125 | ); 126 | 127 | /// Adds 'numSamples' pcs of samples from the 'samples' memory position to 128 | /// the sample buffer. 129 | virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples. 130 | uint numSamples ///< Number of samples to insert. 131 | ); 132 | 133 | /// Adjusts the book-keeping to increase number of samples in the buffer without 134 | /// copying any actual samples. 135 | /// 136 | /// This function is used to update the number of samples in the sample buffer 137 | /// when accessing the buffer directly with 'ptrEnd' function. Please be 138 | /// careful though! 139 | virtual void putSamples(uint numSamples ///< Number of samples been inserted. 140 | ); 141 | 142 | /// Output samples from beginning of the sample buffer. Copies requested samples to 143 | /// output buffer and removes them from the sample buffer. If there are less than 144 | /// 'numsample' samples in the buffer, returns all that available. 145 | /// 146 | /// \return Number of samples returned. 147 | virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples. 148 | uint maxSamples ///< How many samples to receive at max. 149 | ); 150 | 151 | /// Adjusts book-keeping so that given number of samples are removed from beginning of the 152 | /// sample buffer without copying them anywhere. 153 | /// 154 | /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly 155 | /// with 'ptrBegin' function. 156 | virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. 157 | ); 158 | 159 | /// Returns number of samples currently available. 160 | virtual uint numSamples() const; 161 | 162 | /// Sets number of channels, 1 = mono, 2 = stereo. 163 | void setChannels(int numChannels); 164 | 165 | /// Returns nonzero if there aren't any samples available for outputting. 166 | virtual int isEmpty() const; 167 | 168 | /// Clears all the samples. 169 | virtual void clear(); 170 | }; 171 | 172 | } 173 | 174 | #endif 175 | -------------------------------------------------------------------------------- /src/pysoundtouch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * python interface to soundtouch (the open-source audio processing library) 3 | * 4 | * The structure of this code was based on pymad-0.5.4 5 | * This is a C++ file. 6 | */ 7 | 8 | #include 9 | 10 | extern "C" { 11 | #include "soundtouchmodule.h" 12 | } 13 | #include "pysoundtouch.h" 14 | 15 | #if PY_VERSION_HEX < 0x01060000 16 | #define PyObject_DEL(op) PyMem_DEL((op)) 17 | #endif 18 | 19 | /* For debugging: 20 | #include "WavFile.h" 21 | WavOutFile* inputs = new WavOutFile("/Users/jrising/inputs.wav", 44100, 16, 1); 22 | WavOutFile* outputs = new WavOutFile("/Users/jrising/outputs.wav", 44100, 16, 1);*/ 23 | 24 | PyTypeObject py_soundtouch_t = { 25 | PyObject_HEAD_INIT(&PyType_Type) 26 | 0, 27 | "Soundtouch", 28 | sizeof(py_soundtouch), 29 | 0, 30 | /* standard methods */ 31 | (destructor) py_soundtouch_dealloc, 32 | (printfunc) 0, 33 | (getattrfunc) py_soundtouch_getattr, 34 | (setattrfunc) 0, 35 | (cmpfunc) 0, 36 | (reprfunc) 0, 37 | /* type categories */ 38 | 0, /* as number */ 39 | 0, /* as sequence */ 40 | 0, /* as mapping */ 41 | 0, /* hash */ 42 | 0, /* binary */ 43 | 0, /* repr */ 44 | 0, /* getattro */ 45 | 0, /* setattro */ 46 | 0, /* as buffer */ 47 | 0, /* tp_flags */ 48 | NULL 49 | }; 50 | 51 | // Constructor 52 | PyObject* py_soundtouch_new(PyObject* self, PyObject* args) { 53 | py_soundtouch* ps = NULL; 54 | uint sampleRate, channels; 55 | 56 | // Needs to be given the sampling rate and number of channels 57 | if (!PyArg_ParseTuple(args, "II:Soundtouch", &sampleRate, &channels)) { 58 | PyErr_SetString(PyExc_RuntimeError, "Requires sampling rate and number of channels (sample size must be 2)"); 59 | return NULL; 60 | } 61 | 62 | // Create the object 63 | ps = PyObject_NEW(py_soundtouch, &py_soundtouch_t); 64 | ps->soundtouch = new soundtouch::SoundTouch(); 65 | ps->channels = (int) channels; 66 | ps->soundtouch->setSampleRate(sampleRate); 67 | ps->soundtouch->setChannels(channels); 68 | 69 | return (PyObject*) ps; 70 | } 71 | 72 | // Deallocate the SoundTouch object 73 | static void py_soundtouch_dealloc(PyObject* self, PyObject* args) { 74 | py_soundtouch* ps = PY_SOUNDTOUCH(self); 75 | 76 | if (ps->soundtouch) { 77 | delete ps->soundtouch; 78 | ps->soundtouch = NULL; 79 | } 80 | 81 | PyObject_DEL(self); 82 | } 83 | 84 | // Set the rate of playback 85 | static PyObject* py_soundtouch_set_rate(PyObject* self, PyObject* args) { 86 | float rate; 87 | 88 | // Given the rate as a fraction 89 | if (!PyArg_ParseTuple(args, "f", &rate) || rate < 0) { 90 | PyErr_SetString(PyExc_TypeError, "invalid argument"); 91 | return NULL; 92 | } 93 | 94 | PY_SOUNDTOUCH(self)->soundtouch->setRate(rate); 95 | 96 | Py_INCREF(Py_None); 97 | return Py_None; 98 | } 99 | 100 | // Set the tempo of playback 101 | static PyObject* py_soundtouch_set_tempo(PyObject* self, PyObject* args) { 102 | float tempo; 103 | 104 | // Given the tempo as a ratio 105 | if (!PyArg_ParseTuple(args, "f", &tempo) || tempo < 0) { 106 | PyErr_SetString(PyExc_TypeError, "invalid argument"); 107 | return NULL; 108 | } 109 | 110 | PY_SOUNDTOUCH(self)->soundtouch->setTempo(tempo); 111 | 112 | Py_INCREF(Py_None); 113 | return Py_None; 114 | } 115 | 116 | // Shift all pitches 117 | static PyObject* py_soundtouch_set_pitch(PyObject* self, PyObject* args) { 118 | float pitch; 119 | 120 | // Given the pitch adjustment as a fraction 121 | if (!PyArg_ParseTuple(args, "f", &pitch) || pitch < 0) { 122 | PyErr_SetString(PyExc_TypeError, "invalid argument"); 123 | return NULL; 124 | } 125 | 126 | PY_SOUNDTOUCH(self)->soundtouch->setPitch(pitch); 127 | 128 | Py_INCREF(Py_None); 129 | return Py_None; 130 | } 131 | 132 | static PyObject* py_soundtouch_set_pitch_shift(PyObject* self, PyObject* args) { 133 | float pitch; 134 | 135 | // Given the pitch adjustment in half-steps 136 | if (!PyArg_ParseTuple(args, "f", &pitch) || pitch < -12 || pitch > 12) { 137 | PyErr_SetString(PyExc_TypeError, "invalid argument: pitch must be between -12 and 12"); 138 | return NULL; 139 | } 140 | 141 | PY_SOUNDTOUCH(self)->soundtouch->setPitchSemiTones(pitch); 142 | 143 | Py_INCREF(Py_None); 144 | return Py_None; 145 | } 146 | 147 | // Flush all samples to the output 148 | static PyObject* py_soundtouch_flush(PyObject* self, PyObject* args) { 149 | PY_SOUNDTOUCH(self)->soundtouch->flush(); 150 | 151 | // For debugging: 152 | //delete inputs; 153 | //delete outputs; 154 | 155 | Py_INCREF(Py_None); 156 | return Py_None; 157 | } 158 | 159 | // Clear all buffers 160 | static PyObject* py_soundtouch_clear(PyObject* self, PyObject* args) { 161 | PY_SOUNDTOUCH(self)->soundtouch->clear(); 162 | 163 | Py_INCREF(Py_None); 164 | return Py_None; 165 | } 166 | 167 | // Add new samples 168 | static PyObject* py_soundtouch_put_samples(PyObject* self, PyObject* args) { 169 | py_soundtouch* ps = PY_SOUNDTOUCH(self); 170 | int buflen; 171 | char* transfer; 172 | 173 | // Given a string of samples to add 174 | if (!PyArg_ParseTuple(args, "s#", &transfer, &buflen)) { 175 | PyErr_SetString(PyExc_TypeError, "invalid argument"); 176 | return NULL; 177 | } 178 | 179 | // Move them into our char-short union 180 | for (int ii = 0; ii < buflen; ii++) 181 | ps->buffer.chars[ii] = transfer[ii]; 182 | 183 | // Add them 184 | ps->soundtouch->putSamples(ps->buffer.shorts, (uint) buflen / (2 * ps->channels)); 185 | 186 | // For debugging: 187 | //inputs->write(ps->buffer.shorts, buflen / 2); 188 | 189 | Py_INCREF(Py_None); 190 | return Py_None; 191 | } 192 | 193 | // Return the shifted samples 194 | static PyObject* py_soundtouch_get_samples(PyObject* self, PyObject* args) { 195 | py_soundtouch* ps = PY_SOUNDTOUCH(self); 196 | uint maxSamples; 197 | 198 | // Given the number of samples to request 199 | if (!PyArg_ParseTuple(args, "|I", &maxSamples)) { 200 | PyErr_SetString(PyExc_TypeError, "invalid argument"); 201 | return NULL; 202 | } 203 | 204 | // Move them into our char-short union 205 | uint received = ps->soundtouch->receiveSamples(ps->buffer.shorts, maxSamples); 206 | 207 | // For debugging: 208 | //outputs->write(ps->buffer.shorts, received * ps->channels); 209 | 210 | return PyString_FromStringAndSize(ps->buffer.chars, received * 2 * ps->channels); 211 | } 212 | 213 | // Return how many samples are available for output 214 | static PyObject* py_soundtouch_ready_count(PyObject* self, PyObject* args) { 215 | return PyInt_FromLong(PY_SOUNDTOUCH(self)->soundtouch->numSamples()); 216 | } 217 | 218 | // Return how many samples will be available given the current data 219 | static PyObject* py_soundtouch_waiting_count(PyObject* self, PyObject* args) { 220 | return PyInt_FromLong(PY_SOUNDTOUCH(self)->soundtouch->numUnprocessedSamples()); 221 | } 222 | 223 | /* housekeeping */ 224 | 225 | static PyMethodDef soundtouch_methods[] = { 226 | { "set_rate", py_soundtouch_set_rate, METH_VARARGS, "" }, 227 | { "set_tempo", py_soundtouch_set_tempo, METH_VARARGS, "" }, 228 | { "set_pitch", py_soundtouch_set_pitch, METH_VARARGS, "" }, 229 | { "set_pitch_shift", py_soundtouch_set_pitch_shift, METH_VARARGS, "" }, 230 | { "flush", py_soundtouch_flush, METH_VARARGS, "" }, 231 | { "clear", py_soundtouch_clear, METH_VARARGS, "" }, 232 | { "put_samples", py_soundtouch_put_samples, METH_VARARGS, "" }, 233 | { "get_samples", py_soundtouch_get_samples, METH_VARARGS, "" }, 234 | { "ready_count", py_soundtouch_ready_count, METH_VARARGS, "" }, 235 | { "waiting_count", py_soundtouch_waiting_count, METH_VARARGS, "" }, 236 | { NULL, 0, 0, NULL } 237 | }; 238 | 239 | // Get additional attributes from the SoundTouch object 240 | static PyObject* py_soundtouch_getattr(PyObject* self, char* name) { 241 | // TODO: add soundtouch.getSetting here? Add a setattr with soundtouch.setSetting? 242 | return Py_FindMethod(soundtouch_methods, self, name); 243 | } 244 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | pysoundtouch 2 | ============ 3 | 4 | Python Wrapper for the SoundTouch Library 5 | 6 | SoundTouch is a library for changing the pitch and tempo of audio 7 | files and detecting beat rates. See the website at 8 | http://www.surina.net/soundtouch/ 9 | 10 | This module exposes the pitch shifting and beat detection algorithms 11 | in SoundTouch to Python. 12 | 13 | Installation 14 | ------------ 15 | 16 | First compile and install SoundTouch using integer samples. To compile on Linux and MacOS: 17 | 18 | 1. You will need to install autoconf and libtool if you do not already have them. Using brew on a Mac, `brew install automake` 19 | 20 | 2. Run the following 21 | ``` 22 | cd soundtouch 23 | ./bootstrap 24 | ./configure --enable-integer-samples CXXFLAGS="-fPIC" 25 | make 26 | sudo make install 27 | cd .. 28 | ``` 29 | 30 | Then, run setup.py 31 | 32 | ``` 33 | sudo python setup.py install 34 | ``` 35 | 36 | Finally, check that you can import soundtouch. Within python: 37 | 38 | ``` 39 | >>> import soundtouch 40 | >>> soundtouch.__version__ 41 | '1.4.0' 42 | ``` 43 | 44 | Simple Examples 45 | --------------- 46 | 47 | To use the library directly, audio must already be in an uncompressed, 2-byte-per-sample format. For all other audio files, see the AudioReader Tool and Shifter Tool sections below. 48 | 49 | Detecting the BPM of a .WAV file: 50 | 51 | ``` 52 | import wave 53 | # Open a .WAV file 54 | wf = wave.open(FILEPATH) 55 | 56 | # Create the BPMDetect object 57 | bd = soundtouch.BPMDetect(wf.getframerate(), wf.getnchannels()) 58 | 59 | # Feed samples from the file into BPMDetect 60 | while True: 61 | buf = wf.readframes(4000) 62 | if not buf: 63 | break 64 | 65 | bd.put_samples(buf) 66 | 67 | # Clean up 68 | wf.close() 69 | print bd.get_bpm() 70 | ``` 71 | 72 | Shifting the pitch of a .WAV file: 73 | 74 | ``` 75 | import wave 76 | # Open a .WAV file 77 | wf = wave.open(FILEPATH) 78 | 79 | # Create the SoundTouch object 80 | st = soundtouch.SoundTouch(wf.getframerate(), wf.getnchannels()) 81 | # Specify the shift, as 1 whole step 82 | st.set_pitch_shift(2) 83 | 84 | # Feed in samples and add processed samples to resstr 85 | resstr = "" 86 | while True: 87 | buf = wf.readframes(4000) 88 | if not buf: 89 | break 90 | 91 | st.put_samples(buf) 92 | while st.ready_count() > 0: 93 | resstr += st.get_samples(4000) 94 | 95 | # Flush any additional samples 96 | waiting = st.waiting_count() 97 | ready = st.ready_count() 98 | flushed = "" 99 | 100 | # Add silence until another chunk is pushed out 101 | silence = array('h', [0] * 64) 102 | while st.ready_count() == ready: 103 | st.put_samples(silence) 104 | 105 | # Get all of the additional samples 106 | while st.ready_count() > 0: 107 | flushed += st.get_samples(4000) 108 | 109 | st.clear() 110 | 111 | if len(flushed) > 2 * wf.getnchannels() * waiting: 112 | flushed = flushed[0:(2 * wf.getnchannels() * waiting)] 113 | 114 | resstr += flushed 115 | 116 | # Clean up 117 | wf.close() 118 | del st 119 | ``` 120 | 121 | AudioReader Tool 122 | ---------------- 123 | 124 | AudioReader is an abstraction around the audio handling tools in python, to make it easier to handle audio from many different formats. 125 | 126 | Currently MP3, WAV, AIF, and AU files are supported. 127 | 128 | All subclasses of AudioReader override the following methods: 129 | 130 | * sampling_rate(): Return the samples (frames) per second. 131 | * duration(): Return the duration in ms. 132 | * current_time(): Return the current time in ms. 133 | * seek_time(time): Set the read pointer to the specified time (in ms). 134 | * raw_width(): Return the width in bytes of raw samples. 135 | * raw_read(): Return some amount of data as a raw audio string. 136 | * has_unsigned_singles(): Is the raw data when this has a width of 1 stored in unsigned bytes (but not for higher widths). 137 | * read(): Return some number of frames of an channel-interleaved array (len = NxC) of the appropriate sample depth. 138 | * close(): Perform any necessary cleanup on deallocation. 139 | 140 | In addition, the following methods are provided based on these: 141 | * random_read(start, end): Return the frames between start and end 142 | * continue_read(end): Continue reading from the current read head. 143 | * length_read(lenout): Read a given number of samples, by repeated calls to read(). 144 | * raw_random_read(start, end): Return the raw samples between start and end 145 | * audio_to_image(filename, width, height): Construct a graph of the samples and save to filepath. 146 | 147 | Use the AudioReader.open(filepath) method to get a reader object: 148 | 149 | ``` 150 | from ReadAudio import AudioReader 151 | 152 | reader = AudioReader.open("mysong.mp3") 153 | print reader.duration() 154 | ``` 155 | 156 | In addition, AudioReader classes can be used to transparently make changes to audio. The following classes are provided: 157 | * ConvertReader(source, set_channels=None, set_sampling_rate=None, set_raw_width=None): Convert the samples from one AudioReader into another format, changing the number of channels, sampling rate, and/or raw byte width. 158 | * ScaleReader(source, scale=1.0, bias=0): Scale the audio (volume) in an AudioReader; scale is > 1 to increase volume; bias is inaudible but can be changed to remove clicks. 159 | * AppendReader(one_path, two_path): Concatenate two audio files; the second will be converted to have the same format as the first. 160 | 161 | Here's how it can be combined with the SoundTouch library: 162 | 163 | ``` 164 | # Open the file and convert it to have SoundTouch's required 2-byte samples 165 | reader = AudioReader.open(srcpath) 166 | reader2 = ConvertReader(reader, set_raw_width=2) 167 | 168 | # Create the SoundTouch object and set the given shift 169 | st = soundtouch.SoundTouch(reader2.sampling_rate(), reader2.channels()) 170 | st.set_pitch_shift(shift) 171 | 172 | # Create the .WAV file to write the result to 173 | writer = wave.open(dstpath, 'w') 174 | writer.setnchannels(reader2.channels()) 175 | writer.setframerate(reader2.sampling_rate()) 176 | writer.setsampwidth(reader2.raw_width()) 177 | 178 | # Read values and feed them into SoundTouch 179 | while True: 180 | data = reader2.raw_read() 181 | if not data: 182 | break 183 | 184 | print len(data) 185 | st.put_samples(data) 186 | 187 | while st.ready_count() > 0: 188 | writer.writeframes(st.get_samples(11025)) 189 | 190 | # Flush any remaining samples 191 | waiting = st.waiting_count() 192 | ready = st.ready_count() 193 | flushed = "" 194 | 195 | # Add silence until another chunk is pushed out 196 | silence = array('h', [0] * 64) 197 | while st.ready_count() == ready: 198 | st.put_samples(silence) 199 | 200 | # Get all of the additional samples 201 | while st.ready_count() > 0: 202 | flushed += st.get_samples(4000) 203 | 204 | st.clear() 205 | 206 | if len(flushed) > 2 * reader2.getnchannels() * waiting: 207 | flushed = flushed[0:(2 * reader2.getnchannels() * waiting)] 208 | 209 | writer.writeframes(flushed) 210 | 211 | # Clean up 212 | writer.close() 213 | reader2.close() 214 | ``` 215 | 216 | Shifter Tool 217 | ------------ 218 | 219 | The Shifter class provides a set of tools for using SoundTouch with the AudioReader system. 220 | 221 | Tools for Shifting Audio 222 | * shift_chunk(chunk, sampling_rate, channels, shift): Shift the pitch of a chunk of audio up or down 223 | * many_shift_chunk(chunk, sampling_rate, channels, shifts): Produce harmonies by shifting a chunk of audio more than once and combining them. 224 | * raw_shift_reader(srcpath, dstpath, shift): Shift an entire file up or down 225 | 226 | Example: 227 | 228 | ``` 229 | raw_shift_reader("mysong.mp3", "shifted_mysong.wav", 2) 230 | ``` 231 | 232 | Note that raw_shift_reader always produces a .WAV file. 233 | 234 | Tools for detected beats: 235 | * bpm_detect_file(fullpath): Detect the beat from an entire file 236 | * beats_to_ms(bpm, beats): Convert from bpm at a given beat rate to ms between beats. 237 | * find_division_start(fullpath, bpm, beats_per): Identify the start of the beats, by finding segments that fit together 238 | 239 | Other SoundTouch tools 240 | * get_flush(st, channels, fade=0): Get all additional chunks, and optionally fade out the volume on these samples. 241 | * echocancel(outputdata, inputdata): Try to identify an echo and remove it. 242 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/RateTransposer.Plo: -------------------------------------------------------------------------------- 1 | RateTransposer.lo: RateTransposer.cpp /usr/include/memory.h \ 2 | /usr/include/features.h /usr/include/bits/predefs.h \ 3 | /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 4 | /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ 5 | /usr/include/string.h \ 6 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h \ 7 | /usr/include/xlocale.h /usr/include/assert.h /usr/include/stdlib.h \ 8 | /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ 9 | /usr/include/endian.h /usr/include/bits/endian.h \ 10 | /usr/include/bits/byteswap.h /usr/include/sys/types.h \ 11 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 12 | /usr/include/time.h /usr/include/sys/select.h /usr/include/bits/select.h \ 13 | /usr/include/bits/sigset.h /usr/include/bits/time.h \ 14 | /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ 15 | /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ 16 | /usr/include/_G_config.h /usr/include/wchar.h \ 17 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h \ 18 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 19 | /usr/include/bits/stdio.h /usr/include/c++/4.4/stdexcept \ 20 | /usr/include/c++/4.4/exception \ 21 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h \ 22 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h \ 23 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h \ 24 | /usr/include/c++/4.4/string /usr/include/c++/4.4/bits/stringfwd.h \ 25 | /usr/include/c++/4.4/bits/char_traits.h \ 26 | /usr/include/c++/4.4/bits/stl_algobase.h /usr/include/c++/4.4/cstddef \ 27 | /usr/include/c++/4.4/bits/functexcept.h \ 28 | /usr/include/c++/4.4/exception_defines.h \ 29 | /usr/include/c++/4.4/bits/cpp_type_traits.h \ 30 | /usr/include/c++/4.4/ext/type_traits.h \ 31 | /usr/include/c++/4.4/ext/numeric_traits.h \ 32 | /usr/include/c++/4.4/bits/stl_pair.h /usr/include/c++/4.4/bits/move.h \ 33 | /usr/include/c++/4.4/bits/concept_check.h \ 34 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h \ 35 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h \ 36 | /usr/include/c++/4.4/bits/stl_iterator.h \ 37 | /usr/include/c++/4.4/debug/debug.h /usr/include/c++/4.4/bits/postypes.h \ 38 | /usr/include/c++/4.4/cwchar /usr/include/bits/wchar.h \ 39 | /usr/include/c++/4.4/bits/allocator.h \ 40 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h \ 41 | /usr/include/c++/4.4/ext/new_allocator.h /usr/include/c++/4.4/new \ 42 | /usr/include/c++/4.4/bits/localefwd.h \ 43 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h \ 44 | /usr/include/c++/4.4/clocale /usr/include/locale.h \ 45 | /usr/include/bits/locale.h /usr/include/c++/4.4/iosfwd \ 46 | /usr/include/c++/4.4/cctype /usr/include/ctype.h \ 47 | /usr/include/c++/4.4/bits/ostream_insert.h \ 48 | /usr/include/c++/4.4/cxxabi-forced.h \ 49 | /usr/include/c++/4.4/bits/stl_function.h \ 50 | /usr/include/c++/4.4/backward/binders.h \ 51 | /usr/include/c++/4.4/bits/basic_string.h \ 52 | /usr/include/c++/4.4/ext/atomicity.h \ 53 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h \ 54 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h \ 55 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 56 | /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ 57 | /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ 58 | /usr/include/bits/confname.h /usr/include/getopt.h \ 59 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h \ 60 | /usr/include/c++/4.4/initializer_list \ 61 | /usr/include/c++/4.4/bits/basic_string.tcc RateTransposer.h AAFilter.h \ 62 | ../../include/STTypes.h ../../include/soundtouch_config.h \ 63 | ../../include/FIFOSamplePipe.h ../../include/STTypes.h \ 64 | ../../include/FIFOSampleBuffer.h ../../include/FIFOSamplePipe.h 65 | 66 | /usr/include/memory.h: 67 | 68 | /usr/include/features.h: 69 | 70 | /usr/include/bits/predefs.h: 71 | 72 | /usr/include/sys/cdefs.h: 73 | 74 | /usr/include/bits/wordsize.h: 75 | 76 | /usr/include/gnu/stubs.h: 77 | 78 | /usr/include/gnu/stubs-64.h: 79 | 80 | /usr/include/string.h: 81 | 82 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h: 83 | 84 | /usr/include/xlocale.h: 85 | 86 | /usr/include/assert.h: 87 | 88 | /usr/include/stdlib.h: 89 | 90 | /usr/include/bits/waitflags.h: 91 | 92 | /usr/include/bits/waitstatus.h: 93 | 94 | /usr/include/endian.h: 95 | 96 | /usr/include/bits/endian.h: 97 | 98 | /usr/include/bits/byteswap.h: 99 | 100 | /usr/include/sys/types.h: 101 | 102 | /usr/include/bits/types.h: 103 | 104 | /usr/include/bits/typesizes.h: 105 | 106 | /usr/include/time.h: 107 | 108 | /usr/include/sys/select.h: 109 | 110 | /usr/include/bits/select.h: 111 | 112 | /usr/include/bits/sigset.h: 113 | 114 | /usr/include/bits/time.h: 115 | 116 | /usr/include/sys/sysmacros.h: 117 | 118 | /usr/include/bits/pthreadtypes.h: 119 | 120 | /usr/include/alloca.h: 121 | 122 | /usr/include/stdio.h: 123 | 124 | /usr/include/libio.h: 125 | 126 | /usr/include/_G_config.h: 127 | 128 | /usr/include/wchar.h: 129 | 130 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h: 131 | 132 | /usr/include/bits/stdio_lim.h: 133 | 134 | /usr/include/bits/sys_errlist.h: 135 | 136 | /usr/include/bits/stdio.h: 137 | 138 | /usr/include/c++/4.4/stdexcept: 139 | 140 | /usr/include/c++/4.4/exception: 141 | 142 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h: 143 | 144 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h: 145 | 146 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h: 147 | 148 | /usr/include/c++/4.4/string: 149 | 150 | /usr/include/c++/4.4/bits/stringfwd.h: 151 | 152 | /usr/include/c++/4.4/bits/char_traits.h: 153 | 154 | /usr/include/c++/4.4/bits/stl_algobase.h: 155 | 156 | /usr/include/c++/4.4/cstddef: 157 | 158 | /usr/include/c++/4.4/bits/functexcept.h: 159 | 160 | /usr/include/c++/4.4/exception_defines.h: 161 | 162 | /usr/include/c++/4.4/bits/cpp_type_traits.h: 163 | 164 | /usr/include/c++/4.4/ext/type_traits.h: 165 | 166 | /usr/include/c++/4.4/ext/numeric_traits.h: 167 | 168 | /usr/include/c++/4.4/bits/stl_pair.h: 169 | 170 | /usr/include/c++/4.4/bits/move.h: 171 | 172 | /usr/include/c++/4.4/bits/concept_check.h: 173 | 174 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h: 175 | 176 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h: 177 | 178 | /usr/include/c++/4.4/bits/stl_iterator.h: 179 | 180 | /usr/include/c++/4.4/debug/debug.h: 181 | 182 | /usr/include/c++/4.4/bits/postypes.h: 183 | 184 | /usr/include/c++/4.4/cwchar: 185 | 186 | /usr/include/bits/wchar.h: 187 | 188 | /usr/include/c++/4.4/bits/allocator.h: 189 | 190 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h: 191 | 192 | /usr/include/c++/4.4/ext/new_allocator.h: 193 | 194 | /usr/include/c++/4.4/new: 195 | 196 | /usr/include/c++/4.4/bits/localefwd.h: 197 | 198 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h: 199 | 200 | /usr/include/c++/4.4/clocale: 201 | 202 | /usr/include/locale.h: 203 | 204 | /usr/include/bits/locale.h: 205 | 206 | /usr/include/c++/4.4/iosfwd: 207 | 208 | /usr/include/c++/4.4/cctype: 209 | 210 | /usr/include/ctype.h: 211 | 212 | /usr/include/c++/4.4/bits/ostream_insert.h: 213 | 214 | /usr/include/c++/4.4/cxxabi-forced.h: 215 | 216 | /usr/include/c++/4.4/bits/stl_function.h: 217 | 218 | /usr/include/c++/4.4/backward/binders.h: 219 | 220 | /usr/include/c++/4.4/bits/basic_string.h: 221 | 222 | /usr/include/c++/4.4/ext/atomicity.h: 223 | 224 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h: 225 | 226 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h: 227 | 228 | /usr/include/pthread.h: 229 | 230 | /usr/include/sched.h: 231 | 232 | /usr/include/bits/sched.h: 233 | 234 | /usr/include/signal.h: 235 | 236 | /usr/include/bits/setjmp.h: 237 | 238 | /usr/include/unistd.h: 239 | 240 | /usr/include/bits/posix_opt.h: 241 | 242 | /usr/include/bits/environments.h: 243 | 244 | /usr/include/bits/confname.h: 245 | 246 | /usr/include/getopt.h: 247 | 248 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h: 249 | 250 | /usr/include/c++/4.4/initializer_list: 251 | 252 | /usr/include/c++/4.4/bits/basic_string.tcc: 253 | 254 | RateTransposer.h: 255 | 256 | AAFilter.h: 257 | 258 | ../../include/STTypes.h: 259 | 260 | ../../include/soundtouch_config.h: 261 | 262 | ../../include/FIFOSamplePipe.h: 263 | 264 | ../../include/STTypes.h: 265 | 266 | ../../include/FIFOSampleBuffer.h: 267 | 268 | ../../include/FIFOSamplePipe.h: 269 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/PeakFinder.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// Peak detection routine. 4 | /// 5 | /// The routine detects highest value on an array of values and calculates the 6 | /// precise peak location as a mass-center of the 'hump' around the peak value. 7 | /// 8 | /// Author : Copyright (c) Olli Parviainen 9 | /// Author e-mail : oparviai 'at' iki.fi 10 | /// SoundTouch WWW: http://www.surina.net/soundtouch 11 | /// 12 | //////////////////////////////////////////////////////////////////////////////// 13 | // 14 | // Last changed : $Date: 2009-02-21 18:00:14 +0200 (Sat, 21 Feb 2009) $ 15 | // File revision : $Revision: 4 $ 16 | // 17 | // $Id: PeakFinder.cpp 63 2009-02-21 16:00:14Z oparviai $ 18 | // 19 | //////////////////////////////////////////////////////////////////////////////// 20 | // 21 | // License : 22 | // 23 | // SoundTouch audio processing library 24 | // Copyright (c) Olli Parviainen 25 | // 26 | // This library is free software; you can redistribute it and/or 27 | // modify it under the terms of the GNU Lesser General Public 28 | // License as published by the Free Software Foundation; either 29 | // version 2.1 of the License, or (at your option) any later version. 30 | // 31 | // This library is distributed in the hope that it will be useful, 32 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | // Lesser General Public License for more details. 35 | // 36 | // You should have received a copy of the GNU Lesser General Public 37 | // License along with this library; if not, write to the Free Software 38 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 39 | // 40 | //////////////////////////////////////////////////////////////////////////////// 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | #include "PeakFinder.h" 47 | 48 | using namespace soundtouch; 49 | 50 | #define max(x, y) (((x) > (y)) ? (x) : (y)) 51 | 52 | 53 | PeakFinder::PeakFinder() 54 | { 55 | minPos = maxPos = 0; 56 | } 57 | 58 | 59 | // Finds 'ground level' of a peak hump by starting from 'peakpos' and proceeding 60 | // to direction defined by 'direction' until next 'hump' after minimum value will 61 | // begin 62 | int PeakFinder::findGround(const float *data, int peakpos, int direction) const 63 | { 64 | float refvalue; 65 | int lowpos; 66 | int pos; 67 | int climb_count; 68 | float delta; 69 | 70 | climb_count = 0; 71 | refvalue = data[peakpos]; 72 | lowpos = peakpos; 73 | 74 | pos = peakpos; 75 | 76 | while ((pos > minPos) && (pos < maxPos)) 77 | { 78 | int prevpos; 79 | 80 | prevpos = pos; 81 | pos += direction; 82 | 83 | // calculate derivate 84 | delta = data[pos] - data[prevpos]; 85 | if (delta <= 0) 86 | { 87 | // going downhill, ok 88 | if (climb_count) 89 | { 90 | climb_count --; // decrease climb count 91 | } 92 | 93 | // check if new minimum found 94 | if (data[pos] < refvalue) 95 | { 96 | // new minimum found 97 | lowpos = pos; 98 | refvalue = data[pos]; 99 | } 100 | } 101 | else 102 | { 103 | // going uphill, increase climbing counter 104 | climb_count ++; 105 | if (climb_count > 5) break; // we've been climbing too long => it's next uphill => quit 106 | } 107 | } 108 | return lowpos; 109 | } 110 | 111 | 112 | // Find offset where the value crosses the given level, when starting from 'peakpos' and 113 | // proceeds to direction defined in 'direction' 114 | int PeakFinder::findCrossingLevel(const float *data, float level, int peakpos, int direction) const 115 | { 116 | float peaklevel; 117 | int pos; 118 | 119 | peaklevel = data[peakpos]; 120 | assert(peaklevel >= level); 121 | pos = peakpos; 122 | while ((pos >= minPos) && (pos < maxPos)) 123 | { 124 | if (data[pos + direction] < level) return pos; // crossing found 125 | pos += direction; 126 | } 127 | return -1; // not found 128 | } 129 | 130 | 131 | // Calculates the center of mass location of 'data' array items between 'firstPos' and 'lastPos' 132 | double PeakFinder::calcMassCenter(const float *data, int firstPos, int lastPos) const 133 | { 134 | int i; 135 | float sum; 136 | float wsum; 137 | 138 | sum = 0; 139 | wsum = 0; 140 | for (i = firstPos; i <= lastPos; i ++) 141 | { 142 | sum += (float)i * data[i]; 143 | wsum += data[i]; 144 | } 145 | 146 | if (wsum < 1e-6) return 0; 147 | return sum / wsum; 148 | } 149 | 150 | 151 | 152 | /// get exact center of peak near given position by calculating local mass of center 153 | double PeakFinder::getPeakCenter(const float *data, int peakpos, bool loose) const 154 | { 155 | float peakLevel; // peak level 156 | int crosspos1, crosspos2; // position where the peak 'hump' crosses cutting level 157 | float cutLevel; // cutting value 158 | float groundLevel; // ground level of the peak 159 | int gp1, gp2; // bottom positions of the peak 'hump' 160 | 161 | // find ground positions. 162 | gp1 = findGround(data, peakpos, -1); 163 | gp2 = findGround(data, peakpos, 1); 164 | 165 | groundLevel = max(data[gp1], data[gp2]); 166 | peakLevel = data[peakpos]; 167 | 168 | if (!loose) { 169 | if (groundLevel < 1e-6) return 0; // ground level too small => detection failed 170 | if ((peakLevel / groundLevel) < 1.3) return 0; // peak less than 30% of the ground level => no good peak detected 171 | } 172 | 173 | // calculate 70%-level of the peak 174 | cutLevel = 0.70f * peakLevel + 0.30f * groundLevel; 175 | // find mid-level crossings 176 | crosspos1 = findCrossingLevel(data, cutLevel, peakpos, -1); 177 | crosspos2 = findCrossingLevel(data, cutLevel, peakpos, 1); 178 | 179 | if ((crosspos1 < 0) || (crosspos2 < 0)) return 0; // no crossing, no peak.. 180 | 181 | // calculate mass center of the peak surroundings 182 | return calcMassCenter(data, crosspos1, crosspos2); 183 | } 184 | 185 | 186 | 187 | double PeakFinder::detectPeak(const float *data, int aminPos, int amaxPos, bool loose) 188 | { 189 | 190 | int i; 191 | int peakpos; // position of peak level 192 | double highPeak, peak; 193 | 194 | this->minPos = aminPos; 195 | this->maxPos = amaxPos; 196 | 197 | // find absolute peak 198 | peakpos = minPos; 199 | peak = data[minPos]; 200 | for (i = minPos + 1; i < maxPos; i ++) 201 | { 202 | if (data[i] > peak) 203 | { 204 | peak = data[i]; 205 | peakpos = i; 206 | } 207 | } 208 | 209 | // Calculate exact location of the highest peak mass center 210 | highPeak = getPeakCenter(data, peakpos); 211 | peak = highPeak; 212 | 213 | // Now check if the highest peak were in fact harmonic of the true base beat peak 214 | // - sometimes the highest peak can be Nth harmonic of the true base peak yet 215 | // just a slightly higher than the true base 216 | for (i = 2; i < 10; i ++) 217 | { 218 | double peaktmp, tmp; 219 | int i1,i2; 220 | 221 | peakpos = (int)(highPeak / (double)i + 0.5f); 222 | if (peakpos < minPos) break; 223 | 224 | // calculate mass-center of possible base peak 225 | peaktmp = getPeakCenter(data, peakpos); 226 | 227 | // now compare to highest detected peak 228 | i1 = (int)(highPeak + 0.5); 229 | i2 = (int)(peaktmp + 0.5); 230 | tmp = 2 * (data[i2] - data[i1]) / (data[i2] + data[i1]); 231 | if (fabs(tmp) < 0.1) 232 | { 233 | // The highest peak is harmonic of almost as high base peak, 234 | // thus use the base peak instead 235 | peak = peaktmp; 236 | } 237 | } 238 | 239 | return peak; 240 | } 241 | 242 | 243 | -------------------------------------------------------------------------------- /soundtouch/source/SoundTouch/.deps/SoundTouch.Plo: -------------------------------------------------------------------------------- 1 | SoundTouch.lo: SoundTouch.cpp /usr/include/assert.h \ 2 | /usr/include/features.h /usr/include/bits/predefs.h \ 3 | /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 4 | /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ 5 | /usr/include/stdlib.h \ 6 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h \ 7 | /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ 8 | /usr/include/endian.h /usr/include/bits/endian.h \ 9 | /usr/include/bits/byteswap.h /usr/include/xlocale.h \ 10 | /usr/include/sys/types.h /usr/include/bits/types.h \ 11 | /usr/include/bits/typesizes.h /usr/include/time.h \ 12 | /usr/include/sys/select.h /usr/include/bits/select.h \ 13 | /usr/include/bits/sigset.h /usr/include/bits/time.h \ 14 | /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ 15 | /usr/include/alloca.h /usr/include/memory.h /usr/include/string.h \ 16 | /usr/include/math.h /usr/include/bits/huge_val.h \ 17 | /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ 18 | /usr/include/bits/inf.h /usr/include/bits/nan.h \ 19 | /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ 20 | /usr/include/bits/mathinline.h /usr/include/c++/4.4/stdexcept \ 21 | /usr/include/c++/4.4/exception \ 22 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h \ 23 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h \ 24 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h \ 25 | /usr/include/c++/4.4/string /usr/include/c++/4.4/bits/stringfwd.h \ 26 | /usr/include/c++/4.4/bits/char_traits.h \ 27 | /usr/include/c++/4.4/bits/stl_algobase.h /usr/include/c++/4.4/cstddef \ 28 | /usr/include/c++/4.4/bits/functexcept.h \ 29 | /usr/include/c++/4.4/exception_defines.h \ 30 | /usr/include/c++/4.4/bits/cpp_type_traits.h \ 31 | /usr/include/c++/4.4/ext/type_traits.h \ 32 | /usr/include/c++/4.4/ext/numeric_traits.h \ 33 | /usr/include/c++/4.4/bits/stl_pair.h /usr/include/c++/4.4/bits/move.h \ 34 | /usr/include/c++/4.4/bits/concept_check.h \ 35 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h \ 36 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h \ 37 | /usr/include/c++/4.4/bits/stl_iterator.h \ 38 | /usr/include/c++/4.4/debug/debug.h /usr/include/c++/4.4/bits/postypes.h \ 39 | /usr/include/c++/4.4/cwchar /usr/include/wchar.h /usr/include/stdio.h \ 40 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h \ 41 | /usr/include/bits/wchar.h /usr/include/c++/4.4/bits/allocator.h \ 42 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h \ 43 | /usr/include/c++/4.4/ext/new_allocator.h /usr/include/c++/4.4/new \ 44 | /usr/include/c++/4.4/bits/localefwd.h \ 45 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h \ 46 | /usr/include/c++/4.4/clocale /usr/include/locale.h \ 47 | /usr/include/bits/locale.h /usr/include/c++/4.4/iosfwd \ 48 | /usr/include/c++/4.4/cctype /usr/include/ctype.h \ 49 | /usr/include/c++/4.4/bits/ostream_insert.h \ 50 | /usr/include/c++/4.4/cxxabi-forced.h \ 51 | /usr/include/c++/4.4/bits/stl_function.h \ 52 | /usr/include/c++/4.4/backward/binders.h \ 53 | /usr/include/c++/4.4/bits/basic_string.h \ 54 | /usr/include/c++/4.4/ext/atomicity.h \ 55 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h \ 56 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h \ 57 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 58 | /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ 59 | /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ 60 | /usr/include/bits/confname.h /usr/include/getopt.h \ 61 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h \ 62 | /usr/include/c++/4.4/initializer_list \ 63 | /usr/include/c++/4.4/bits/basic_string.tcc /usr/include/libio.h \ 64 | /usr/include/_G_config.h /usr/include/bits/stdio_lim.h \ 65 | /usr/include/bits/sys_errlist.h /usr/include/bits/stdio.h \ 66 | ../../include/SoundTouch.h ../../include/FIFOSamplePipe.h \ 67 | ../../include/STTypes.h ../../include/soundtouch_config.h TDStretch.h \ 68 | ../../include/STTypes.h RateTransposer.h AAFilter.h \ 69 | ../../include/FIFOSamplePipe.h ../../include/FIFOSampleBuffer.h \ 70 | cpu_detect.h 71 | 72 | /usr/include/assert.h: 73 | 74 | /usr/include/features.h: 75 | 76 | /usr/include/bits/predefs.h: 77 | 78 | /usr/include/sys/cdefs.h: 79 | 80 | /usr/include/bits/wordsize.h: 81 | 82 | /usr/include/gnu/stubs.h: 83 | 84 | /usr/include/gnu/stubs-64.h: 85 | 86 | /usr/include/stdlib.h: 87 | 88 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h: 89 | 90 | /usr/include/bits/waitflags.h: 91 | 92 | /usr/include/bits/waitstatus.h: 93 | 94 | /usr/include/endian.h: 95 | 96 | /usr/include/bits/endian.h: 97 | 98 | /usr/include/bits/byteswap.h: 99 | 100 | /usr/include/xlocale.h: 101 | 102 | /usr/include/sys/types.h: 103 | 104 | /usr/include/bits/types.h: 105 | 106 | /usr/include/bits/typesizes.h: 107 | 108 | /usr/include/time.h: 109 | 110 | /usr/include/sys/select.h: 111 | 112 | /usr/include/bits/select.h: 113 | 114 | /usr/include/bits/sigset.h: 115 | 116 | /usr/include/bits/time.h: 117 | 118 | /usr/include/sys/sysmacros.h: 119 | 120 | /usr/include/bits/pthreadtypes.h: 121 | 122 | /usr/include/alloca.h: 123 | 124 | /usr/include/memory.h: 125 | 126 | /usr/include/string.h: 127 | 128 | /usr/include/math.h: 129 | 130 | /usr/include/bits/huge_val.h: 131 | 132 | /usr/include/bits/huge_valf.h: 133 | 134 | /usr/include/bits/huge_vall.h: 135 | 136 | /usr/include/bits/inf.h: 137 | 138 | /usr/include/bits/nan.h: 139 | 140 | /usr/include/bits/mathdef.h: 141 | 142 | /usr/include/bits/mathcalls.h: 143 | 144 | /usr/include/bits/mathinline.h: 145 | 146 | /usr/include/c++/4.4/stdexcept: 147 | 148 | /usr/include/c++/4.4/exception: 149 | 150 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h: 151 | 152 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/os_defines.h: 153 | 154 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/cpu_defines.h: 155 | 156 | /usr/include/c++/4.4/string: 157 | 158 | /usr/include/c++/4.4/bits/stringfwd.h: 159 | 160 | /usr/include/c++/4.4/bits/char_traits.h: 161 | 162 | /usr/include/c++/4.4/bits/stl_algobase.h: 163 | 164 | /usr/include/c++/4.4/cstddef: 165 | 166 | /usr/include/c++/4.4/bits/functexcept.h: 167 | 168 | /usr/include/c++/4.4/exception_defines.h: 169 | 170 | /usr/include/c++/4.4/bits/cpp_type_traits.h: 171 | 172 | /usr/include/c++/4.4/ext/type_traits.h: 173 | 174 | /usr/include/c++/4.4/ext/numeric_traits.h: 175 | 176 | /usr/include/c++/4.4/bits/stl_pair.h: 177 | 178 | /usr/include/c++/4.4/bits/move.h: 179 | 180 | /usr/include/c++/4.4/bits/concept_check.h: 181 | 182 | /usr/include/c++/4.4/bits/stl_iterator_base_types.h: 183 | 184 | /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h: 185 | 186 | /usr/include/c++/4.4/bits/stl_iterator.h: 187 | 188 | /usr/include/c++/4.4/debug/debug.h: 189 | 190 | /usr/include/c++/4.4/bits/postypes.h: 191 | 192 | /usr/include/c++/4.4/cwchar: 193 | 194 | /usr/include/wchar.h: 195 | 196 | /usr/include/stdio.h: 197 | 198 | /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stdarg.h: 199 | 200 | /usr/include/bits/wchar.h: 201 | 202 | /usr/include/c++/4.4/bits/allocator.h: 203 | 204 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++allocator.h: 205 | 206 | /usr/include/c++/4.4/ext/new_allocator.h: 207 | 208 | /usr/include/c++/4.4/new: 209 | 210 | /usr/include/c++/4.4/bits/localefwd.h: 211 | 212 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h: 213 | 214 | /usr/include/c++/4.4/clocale: 215 | 216 | /usr/include/locale.h: 217 | 218 | /usr/include/bits/locale.h: 219 | 220 | /usr/include/c++/4.4/iosfwd: 221 | 222 | /usr/include/c++/4.4/cctype: 223 | 224 | /usr/include/ctype.h: 225 | 226 | /usr/include/c++/4.4/bits/ostream_insert.h: 227 | 228 | /usr/include/c++/4.4/cxxabi-forced.h: 229 | 230 | /usr/include/c++/4.4/bits/stl_function.h: 231 | 232 | /usr/include/c++/4.4/backward/binders.h: 233 | 234 | /usr/include/c++/4.4/bits/basic_string.h: 235 | 236 | /usr/include/c++/4.4/ext/atomicity.h: 237 | 238 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr.h: 239 | 240 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/gthr-default.h: 241 | 242 | /usr/include/pthread.h: 243 | 244 | /usr/include/sched.h: 245 | 246 | /usr/include/bits/sched.h: 247 | 248 | /usr/include/signal.h: 249 | 250 | /usr/include/bits/setjmp.h: 251 | 252 | /usr/include/unistd.h: 253 | 254 | /usr/include/bits/posix_opt.h: 255 | 256 | /usr/include/bits/environments.h: 257 | 258 | /usr/include/bits/confname.h: 259 | 260 | /usr/include/getopt.h: 261 | 262 | /usr/include/c++/4.4/x86_64-linux-gnu/bits/atomic_word.h: 263 | 264 | /usr/include/c++/4.4/initializer_list: 265 | 266 | /usr/include/c++/4.4/bits/basic_string.tcc: 267 | 268 | /usr/include/libio.h: 269 | 270 | /usr/include/_G_config.h: 271 | 272 | /usr/include/bits/stdio_lim.h: 273 | 274 | /usr/include/bits/sys_errlist.h: 275 | 276 | /usr/include/bits/stdio.h: 277 | 278 | ../../include/SoundTouch.h: 279 | 280 | ../../include/FIFOSamplePipe.h: 281 | 282 | ../../include/STTypes.h: 283 | 284 | ../../include/soundtouch_config.h: 285 | 286 | TDStretch.h: 287 | 288 | ../../include/STTypes.h: 289 | 290 | RateTransposer.h: 291 | 292 | AAFilter.h: 293 | 294 | ../../include/FIFOSamplePipe.h: 295 | 296 | ../../include/FIFOSampleBuffer.h: 297 | 298 | cpu_detect.h: 299 | -------------------------------------------------------------------------------- /soundtouch/include/FIFOSamplePipe.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// 'FIFOSamplePipe' : An abstract base class for classes that manipulate sound 4 | /// samples by operating like a first-in-first-out pipe: New samples are fed 5 | /// into one end of the pipe with the 'putSamples' function, and the processed 6 | /// samples are received from the other end with the 'receiveSamples' function. 7 | /// 8 | /// 'FIFOProcessor' : A base class for classes the do signal processing with 9 | /// the samples while operating like a first-in-first-out pipe. When samples 10 | /// are input with the 'putSamples' function, the class processes them 11 | /// and moves the processed samples to the given 'output' pipe object, which 12 | /// may be either another processing stage, or a fifo sample buffer object. 13 | /// 14 | /// Author : Copyright (c) Olli Parviainen 15 | /// Author e-mail : oparviai 'at' iki.fi 16 | /// SoundTouch WWW: http://www.surina.net/soundtouch 17 | /// 18 | //////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // Last changed : $Date: 2009-04-13 16:18:48 +0300 (Mon, 13 Apr 2009) $ 21 | // File revision : $Revision: 4 $ 22 | // 23 | // $Id: FIFOSamplePipe.h 69 2009-04-13 13:18:48Z oparviai $ 24 | // 25 | //////////////////////////////////////////////////////////////////////////////// 26 | // 27 | // License : 28 | // 29 | // SoundTouch audio processing library 30 | // Copyright (c) Olli Parviainen 31 | // 32 | // This library is free software; you can redistribute it and/or 33 | // modify it under the terms of the GNU Lesser General Public 34 | // License as published by the Free Software Foundation; either 35 | // version 2.1 of the License, or (at your option) any later version. 36 | // 37 | // This library is distributed in the hope that it will be useful, 38 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 40 | // Lesser General Public License for more details. 41 | // 42 | // You should have received a copy of the GNU Lesser General Public 43 | // License along with this library; if not, write to the Free Software 44 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 45 | // 46 | //////////////////////////////////////////////////////////////////////////////// 47 | 48 | #ifndef FIFOSamplePipe_H 49 | #define FIFOSamplePipe_H 50 | 51 | #include 52 | #include 53 | #include "STTypes.h" 54 | 55 | namespace soundtouch 56 | { 57 | 58 | /// Abstract base class for FIFO (first-in-first-out) sample processing classes. 59 | class FIFOSamplePipe 60 | { 61 | public: 62 | // virtual default destructor 63 | virtual ~FIFOSamplePipe() {} 64 | 65 | 66 | /// Returns a pointer to the beginning of the output samples. 67 | /// This function is provided for accessing the output samples directly. 68 | /// Please be careful for not to corrupt the book-keeping! 69 | /// 70 | /// When using this function to output samples, also remember to 'remove' the 71 | /// output samples from the buffer by calling the 72 | /// 'receiveSamples(numSamples)' function 73 | virtual SAMPLETYPE *ptrBegin() = 0; 74 | 75 | /// Adds 'numSamples' pcs of samples from the 'samples' memory position to 76 | /// the sample buffer. 77 | virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples. 78 | uint numSamples ///< Number of samples to insert. 79 | ) = 0; 80 | 81 | 82 | // Moves samples from the 'other' pipe instance to this instance. 83 | void moveSamples(FIFOSamplePipe &other ///< Other pipe instance where from the receive the data. 84 | ) 85 | { 86 | int oNumSamples = other.numSamples(); 87 | 88 | putSamples(other.ptrBegin(), oNumSamples); 89 | other.receiveSamples(oNumSamples); 90 | }; 91 | 92 | /// Output samples from beginning of the sample buffer. Copies requested samples to 93 | /// output buffer and removes them from the sample buffer. If there are less than 94 | /// 'numsample' samples in the buffer, returns all that available. 95 | /// 96 | /// \return Number of samples returned. 97 | virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples. 98 | uint maxSamples ///< How many samples to receive at max. 99 | ) = 0; 100 | 101 | /// Adjusts book-keeping so that given number of samples are removed from beginning of the 102 | /// sample buffer without copying them anywhere. 103 | /// 104 | /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly 105 | /// with 'ptrBegin' function. 106 | virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. 107 | ) = 0; 108 | 109 | /// Returns number of samples currently available. 110 | virtual uint numSamples() const = 0; 111 | 112 | // Returns nonzero if there aren't any samples available for outputting. 113 | virtual int isEmpty() const = 0; 114 | 115 | /// Clears all the samples. 116 | virtual void clear() = 0; 117 | }; 118 | 119 | 120 | 121 | /// Base-class for sound processing routines working in FIFO principle. With this base 122 | /// class it's easy to implement sound processing stages that can be chained together, 123 | /// so that samples that are fed into beginning of the pipe automatically go through 124 | /// all the processing stages. 125 | /// 126 | /// When samples are input to this class, they're first processed and then put to 127 | /// the FIFO pipe that's defined as output of this class. This output pipe can be 128 | /// either other processing stage or a FIFO sample buffer. 129 | class FIFOProcessor :public FIFOSamplePipe 130 | { 131 | protected: 132 | /// Internal pipe where processed samples are put. 133 | FIFOSamplePipe *output; 134 | 135 | /// Sets output pipe. 136 | void setOutPipe(FIFOSamplePipe *pOutput) 137 | { 138 | assert(output == NULL); 139 | assert(pOutput != NULL); 140 | output = pOutput; 141 | } 142 | 143 | 144 | /// Constructor. Doesn't define output pipe; it has to be set be 145 | /// 'setOutPipe' function. 146 | FIFOProcessor() 147 | { 148 | output = NULL; 149 | } 150 | 151 | 152 | /// Constructor. Configures output pipe. 153 | FIFOProcessor(FIFOSamplePipe *pOutput ///< Output pipe. 154 | ) 155 | { 156 | output = pOutput; 157 | } 158 | 159 | 160 | /// Destructor. 161 | virtual ~FIFOProcessor() 162 | { 163 | } 164 | 165 | 166 | /// Returns a pointer to the beginning of the output samples. 167 | /// This function is provided for accessing the output samples directly. 168 | /// Please be careful for not to corrupt the book-keeping! 169 | /// 170 | /// When using this function to output samples, also remember to 'remove' the 171 | /// output samples from the buffer by calling the 172 | /// 'receiveSamples(numSamples)' function 173 | virtual SAMPLETYPE *ptrBegin() 174 | { 175 | return output->ptrBegin(); 176 | } 177 | 178 | public: 179 | 180 | /// Output samples from beginning of the sample buffer. Copies requested samples to 181 | /// output buffer and removes them from the sample buffer. If there are less than 182 | /// 'numsample' samples in the buffer, returns all that available. 183 | /// 184 | /// \return Number of samples returned. 185 | virtual uint receiveSamples(SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples. 186 | uint maxSamples ///< How many samples to receive at max. 187 | ) 188 | { 189 | return output->receiveSamples(outBuffer, maxSamples); 190 | } 191 | 192 | 193 | /// Adjusts book-keeping so that given number of samples are removed from beginning of the 194 | /// sample buffer without copying them anywhere. 195 | /// 196 | /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly 197 | /// with 'ptrBegin' function. 198 | virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. 199 | ) 200 | { 201 | return output->receiveSamples(maxSamples); 202 | } 203 | 204 | 205 | /// Returns number of samples currently available. 206 | virtual uint numSamples() const 207 | { 208 | return output->numSamples(); 209 | } 210 | 211 | 212 | /// Returns nonzero if there aren't any samples available for outputting. 213 | virtual int isEmpty() const 214 | { 215 | return output->isEmpty(); 216 | } 217 | }; 218 | 219 | } 220 | 221 | #endif 222 | --------------------------------------------------------------------------------