Changes in / [71f2e5f:41b985f]
- Files:
-
- 12 added
- 97 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r71f2e5f r41b985f 31 31 doc/web/ 32 32 doc/full/ 33 doc/_build/ 33 34 34 35 python/gen -
.travis.yml
r71f2e5f r41b985f 3 3 matrix: 4 4 include: 5 - python: 3.5 6 os: linux 7 compiler: gcc 8 - python: 3.4 9 os: linux 10 compiler: gcc 5 11 - python: 2.7 6 12 os: linux 7 13 compiler: gcc 8 env: ARCH=x86_64 14 - language: C 15 os: osx 16 osx_image: xcode8 17 compiler: clang 18 - python: 3.5 19 os: linux 20 compiler: gcc 21 env: CFLAGS="-Os" WAFOPTS="--disable-samplerate --disable-sndfile" 22 - python: 3.4 23 os: linux 24 compiler: gcc 25 env: HAVE_AUBIO_DOUBLE=1 CFLAGS="-O3" WAFOPTS="--enable-fftw3" 9 26 - python: 2.7 10 27 os: linux 11 28 compiler: gcc 12 env: ARCH=i386 13 - python: 3.4 14 os: linux 15 compiler: gcc 16 env: ARCH=x86_64 17 - python: 3.4 18 os: linux 19 compiler: gcc 20 env: ARCH=i386 WAFOPTS=--enable-fftw3f 29 env: CFLAGS="`dpkg-buildflags --get CFLAGS`" LDFLAGS="`dpkg-buildflags --get LDFLAGS`" 21 30 - language: C 22 31 os: osx 32 osx_image: xcode8 23 33 compiler: clang 24 env: ARCH=x86_6434 env: CFLAGS="-Os" HAVE_AUBIO_DOUBLE=1 WAFOPTS="--disable-accelerate" 25 35 - language: C 26 36 os: osx 37 osx_image: xcode8 27 38 compiler: clang 28 env: ARCH=i386 29 - python: 2.7 30 os: linux 31 compiler: gcc 32 env: ARCH=x86_64 HAVE_DOUBLE=1 WAFOPTS=--enable-fftw3 33 - python: 2.7 34 os: linux 35 compiler: gcc 36 env: ARCH=i386 HAVE_DOUBLE=1 37 - python: 3.4 38 os: linux 39 compiler: gcc 40 env: ARCH=x86_64 HAVE_DOUBLE=1 41 - python: 3.4 42 os: linux 43 compiler: gcc 44 env: ARCH=i386 HAVE_DOUBLE=1 39 env: WAFOPTS="--enable-fat --disable-avcodec --disable-sndfile" 45 40 - language: C 46 41 os: osx 42 osx_image: xcode8 47 43 compiler: clang 48 env: ARCH=x86_64 HAVE_DOUBLE=144 env: WAFOPTS="--with-target-platform=ios --disable-avcodec --disable-sndfile --disable-samplerate --disable-rubberband" AUBIO_NOTESTS=1 49 45 - language: C 50 46 os: osx 47 osx_image: xcode8 51 48 compiler: clang 52 env: ARCH=i386 HAVE_DOUBLE=149 env: WAFOPTS="--enable-fat --disable-avcodec --disable-sndfile --disable-samplerate --disable-rubberband" AUBIO_NOTESTS=1 53 50 - language: C 54 51 os: osx 52 osx_image: xcode8.2 55 53 compiler: clang 56 env: ARCH=x86_64 WAFOPTS="--enable-fat --disable-sndfile --disable-samplerate --disable-rubberband"54 env: WAFOPTS="--enable-fat --disable-avcodec --disable-sndfile" 57 55 - language: C 58 56 os: osx 57 osx_image: xcode8.2 59 58 compiler: clang 60 env: ARCH=i386 WAFOPTS="--enable-fat --disable-sndfile --disable-samplerate --disable-rubberband" 59 env: WAFOPTS="--with-target-platform=ios --disable-avcodec --disable-sndfile" AUBIO_NOTESTS=1 60 - language: C 61 os: osx 62 osx_image: xcode8.2 63 compiler: clang 64 env: WAFOPTS="--with-target-platform=iosimulator --disable-avcodec --disable-sndfile" AUBIO_NOTESTS=1 65 66 # use trusty 67 dist: trusty 68 sudo: required 61 69 62 70 addons: … … 64 72 packages: 65 73 - bzip2 74 - libavcodec-dev 75 - libavformat-dev 76 - libavresample-dev 77 - libavutil-dev 66 78 - libsndfile1-dev 67 79 - libsamplerate-dev … … 76 88 if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 77 89 brew update 78 brew install sox libsamplerate libsndfile rubberband 90 brew install sox 91 brew install ffmpeg 92 brew install libsndfile 93 brew install libsamplerate 94 brew install rubberband 79 95 export PATH="$HOME/Library/Python/2.7/bin/:$PATH" 80 96 fi; 81 97 82 83 98 install: 84 - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry pip install nose2; fi 85 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then travis_retry pip install --user nose2; fi 99 - travis_retry pip install --upgrade pip 100 - travis_retry make getwaf expandwaf deps_python 101 - which pip 102 - pip --version 86 103 87 104 script: 88 105 - make create_test_sounds 89 - make build 90 - make build_python 91 - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make test_python; fi 92 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make test_python_osx; fi 93 - make clean_python 94 - make clean 95 - make distcheck 96 - make test_pure_python 106 - | 107 if [[ -z "$AUBIO_NOTESTS" ]]; then 108 make test_lib_python_clean 109 make test_python_only_clean 110 else 111 make test_lib_only_clean 112 fi; 97 113 98 114 notifications: … … 101 117 - "irc.freenode.org#aubio" 102 118 use_notice: true 119 webhooks: 120 urls: 121 - https://webhooks.gitter.im/e/81e7733a5b1d977854b4 122 on_success: change # options: [always|never|change] default: always 123 on_failure: always # options: [always|never|change] default: always 124 on_start: never # options: [always|never|change] default: always -
ChangeLog
r71f2e5f r41b985f 1 2017-01-08 Paul Brossier <piem@aubio.org> 2 3 [ Overview ] 4 5 * VERSION: bump to 0.4.4 6 * src/utils/log.h: new function to redirect log, error, and warnings 7 * python/: AUBIO_ERR raises python exception, AUBIO_WRN to emit py warning 8 * doc/: add some documentation, fix errors in manpages 9 * wscript: new rules to build 'manpages', 'doxygen', and 'sphinx', new 10 --build-type=<release|debug> option (thanks to Eduard Mueller) 11 * src/notes/notes.h: add minioi and silence methods 12 * examples/: add --minioi (minimum inter-onset interval) option 13 * src/pitch/pitchyin.c: improve msvc compiler optimisations (thanks to 14 Eduard Mueller) 15 * python/, src/: improve error messages, fix minor memory leaks 16 * src/io/source_avcodec.c: improve compatibility with latest ffmpeg and with 17 older libav/ffmpeg versions 18 * python/demos/: new demos to capture microphone in real time 19 20 [ Interface] 21 22 * src/aubio.h: include utils/log.h 23 * src/utils/log.h: add new aubio_log_set_function to redirect log messages 24 * src/notes/notes.h: add aubio_notes_{get,set}_minioi_ms, add 25 _{get,set}_silence methods 26 27 [ Library ] 28 29 * src/aubio_priv.h: add AUBIO_INF to print to stdout with header, use new 30 logging function, add ATAN alias, add stdarg.h, move #include "config.h" 31 * src/{fmat,fvec}.c: avoid integer division 32 * src/pitch/pitchyin.c: [msvc] help compiler to optimize aubio_pitchyin_do 33 by giving it addresses for all arrays which are referenced in inner loops, 34 thanks to Eduard Mueller. 35 * src/pitch/pitch.c: declare internal functions as static, fail on wrong 36 method, warn on wrong unit, improve error messages, fix error string 37 * src/spectral/specdesc.c: return NULL if wrong mode asked, remove trailing 38 spaces 39 * src/onset/onset.c: return null and clean-up if new_aubio_specdesc failed, 40 fix error message 41 * src/notes/notes.c: use midi note to store pitch candidate, round to 42 nearest note, add a variable to define precision, fix out-of-bound write, 43 fix unset silence_threshold, fix error message 44 * src/spectral/ooura_fft8g.c: add cast to avoid conversion warnings, prefix 45 public function with aubio_ooura_ to avoid with other apps using ooura (e.g. 46 puredata), make internal functions static, 47 * src/spectral/fft.c: add message about fftw3 being able to do non-power of 48 two sizes, make calls to fftw_destroy_plan thread-safe, use prefixed 49 aubio_ooura_rdft 50 * src/spectral/phasevoc.c: fix error string 51 * src/temporal/resampler.c: throw an error when using libsamplerate with doubles 52 * src/io/ioutils.h: add functions to check samplerate and channels, use in sink_*.c 53 * src/io/source.c: add error message when aubio was compiled with no source, 54 only show error message from last child source_ 55 * src/io/source_avcodec.c: call avformat_free_context after 56 avformat_close_input, keep a reference to packet to remove it when closing 57 file, avoid deprecation warnings with ffmpeg 3.2, add backward compatibility 58 for libavcodec55, fix for old libavcodec54, use AV_SAMPLE_FMT_DBL when 59 compiling with HAVE_AUBIO_DOUBLE, fix missing samples in eof block, avoid 60 function calls before declarations, improve error messages, replace with new 61 context before closing old one, make sure s->path is set to null 62 * src/io/{source_wavread,sink_wavwrite}.c: declare internal functions as static 63 * src/io/source_wavread.c: fix bytes_read for JUNK headers, improve error 64 messages, initialize buffer, skip chunks until data is found, or abort, skip 65 junk chunk 66 * src/io/source_sndfile.c: add support for multi-channel resampling, set 67 handle to null after sucessful close, add missing floor in ratio comparison, 68 improve formatting 69 * src/io/sink.c: only show error message from last child sink_ 70 * src/io/sink_apple_audio.c: avoid crash on empty file name 71 * src/io/sink_sndfile.c: improve error message 72 * src/io/sink_{sndfile,wavwrite}.c: use AUBIO_MAX_CHANNELS, fix error message 73 74 [ Documentation ] 75 76 * README.md: update copyright dates, use https 77 * src/aubio.h: add some links to examples, use https 78 * src/pitch/pitch.h: add aubio_pitch_get_tolerance, add basic description of 79 unit modes 80 * src/notes/notes.h: add doxygen header 81 * src/spectral/fft.h: strip example path 82 * doc/*.rst: improve sphinx documentation 83 * doc/android.rst: add reference to it scripts/build_android 84 * doc/debian_packages.rst: added page on debian packages 85 * doc/python_module.rst: add demo_source_simple.py, add note on pip, add 86 `print(aubio.version)` 87 * doc/cli.rst: include command line manpages 88 * doc/cli_features.rst: add matrix of command line features 89 * doc/requirements.rst: add a note about --notests (closes #77), document 90 --msvc options, improve description of options 91 * doc/download.rst: added page on download 92 * doc/installing.rst: update 93 * doc/xcode_frameworks.rst: added page on xcode frameworks 94 * doc/**: use https://aubio.org 95 * doc/conf.py: use pyramid theme, update copyright, remove hardcoded path 96 * doc/web.cfg: exclude ioutils from doc 97 * doc/aubionotes.txt: document -M option (see #18), 98 * doc/aubioonset.txt: add documentation for -M, --minioi, improve threshold 99 description (thanks to Peter Parker), fix typo (onset, not pitch) 100 * doc/aubio*.txt: document -T/--timeformat option 101 102 [ Build ] 103 104 * Makefile: add a brief intro, avoid offline operations, add html and dist 105 targets, add rules for documentation, simplify listing, avoid offline 106 operations, bump waf to 1.9.6, check for waf before clean, chmod go-w 107 waflib, improve clean, use pip to install, factorise pip options, generate 108 more test sounds, improve test_python and test_pure_python, pass build_ext 109 in test_pure_python{,_wheel}, quieten uninstall_python if already 110 uninstalled, improve test targets, use bdist_wheel in test_pure_python, 111 build_ext only for --enable-double, verbose waf rules, add cleanwaf 112 * wscript: added debug/release build type configurations release (default) 113 enables optimizations, debug symbols are enabled in both configurations, 114 thanks to Eduard Mueller. 115 * wscript: add options to disable source_wavread/sink_wavwrite, add check 116 for stdarg.h, new rules 'manpages', 'sphinx', and 'doxygen' to build 117 documentation, add version to sphinx and manpages, disable libsamplerate 118 if double precision enabled (libsamplerate only supports float), fix typos, 119 remove trailing spaces, improve tarball creation (./waf dist), remove 120 full.cfg from tarball, prepend to CFLAGS to honor user cflags 121 * wscript, src/wscript_build: improve install locations using DATAROOTDIR, 122 MANDIR, INCLUDEDIR 123 * wscript: default to no atlas for now 124 * src/wscript_build: always build static library 125 * scripts/build_android: add an example script to build aubio on android, 126 127 [ Tools ] 128 129 * examples/aubionotes.c: use new notes, set minioi, send last note off when 130 needed, add warning for missing options 131 * examples/aubioonset.c: add minioi option, in seconds 132 * examples/: only send a last note off when using jack 133 * examples/: return 1 if object creation failed 134 * examples/: use PROG_HAS_OUTPUT, add PROG_HAS_SILENCE 135 136 [ Tests ] 137 138 * tests/src/spectral/test-fft.c: fix default size 139 * tests/src/spectral/test-phasevoc.c: fix typos 140 * tests/src/utils/test-log.c: add AUBIO_INF, add example for 141 aubio_log_set_function, improve messages 142 143 [ Python ] 144 145 * python/ext/aubiomodule.c: add aubio._aubio.__version__ and import it as 146 aubio.version, use custom logging function for errors and warnings, remove 147 duplicated add_generated_objects, use <> for non local aubio 148 * python/ext/py-cvec.c: use NPY_INTP_FMT 149 * python/ext/py-fft.c: use error string set in src/spectral/fft.c 150 * python/ext/py-phasevoc.c: use error string set in src/spectral/phasevoc.c 151 * python/ext/py-sink.c: always set samplerate and channels in init 152 * python/ext/py-source.c: use error string set in src/io/source.c 153 * python/lib/aubio/midiconv.py: add unicode double sharp and double flat, 154 improve unicode handling, skip UnicodeEncodeError on python 2.x 155 156 [ Python build ] 157 158 * MANIFEST.in: add src/**.c, exclude full.cfg, include waflib, remove 159 python/ext/config.h 160 * setup.py: define AUBIO_VERSION use sorted glob.glob to improve 161 reproducibility, remove extra quotes, remove status from version string, 162 update description, use custom build_ext instead of 'generate' command, 163 define HAVE_AUBIO_DOUBLE to 1 if needed 164 * python/lib/gen_code.py: add support for multiple _do outputs, fix number 165 of output, improve del_ function, safer DECREF, fix indentation, emit RuntimeError 166 * python/lib/gen_external.py: clean-up, enable tss, remove duplicate, 167 sort generated files 168 * python/lib/moresetuptools.py: add HAVE_STDARG_H, also check for 169 HAVE_AUBIO_DOUBLE, cleaner clean, look first for system library, then for 170 local build, then local sources, mo nore fake config.h here, use 171 samplerate in single precision only 172 * python/README.md: add a note about nose2 for python tests (closes #74) 173 * scripts/setenv_local.sh: python3 compat 174 175 [ Python demos ] 176 177 * python/demos/demo_alsa.py: add example using alsaaudio (closes #72) 178 * python/demos/demo_mfcc.py: add options to plot first and second 179 derivatives, and set samplerate/win_s/hop_s, thanks to @jhoelzl (closes #68) 180 * python/demos/demo_notes.py: add simple notes demos 181 * python/demos/demo_pyaudio.py: added simple demo for pyaudio, see #6, 182 closes #78, thanks to @jhoelzl and @notalentgeek, add some comments, avoid 183 overwriting aubio.pitch 184 * python/demos/demo_source_simple.py: fix indentation, make executable 185 * python/demos/demo_timestretch{,_online}.py: fix usage string, remove 186 unused import, use // to yield an integer (closes #71) 187 * python/demos/demo_timestretch_online.py: use 512, fix block counter 188 * python/demos/demo_tss.py: improve default parameters, exit before plotting 189 190 [ Python tests ] 191 192 * python/tests/: use local import, add __init__.py 193 * python/tests/test_cvec.py: simplify 194 * python/tests/test_fft.py: skip test fft(zeros).phas == 0 if needed, expected powerpc 195 * python/tests/test_fvec.py: reduce alpha norm precision to 10.-4 196 * python/tests/test_{midi2note,note2midi}.py: use nose2.params, add unicode tests 197 * python/tests/test_notes.py: add basic tests 198 * python/tests/test_notes.py: test results are correct for 44100Hz_44100f_sine441.wav 199 * python/tests/test_sink.py: add more tests, quiet warnings 200 * python/tests/test_source.py: break long line, check the tail of the file 201 is non-zero on non silent test files, filter user warnings to avoid spamming 202 the console, only check if last frames are non silent on brownnoise (weak), 203 remove fragile brownnoise test, check duration on short files, use nose2 204 params to process one sound file per test 205 * python/tests/test_specdesc.py: RuntimeError is now raised on wrong mode 206 * python/tests/utils.py: by default, use 5 seconds brownoise 207 208 [ Only in git ] 209 210 * .travis.yml: add debian dpkg-buildflags config, switch from precise to 211 trusty, sudo required, add ffmpeg on osx, add targets ios, iosimulator, 212 and osx noopt configs, bump to xcode8, add xcode8.2 config, mimick 213 build_apple_frameworks options, alway upgrade pip, add pip --version and 214 which pip after upgrading, remove --user, use expandwaf in install, remove 215 unused ARCH, shuffle order, remove duplicate, add missing opening quote, 216 use AUBIO_NOTESTS to build only lib on ios, add gitter webhook 217 * .appveyor.yml: fix path for windows+python 3.5, fix typo in path, make 218 nose2 tests verbose 219 1 220 2016-08-16 Paul Brossier <piem@aubio.org> 2 221 -
MANIFEST.in
r71f2e5f r41b985f 2 2 include python/README.md 3 3 include Makefile wscript */wscript_build 4 include waf 4 include waf waflib/* waflib/*/* 5 exclude waflib/__pycache__/* 5 6 include aubio.pc.in 6 7 include nose2.cfg … … 18 19 include python/tests/run_all_tests 19 20 include python/tests/*.py 21 include python/tests/eval_pitch 20 22 include python/demos/*.py 21 23 include python/tests/*.expected 22 24 include doc/*.txt doc/*.rst doc/*.cfg doc/Makefile doc/make.bat doc/conf.py 25 exclude doc/full.cfg 23 26 include scripts/* scripts/apple/Info.plist scripts/apple/Modules/module.modulemap 24 27 exclude python/gen/* 25 exclude python/ext/config.h -
Makefile
r71f2e5f r41b985f 1 #!/usr/bin/make -f 2 # -*- makefile -*- 3 # 4 # This makefile contains simple rules to prepare, compile, test, and install 5 # aubio. Try one of the following rules: 6 # 7 # $ make configure 8 # $ make build 9 # $ make install 10 # $ make test_python 11 1 12 WAFCMD=python waf 2 WAFURL=https://waf.io/waf-1.8.22 13 WAFURL=https://waf.io/waf-1.9.6 14 15 #WAFOPTS:= 16 # turn on verbose mode 17 WAFOPTS += --verbose 18 # build wafopts 19 WAFOPTS += --destdir $(DESTDIR) 20 # multiple jobs 21 WAFOPTS += --jobs 4 22 # if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf 23 # python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE 24 WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double ) 25 26 PIPOPTS += --verbose 27 28 DESTDIR:=$(PWD)/build/dist 29 PYDESTDIR:=$(PWD)/build/pydist 30 31 # default install locations 32 PREFIX?=/usr/local 33 EXEC_PREFIX?=$(PREFIX) 34 LIBDIR?=$(PREFIX)/lib 35 INCLUDEDIR?=$(PREFIX)/include 36 DATAROOTDIR?=$(PREFIX)/share 37 MANDIR?=$(DATAROOTDIR)/man 3 38 4 39 SOX=sox 5 40 6 ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )7 41 TESTSOUNDS := python/tests/sounds 8 42 … … 13 47 14 48 getwaf: 15 @./scripts/get_waf.sh 16 17 expandwaf: 18 @[ -d wafilb ] || rm -fr waflib 19 @$(WAFCMD) --help > /dev/null 20 @mv .waf*/waflib . && rm -fr .waf* 21 @sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf 22 @chmod +x waf 49 ./scripts/get_waf.sh 50 51 expandwaf: getwaf 52 [ -d wafilb ] || rm -fr waflib 53 $(WAFCMD) --help > /dev/null 54 mv .waf*/waflib . && rm -fr .waf* 55 sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf 56 chmod +x waf && chmod -R go-w waflib 57 58 cleanwaf: 59 rm -rf waf waflib .waf* 23 60 24 61 configure: checkwaf 25 $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)62 $(WAFCMD) configure $(WAFOPTS) 26 63 27 64 build: configure 28 65 $(WAFCMD) build $(WAFOPTS) 29 66 67 install: 68 # install 69 $(WAFCMD) install $(WAFOPTS) 70 71 list_installed: 72 find $(DESTDIR) -ls | sed 's|$(DESTDIR)|/«destdir»|' 73 74 list_installed_python: 75 pip show -f aubio 76 77 list_all_installed: list_installed list_installed_python 78 79 uninstall: 80 # uninstall 81 $(WAFCMD) uninstall $(WAFOPTS) 82 83 delete_install: 84 rm -rf $(PWD)/dist/test 85 30 86 build_python: 31 python ./setup.py build_ext $(ENABLE_DOUBLE) 32 33 test_python: export LD_LIBRARY_PATH=$(PWD)/build/src 34 test_python: 35 pip install -v -r requirements.txt 36 pip install -v . 37 nose2 --verbose 38 pip uninstall -y -v aubio 39 40 test_python_osx: 87 # build python-aubio, using locally built libaubio if found 88 python ./setup.py build 89 90 build_python_extlib: 91 # build python-aubio using (locally) installed libaubio 92 [ -f $(DESTDIR)/$(INCLUDEDIR)/aubio/aubio.h ] 93 [ -d $(DESTDIR)/$(LIBDIR) ] 94 [ -f $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc ] 95 PKG_CONFIG_PATH=$(DESTDIR)/$(LIBDIR)/pkgconfig \ 96 CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR)" \ 97 LDFLAGS="-L$(DESTDIR)/$(LIBDIR)" \ 98 make build_python 99 100 deps_python: 101 # install or upgrade python requirements 102 pip install $(PIPOPTS) --requirement requirements.txt 103 104 # use pip or distutils? 105 install_python: install_python_with_pip 106 uninstall_python: uninstall_python_with_pip 107 #install_python: install_python_with_distutils 108 #uninstall_python: uninstall_python_with_distutils 109 110 install_python_with_pip: 111 # install package 112 pip install $(PIPOPTS) . 113 114 uninstall_python_with_pip: 115 # uninstall package 116 ( pip show aubio | grep -l aubio > /dev/null ) && \ 117 pip uninstall -y -v aubio || echo "info: aubio package is not installed" 118 119 install_python_with_distutils: 120 ./setup.py install $(PIPOPTS) $(DISTUTILSOPTS) 121 122 uninstall_python_with_distutils: 123 #./setup.py uninstall 124 [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true 125 126 force_uninstall_python: 127 # ignore failure if not installed 128 -make uninstall_python 129 130 local_dylib: 131 # DYLD_LIBRARY_PATH is no more on mac os 41 132 # create links from ~/lib/lib* to build/src/lib* 42 [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true 43 # then run the tests 44 pip install --user -v -r requirements.txt 45 pip install --user -v . 46 nose2 --verbose 47 pip uninstall -y -v aubio 133 [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true 134 135 test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR) 136 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR) 137 test_python: local_dylib 138 # run test with installed package 139 ./python/tests/run_all_tests --verbose 140 # also run with nose, multiple processes 141 nose2 -N 4 48 142 49 143 clean_python: 50 144 ./setup.py clean 51 145 52 test_pure_python: 53 -pip uninstall -v -y aubio 54 -rm -rf build/ python/gen/ 55 -rm -f dist/*.egg 56 -pip install -v -r requirements.txt 57 CFLAGS=-Os python setup.py build_ext $(ENABLE_DOUBLE) bdist_wheel 58 pip install dist/aubio-*.whl 59 nose2 -N 4 60 pip uninstall -v -y aubio 61 62 test_pure_python_wheel: 63 -pip uninstall -v -y aubio 64 -rm -rf build/ python/gen/ 65 -rm -f dist/*.whl 66 -pip install -v -r requirements.txt 67 -pip install -v wheel 68 CFLAGS=-Os python setup.py build_ext $(ENABLE_DOUBLE) bdist_wheel --universal 69 wheel install dist/*.whl 70 nose2 -N 4 71 pip uninstall -v -y aubio 72 73 build_python3: 74 python3 ./setup.py build_ext $(ENABLE_DOUBLE) 75 76 clean_python3: 77 python3 ./setup.py clean 78 79 clean: 146 check_clean_python: 147 # check cleaning a second time works 148 make clean_python 149 make clean_python 150 151 clean: checkwaf 152 # optionnaly clean before build 153 -$(WAFCMD) clean 154 # remove possible left overs 155 -rm -rf doc/_build 156 157 check_clean: 158 # check cleaning after build works 159 $(WAFCMD) clean 160 # check cleaning a second time works 80 161 $(WAFCMD) clean 81 162 82 163 distclean: 83 164 $(WAFCMD) distclean 165 -rm -rf doc/_build/ 166 -rm -rf doc/web/ 167 168 check_distclean: 169 make distclean 84 170 85 171 distcheck: checkwaf 86 $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)172 $(WAFCMD) distcheck $(WAFOPTS) 87 173 88 174 help: … … 92 178 -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true 93 179 -mkdir -p $(TESTSOUNDS) 94 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" synth 1s silence 0180 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" trim 0 1s 95 181 -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav" synth 5 brownnoise vol 0.9 96 182 -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav" synth 127s sine 440 vol 0.9 97 -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" synth 30 silence 0 vol 0.9183 -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" trim 0 30 98 184 -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav" synth 60 sine 100-20000 vol 0.9 185 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav" synth 44100s sine 441 vol 0.9 186 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav" synth 100s sine 441 vol 0.9 187 188 # build only libaubio, no python-aubio 189 test_lib_only: clean distclean configure build install list_installed 190 # additionally, clean after a fresh build 191 test_lib_only_clean: test_lib_only uninstall check_clean check_distclean 192 193 # build libaubio, build and test python-aubio against it 194 test_lib_python: force_uninstall_python deps_python \ 195 clean_python clean distclean \ 196 configure build build_python \ 197 install install_python \ 198 test_python \ 199 list_all_installed 200 201 test_lib_python_clean: test_lib_python \ 202 uninstall_python uninstall \ 203 check_clean_python \ 204 check_clean \ 205 check_distclean 206 207 # build libaubio, install it, build python-aubio against it 208 test_lib_install_python: force_uninstall_python deps_python \ 209 clean_python distclean \ 210 configure build \ 211 install \ 212 build_python_extlib \ 213 install_python \ 214 test_python \ 215 list_all_installed 216 217 test_lib_install_python_clean: test_lib_install_python \ 218 uninstall_python \ 219 delete_install \ 220 check_clean_python \ 221 check_distclean 222 223 # build a python-aubio that includes libaubio 224 test_python_only: force_uninstall_python deps_python \ 225 clean_python clean distclean \ 226 build_python \ 227 install_python \ 228 test_python \ 229 list_installed_python 230 231 test_python_only_clean: test_python_only \ 232 uninstall_python \ 233 check_clean_python 234 235 sphinx: configure 236 $(WAFCMD) sphinx $(WAFOPTS) 237 238 doxygen: configure 239 $(WAFCMD) doxygen $(WAFOPTS) 240 241 manpages: configure 242 $(WAFCMD) manpages $(WAFOPTS) 243 244 html: doxygen sphinx 245 246 docs: html manpages 247 248 dist: distclean expandwaf 249 $(WAFCMD) dist -
README.md
r71f2e5f r41b985f 88 88 make getwaf 89 89 90 aubio compiles on Linux, Mac OS X, Cygwin, and iOS.90 aubio compiles on Linux, Mac OS X, Windows, Cygwin, and iOS. 91 91 92 92 Installation … … 163 163 164 164 To subscribe to the list, use the mailman form: 165 http ://lists.aubio.org/listinfo/aubio-user/165 https://lists.aubio.org/listinfo/aubio-user/ 166 166 167 167 Alternatively, feel free to contact directly the author. … … 171 171 --------------------------------- 172 172 173 Copyright (C) 2003-201 3Paul Brossier <piem@aubio.org>173 Copyright (C) 2003-2016 Paul Brossier <piem@aubio.org> 174 174 175 175 aubio is free software: you can redistribute it and/or modify it under the -
VERSION
r71f2e5f r41b985f 1 1 AUBIO_MAJOR_VERSION=0 2 2 AUBIO_MINOR_VERSION=4 3 AUBIO_PATCH_VERSION= 43 AUBIO_PATCH_VERSION=5 4 4 AUBIO_VERSION_STATUS='~alpha' 5 5 LIBAUBIO_LT_CUR=5 6 LIBAUBIO_LT_REV= 07 LIBAUBIO_LT_AGE= 46 LIBAUBIO_LT_REV=1 7 LIBAUBIO_LT_AGE=5 -
doc/Makefile
r71f2e5f r41b985f 40 40 41 41 clean: 42 -rm -rf _static 42 43 -rm -rf $(BUILDDIR)/* 43 44 44 45 html: 46 mkdir -p _static 45 47 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 46 48 @echo -
doc/aubiocut.txt
r71f2e5f r41b985f 35 35 36 36 -t, --onset-threshold thres Set the threshold value for the onset peak 37 picking. Typical values are typically within 0.001 and 0.900. Defaults to38 0.1. Lower threshold values imply more onsets detected. Try 0.5 in case of39 over-detections. Defaults to 0.3.37 picking. Values are typically in the range [0.001, 0.900]. Lower threshold 38 values imply more onsets detected. Increasing this threshold should reduce 39 the number of incorrect detections. Defaults to 0.3. 40 40 41 41 -c, --cut Cut input sound file at detected labels. A new sound files for -
doc/aubionotes.txt
r71f2e5f r41b985f 50 50 0.1. Lower threshold values imply more onsets detected. Try 0.5 in case of 51 51 over-detections. Defaults to 0.3. 52 53 -M, --minioi value Set the minimum inter-onset interval, in seconds, the 54 shortest interval between two consecutive notes. Defaults to 0.030 52 55 53 56 -p, --pitch method The pitch detection method to use. See PITCH METHODS -
doc/aubioonset.txt
r71f2e5f r41b985f 10 10 [-T time-format] 11 11 [-s sil] [-m] [-f] 12 [-j] [-v] [-h] 12 [-j] [-N miditap-note] [-V miditap-velo] 13 [-v] [-h] 13 14 14 15 DESCRIPTION … … 49 50 50 51 -t, --onset-threshold thres Set the threshold value for the onset peak 51 picking. Typical values are typically within 0.001 and 0.900. Defaults to52 0.1. Lower threshold values imply more onsets detected. Try 0.5 in case of53 over-detections. Defaults to 0.3.52 picking. Values are typically in the range [0.001, 0.900]. Lower threshold 53 values imply more onsets detected. Increasing this threshold should reduce 54 the number of incorrect detections. Defaults to 0.3. 54 55 55 -s, --silence sil Set the silence threshold, in dB, under which the pitch 56 -M, --minioi value Set the minimum inter-onset interval, in seconds, the 57 shortest interval between two consecutive onsets. Defaults to 0.020 58 59 -s, --silence sil Set the silence threshold, in dB, under which the onset 56 60 will not be detected. A value of -20.0 would eliminate most onsets but the 57 61 loudest ones. A value of -90.0 would select all onsets. Defaults to -90.0. … … 67 71 -j, --jack Use Jack input/output. You will need a Jack connection 68 72 controller to feed aubio some signal and listen to its output. 73 74 -N, --miditap-note Override note value for MIDI tap. Defaults to 69. 75 76 -V, --miditap-velop Override velocity value for MIDI tap. Defaults to 65. 69 77 70 78 -h, --help Print a short help message and exit. -
doc/aubiotrack.txt
r71f2e5f r41b985f 9 9 [-T time-format] 10 10 [-s sil] [-m] 11 [-j] [-v] [-h] 11 [-j] [-N miditap-note] [-V miditap-velo] 12 [-v] [-h] 12 13 13 14 DESCRIPTION … … 55 56 controller to feed aubio some signal and listen to its output. 56 57 58 -N, --miditap-note Override note value for MIDI tap. Defaults to 69. 59 60 -V, --miditap-velop Override velocity value for MIDI tap. Defaults to 65. 61 57 62 -T, --timeformat format Set time format (samples, ms, seconds). Defaults to 58 63 seconds. -
doc/cli.rst
r71f2e5f r41b985f 17 17 18 18 - ``aubiocut`` slices sound files at onset or beat timestamps 19 20 21 .. toctree:: 22 23 cli_features 19 24 20 25 -
doc/conf.py
r71f2e5f r41b985f 17 17 # add these directories to sys.path here. If the directory is relative to the 18 18 # documentation root, use os.path.abspath to make it absolute, like shown here. 19 sys.path.insert(0, os.path.abspath('../../python/build/lib.macosx-10.6-intel-2.7'))19 #sys.path.insert(0, os.path.abspath('../../python/build/...')) 20 20 21 21 # -- General configuration ----------------------------------------------------- … … 51 51 version = '0.4' 52 52 # The full version, including alpha/beta/rc tags. 53 release = ' latest'53 release = '0.4.5~alpha' 54 54 55 55 # The language for content autogenerated by Sphinx. Refer to documentation … … 92 92 # The theme to use for HTML and HTML Help pages. See the documentation for 93 93 # a list of builtin themes. 94 html_theme = 'default' 94 #html_theme = 'agogo' 95 #html_theme = 'default' 96 #html_theme = 'haiku' 97 html_theme = 'pyramid' 95 98 96 99 # Theme options are theme-specific and customize the look and feel of a theme … … 121 124 # relative to this directory. They are copied after the builtin static files, 122 125 # so a file named "default.css" will overwrite the builtin "default.css". 123 html_static_path = [ '_static']126 html_static_path = [] #['_static'] 124 127 125 128 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, … … 151 154 152 155 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 153 #html_show_sphinx = True156 html_show_sphinx = False 154 157 155 158 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. … … 241 244 # How to display URL addresses: 'footnote', 'no', or 'inline'. 242 245 #texinfo_show_urls = 'footnote' 246 247 def setup(app): 248 if release.endswith('~alpha'): app.tags.add('devel') -
doc/develop.rst
r71f2e5f r41b985f 1 .. _develop: 2 1 3 Developping with aubio 2 4 ====================== … … 75 77 :lines: 6-11 76 78 77 The processing loop could know look like:79 The processing loop could now look like: 78 80 79 81 .. literalinclude:: ../tests/src/spectral/test-phasevoc.c -
doc/download.rst
r71f2e5f r41b985f 6 6 A number of distributions already include aubio. Check your favorite package 7 7 management system, or have a look at the `aubio download page 8 <http ://aubio.org/download>`_ for more options.8 <https://aubio.org/download>`_ for more options. 9 9 10 10 To use aubio in a macOS or iOS application, see :ref:`xcode-frameworks-label`. -
doc/full.cfg
r71f2e5f r41b985f 39 39 # control system is used. 40 40 41 PROJECT_NUMBER = "0.4. 2~alpha full"41 PROJECT_NUMBER = "0.4.5~alpha" 42 42 43 43 # Using the PROJECT_BRIEF tag one can provide an optional one line description … … 1465 1465 # This tag requires that the tag USE_MATHJAX is set to YES. 1466 1466 1467 MATHJAX_RELPATH = http ://cdn.mathjax.org/mathjax/latest1467 MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest 1468 1468 1469 1469 # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -
doc/index.rst
r71f2e5f r41b985f 10 10 performing pitch detection, tapping the beat and producing midi streams from 11 11 live audio. 12 13 Quick links 14 =========== 15 16 * :ref:`python` 17 * :ref:`manpages` 18 * :ref:`develop` 19 * :ref:`building` 20 21 .. only:: devel 22 23 .. include:: statuslinks.rst 24 25 Project pages 26 ============= 27 28 * `Project homepage`_: https://aubio.org 29 * `aubio on github`_: https://github.com/aubio/aubio 30 * `aubio on pypi`_: https://pypi.python.org/pypi/aubio 31 * `Doxygen documentation`_: https://aubio.org/doc/latest/ 32 * `Mailing lists`_: https://lists.aubio.org 33 34 .. _Project homepage: https://aubio.org 35 .. _aubio on github: https://github.com/aubio/aubio 36 .. _aubio on pypi: https://pypi.python.org/pypi/aubio 37 .. _Doxygen documentation: https://aubio.org/doc/latest/ 38 .. _Mailing lists: https://lists.aubio.org/ 39 40 * `Travis Continuous integration page <https://travis-ci.org/aubio/aubio>`_ 41 * `Appveyor Continuous integration page <https://ci.appveyor.com/project/piem/aubio>`_ 42 * `Landscape python code validation <https://landscape.io/github/aubio/aubio/master>`_ 43 * `ReadTheDocs documentation <https://aubio.readthedocs.io/en/latest/>`_ 12 44 13 45 Features … … 31 63 found in the results. 32 64 65 Copyright 66 ========= 67 68 Copyright © 2003-2016 Paul Brossier <piem@aubio.org> 69 70 License 71 ======= 72 73 aubio is a `free <http://www.debian.org/intro/free>`_ and `open source 74 <http://www.opensource.org/docs/definition.php>`_ software; **you** can 75 redistribute it and/or modify it under the terms of the `GNU 76 <https://www.gnu.org/>`_ `General Public License 77 <https://www.gnu.org/licenses/gpl.html>`_ as published by the `Free Software 78 Foundation <https://fsf.org>`_, either version 3 of the License, or (at your 79 option) any later version. 80 81 .. note:: 82 83 aubio is not MIT or BSD licensed. Contact the author if you need it in your 84 commercial product. 85 33 86 Content 34 87 ======= … … 38 91 39 92 installing 93 python_module 40 94 cli 41 python_module42 95 develop 43 44 Project pages45 =============46 47 * `Project homepage`_: https://aubio.org48 * `aubio on github`_: https://github.com/aubio/aubio49 * `aubio on pypi`_: https://pypi.python.org/pypi/aubio50 * `Doxygen documentation`_: https://aubio.org/doc/latest/51 * `Mailing lists`_: https://lists.aubio.org52 53 .. _Project homepage: https://aubio.org54 .. _aubio on github: https://github.com/aubio/aubio55 .. _aubio on pypi: https://pypi.python.org/pypi/aubio56 .. _Doxygen documentation: https://aubio.org/doc/latest/57 .. _Mailing lists: https://lists.aubio.org/58 59 Current status60 ==============61 62 .. image:: https://travis-ci.org/aubio/aubio.svg?branch=master63 :target: https://travis-ci.org/aubio/aubio64 :alt: Travis build status65 66 .. image:: https://ci.appveyor.com/api/projects/status/f3lhy3a57rkgn5yi?svg=true67 :target: https://ci.appveyor.com/project/piem/aubio/68 :alt: Appveyor build status69 70 .. image:: https://landscape.io/github/aubio/aubio/master/landscape.svg?style=flat71 :target: https://landscape.io/github/aubio/aubio/master72 :alt: Landscape code health73 74 .. image:: https://readthedocs.org/projects/aubio/badge/?version=latest75 :target: http://aubio.readthedocs.io/en/latest/?badge=latest76 :alt: Documentation status77 78 .. image:: https://img.shields.io/github/commits-since/aubio/aubio/0.4.3.svg?maxAge=259200079 :target: https://github.com/aubio/aubio80 :alt: Commits since last release81 82 * `Travis Continuous integration page <https://travis-ci.org/aubio/aubio>`_83 * `Appveyor Continuous integration page <https://ci.appveyor.com/project/piem/aubio>`_84 * `Landscape python code validation <https://landscape.io/github/aubio/aubio/master>`_85 * `ReadTheDocs documentation <http://aubio.readthedocs.io/en/latest/>`_86 87 Copyright and License88 =====================89 90 Copyright © 2003-2016 Paul Brossier <piem@aubio.org>91 92 aubio is a `free <http://www.debian.org/intro/free>`_ and `open source93 <http://www.opensource.org/docs/definition.php>`_ software; **you** can94 redistribute it and/or modify it under the terms of the `GNU95 <http://www.gnu.org/>`_ `General Public License96 <https://www.gnu.org/licenses/gpl.html>`_ as published by the `Free Software97 Foundation <https://fsf.org>`_, either version 3 of the License, or (at your98 option) any later version.99 100 .. Note:: aubio is not MIT or BSD licensed. Contact the author if you need it101 in your commercial product. -
doc/installing.rst
r71f2e5f r41b985f 16 16 17 17 download 18 building 18 19 requirements 19 building -
doc/python_module.rst
r71f2e5f r41b985f 30 30 31 31 Once you have python-aubio installed, you should be able to run ``python -c 32 "import aubio "``.32 "import aubio; print(aubio.version)"``. 33 33 34 34 A simple example -
doc/requirements.rst
r71f2e5f r41b985f 1 1 .. _requirements: 2 2 3 Requirements4 ============5 6 While aubio can be built without any external dependencies, we **recommend** to7 use at least some of the following libraries.8 9 Platform notes10 --------------11 12 On all platforms, you will need to have installed:13 14 - a compiler (gcc, clang, msvc, ...)15 - python (any version >= 2.7, including 3.x)16 - a terminal to run command lines in17 18 Linux19 .....20 21 The following `External libraries`_ will be used if found: `libav`_,22 `libsamplerate`_, `libsndfile`_, `libfftw3`_.23 24 macOS25 .....26 27 The following system frameworks will be used on Mac OS X systems:28 29 - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute30 FFTs and other vectorized operations optimally.31 32 - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and33 `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to34 decode audio from files and network streams.35 36 .. note::37 38 To build a fat binary for both ``i386`` and ``x86_64``, use ``./waf configure39 --enable-fat``.40 41 The following `External libraries`_ will also be checked: `libav`_,42 `libsamplerate`_, `libsndfile`_, `libfftw3`_.43 44 Windows45 .......46 47 To use a specific version of the compiler, ``--msvc_version``. To build for a48 specific architecture, use ``--msvc_target``. For instance, to build aubio49 for ``x86`` using ``msvc 12.0``, use:50 51 .. code:: bash52 53 waf configure --msvc_version='msvc 12.0' --msvc_target='x86'54 55 56 The following `External libraries`_ will be used if found: `libav`_,57 `libsamplerate`_, `libsndfile`_, `libfftw3`_.58 59 iOS60 ...61 62 The following system frameworks will be used on iOS and iOS Simulator.63 64 - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute65 FFTs and other vectorized operations optimally.66 67 - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and68 `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to69 decode audio from files and network streams.70 71 To build aubio for iOS, configure with ``--with-target-platform=ios``. For the72 iOS Simulator, use ``--with-target-platform=iosimulator`` instead.73 74 By default, aubio is built with the following flags on iOS:75 76 .. code:: bash77 78 CFLAGS="-fembed-bitcode -arch arm64 -arch armv7 -arch armv7s -miphoneos-version-min=6.1"79 80 and on iOS Simulator:81 82 .. code::83 84 CFLAGS="-arch i386 -arch x86_64 -mios-simulator-version-min=6.1"85 86 Set ``CFLAGS`` and ``LINKFLAGS`` to change these default values, or edit87 ``wscript`` directly.88 89 3 Build options 90 ------------- 91 92 Some additional options can be passed to the configure step. For the complete 93 list of options, run: 94 95 .. code:: bash 96 97 $ ./waf configure --help 98 99 Double precision 100 ................ 101 102 To compile aubio in double precision mode, configure with ``--enable-double``. 103 104 To compile aubio in single precision mode, use ``--disable-double`` (default). 105 106 Fat binary 107 .......... 108 109 To build a fat binary on Mac OS platforms, configure with ``--enable-fat``. 4 ============= 5 6 If built without any external dependencies aubio can be somewhat useful, for 7 instance to read, process, and write simple wav files. 8 9 To support more media input formas add more features to aubio, you can use one 10 or all of the `following libraries <extlibs>`_. 11 12 You may also want to know more about the `other options`_ and the `platform 13 notes`_ 14 15 The configure script will automatically for these extra libraries. To make sure 16 the library or feature is used, pass the `--enable-flag` to waf. To disable 17 this feature, use `--disable-feature`. 18 19 To find out more about the build commands, use the `--verbose` option. 110 20 111 21 External libraries … … 183 93 configure with ``--disable-fftw3`` 184 94 185 External tools95 Platform notes 186 96 -------------- 187 97 188 If the following tools are found, additional documentations are built: 98 On all platforms, you will need to have installed: 99 100 - a compiler (gcc, clang, msvc, ...) 101 - python (any version >= 2.7, including 3.x) 102 - a terminal to run command lines in 103 104 Linux 105 ..... 106 107 The following `External libraries`_ will be used if found: `libav`_, 108 `libsamplerate`_, `libsndfile`_, `libfftw3`_. 109 110 macOS 111 ..... 112 113 The following system frameworks will be used on Mac OS X systems: 114 115 - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute 116 FFTs and other vectorized operations optimally. 117 118 - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and 119 `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to 120 decode audio from files and network streams. 121 122 .. note:: 123 124 To build a fat binary for both ``i386`` and ``x86_64``, use ``./waf configure 125 --enable-fat``. 126 127 The following `External libraries`_ will also be checked: `libav`_, 128 `libsamplerate`_, `libsndfile`_, `libfftw3`_. 129 130 To build a fat binary on a darwin like system (macOS, tvOS, appleOS, ...) 131 platforms, configure with ``--enable-fat``. 132 133 Windows 134 ....... 135 136 To use a specific version of the compiler, ``--msvc_version``. To build for a 137 specific architecture, use ``--msvc_target``. For instance, to build aubio 138 for ``x86`` using ``msvc 12.0``, use: 139 140 .. code:: bash 141 142 waf configure --msvc_version='msvc 12.0' --msvc_target='x86' 143 144 145 The following `External libraries`_ will be used if found: `libav`_, 146 `libsamplerate`_, `libsndfile`_, `libfftw3`_. 147 148 iOS 149 ... 150 151 The following system frameworks will be used on iOS and iOS Simulator. 152 153 - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute 154 FFTs and other vectorized operations optimally. 155 156 - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and 157 `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to 158 decode audio from files and network streams. 159 160 To build aubio for iOS, configure with ``--with-target-platform=ios``. For the 161 iOS Simulator, use ``--with-target-platform=iosimulator`` instead. 162 163 By default, aubio is built with the following flags on iOS: 164 165 .. code:: bash 166 167 CFLAGS="-fembed-bitcode -arch arm64 -arch armv7 -arch armv7s -miphoneos-version-min=6.1" 168 169 and on iOS Simulator: 170 171 .. code:: 172 173 CFLAGS="-arch i386 -arch x86_64 -mios-simulator-version-min=6.1" 174 175 Set ``CFLAGS`` and ``LINKFLAGS`` to change these default values, or edit 176 ``wscript`` directly. 177 178 Other options 179 ------------- 180 181 Some additional options can be passed to the configure step. For the complete 182 list of options, run: 183 184 .. code:: bash 185 186 $ ./waf --help 187 188 Here is an example of a custom command: 189 190 .. code:: bash 191 192 $ ./waf --verbose configure build install \ 193 --enable-avcodec --enable-wavread --disable-wavwrite \ 194 --enable-sndfile --enable-samplerate --enable-docs \ 195 --destdir $PWD/build/destdir --testcmd="echo %s" \ 196 --prefix=/opt --libdir=/opt/lib/multiarch \ 197 --manpagesdir=/opt/share/man \ 198 uninstall clean distclean dist distcheck 199 200 Double precision 201 ................ 202 203 To compile aubio in double precision mode, configure with ``--enable-double``. 204 205 To compile aubio in single precision mode, use ``--disable-double`` (default). 206 207 Disabling the tests 208 ................... 209 210 In some case, for instance when cross-compiling, unit tests should not be run. 211 Option ``--notests`` can be used for this purpose. The tests will not be 212 executed, but the binaries will be compiled, ensuring that linking against 213 libaubio works as expected. 214 215 .. note:: 216 217 The ``--notests`` option should be passed to both ``build`` and ``install`` 218 targets, otherwise waf will try to run them. 219 220 Edit wscript 221 ............ 222 223 Many of the options are gathered in the file `wscript`. a good starting point 224 when looking for additional options. 225 226 .. _build_docs: 227 228 Building the docs 229 ----------------- 230 231 If the following command line tools are found, the documentation will be built 232 built: 189 233 190 234 - `doxygen <http://doxygen.org>`_ to build the :ref:`doxygen-documentation`. 191 235 - `txt2man <https://github.com/mvertes/txt2man>`_ to build the :ref:`manpages` 236 - `sphinx <http://sphinx-doc.org>`_ to build this document 192 237 193 238 These tools are searched for in the current ``PATH`` environment variable. … … 196 241 To disable the documentation, configure with ``--disable-docs``. To build with 197 242 the documentation, configure with ``--enable-docs``. 198 -
doc/web.cfg
r71f2e5f r41b985f 39 39 # control system is used. 40 40 41 PROJECT_NUMBER = "0.4. 2~alpha"41 PROJECT_NUMBER = "0.4.5~alpha" 42 42 43 43 # Using the PROJECT_BRIEF tag one can provide an optional one line description … … 791 791 EXCLUDE = ../src/aubio_priv.h \ 792 792 ../src/mathutils.h \ 793 ../src/io/ioutils.h \ 793 794 ../src/io/audio_unit.h \ 794 795 ../src/io/source_sndfile.h \ … … 1484 1485 # This tag requires that the tag USE_MATHJAX is set to YES. 1485 1486 1486 MATHJAX_RELPATH = http ://cdn.mathjax.org/mathjax/latest1487 MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest 1487 1488 1488 1489 # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -
doc/xcode_frameworks.rst
r71f2e5f r41b985f 35 35 import aubio 36 36 37 Using aubio from swift 38 ...................... 39 40 Here is a short example showing how to read a sound file in swift: 41 42 43 .. code-block:: swift 44 45 import aubio 46 47 let path = Bundle.main.path(forResource: "example", ofType: "mp4") 48 if (path != nil) { 49 let hop_size : uint_t = 512 50 let a = new_fvec(hop_size) 51 let b = new_aubio_source(path, 0, hop_size) 52 var read: uint_t = 0 53 var total_frames : uint_t = 0 54 while (true) { 55 aubio_source_do(b, a, &read) 56 total_frames += read 57 if (read < hop_size) { break } 58 } 59 print("read", total_frames, "frames at", aubio_source_get_samplerate(b), "Hz") 60 del_aubio_source(b) 61 del_fvec(a) 62 } else { 63 print("could not find file") 64 } 65 66 37 67 .. _Binary frameworks: https://aubio.org/download 38 68 .. _iOS: https://aubio.org/download#ios -
examples/aubionotes.c
r71f2e5f r41b985f 35 35 // did we get a note off? 36 36 if (obuf->data[2] != 0) { 37 lastmidi = aubio_freqtomidi (obuf->data[2]) + .5;37 lastmidi = obuf->data[2]; 38 38 send_noteon(lastmidi, 0); 39 39 } 40 40 // did we get a note on? 41 41 if (obuf->data[0] != 0) { 42 lastmidi = aubio_freqtomidi (obuf->data[0]) + .5;42 lastmidi = obuf->data[0]; 43 43 send_noteon(lastmidi, obuf->data[1]); 44 44 } … … 70 70 if (notes == NULL) { ret = 1; goto beach; } 71 71 72 if (onset_minioi != 0.) { 73 aubio_notes_set_minioi_ms(notes, onset_minioi); 74 } 75 if (onset_threshold != 0.) { 76 errmsg ("warning: onset threshold not supported yet\n"); 77 //aubio_onset_set_threshold(aubio_notes_get_aubio_onset(o), onset_threshold); 78 } 79 if (silence_threshold != -90.) { 80 if (aubio_notes_set_silence (notes, silence_threshold) != 0) { 81 errmsg ("failed setting notes silence threshold to %.2f\n", 82 silence_threshold); 83 } 84 } 85 72 86 examples_common_process((aubio_process_func_t)process_block, process_print); 73 87 74 // send a last note off 75 send_noteon (lastmidi, 0); 88 // send a last note off if required 89 if (lastmidi) { 90 send_noteon (lastmidi, 0); 91 } 76 92 77 93 del_aubio_notes (notes); -
examples/aubioonset.c
r71f2e5f r41b985f 75 75 if (silence_threshold != -90.) 76 76 aubio_onset_set_silence (o, silence_threshold); 77 if (onset_minioi != 0.) 78 aubio_onset_set_minioi_s (o, onset_minioi); 77 79 78 80 onset = new_fvec (1); … … 85 87 86 88 // send a last note off 87 send_noteon (miditap_note, 0); 89 if (usejack) { 90 send_noteon (miditap_note, 0); 91 } 88 92 89 93 del_aubio_onset (o); -
examples/aubiotrack.c
r71f2e5f r41b985f 81 81 // aubio_tempo_set_silence(tempo, -1000.); 82 82 if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold); 83 if (onset_minioi != 0.) errmsg ("warning: minioio not supported yet\n"); 83 84 84 85 wavetable = new_aubio_wavetable (samplerate, hop_size); … … 89 90 90 91 // send a last note off 91 send_noteon (miditap_note, 0); 92 if (usejack) { 93 send_noteon (miditap_note, 0); 94 } 92 95 93 96 del_aubio_tempo(tempo); -
examples/parse_args.h
r71f2e5f r41b985f 37 37 extern char_t * onset_method; 38 38 extern smpl_t onset_threshold; 39 extern smpl_t onset_minioi; 39 40 // pitch stuff 40 41 extern char_t * pitch_method; … … 92 93 " -t --onset-threshold set onset detection threshold\n" 93 94 " a value between 0.1 (more detections) and 1 (less); default=0.3\n" 95 " -M --minioi set minimum inter-onset interval\n" 96 " a value in second; default=0.012\n" 94 97 #endif /* PROG_HAS_ONSET */ 95 98 #ifdef PROG_HAS_PITCH … … 115 118 #ifdef PROG_HAS_JACK 116 119 " -j --jack use Jack\n" 120 #if defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) 121 " -N --miditap-note MIDI note; default=69.\n" 122 " -V --miditap-velo MIDI velocity; default=65.\n" 123 #endif /* defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) */ 117 124 #endif /* PROG_HAS_JACK */ 118 125 " -v --verbose be verbose\n" … … 134 141 #ifdef PROG_HAS_JACK 135 142 "j" 143 #if defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) 144 "N:V:" 145 #endif /* defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) */ 136 146 #endif /* PROG_HAS_JACK */ 137 147 #ifdef PROG_HAS_OUTPUT … … 139 149 #endif /* PROG_HAS_OUTPUT */ 140 150 #ifdef PROG_HAS_ONSET 141 "O:t: "151 "O:t:M:" 142 152 #endif /* PROG_HAS_ONSET */ 143 153 #ifdef PROG_HAS_PITCH … … 162 172 #ifdef PROG_HAS_JACK 163 173 {"jack", 0, NULL, 'j'}, 174 #if defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) 175 {"miditap-note", 1, NULL, 'N'}, 176 {"miditap-velo", 1, NULL, 'V'}, 177 #endif /* PROG_HAS_ONSET !PROG_HAS_PITCH */ 164 178 #endif /* PROG_HAS_JACK */ 165 179 #ifdef PROG_HAS_OUTPUT … … 169 183 {"onset", 1, NULL, 'O'}, 170 184 {"onset-threshold", 1, NULL, 't'}, 185 {"onset-minioi", 1, NULL, 'M'}, 171 186 #endif /* PROG_HAS_ONSET */ 172 187 #ifdef PROG_HAS_PITCH … … 204 219 usejack = 1; 205 220 break; 221 case 'N': 222 miditap_note = (smpl_t) atoi (optarg); 223 break; 224 case 'V': 225 miditap_velo = (smpl_t) atoi (optarg); 226 break; 206 227 case 'i': 207 228 source_uri = optarg; … … 227 248 case 't': /* threshold value for onset */ 228 249 onset_threshold = (smpl_t) atof (optarg); 250 break; 251 case 'M': /* minimum inter-onset-interval */ 252 onset_minioi = (smpl_t) atof (optarg); 229 253 break; 230 254 case 'p': -
examples/utils.c
r71f2e5f r41b985f 44 44 char_t * onset_method = "default"; 45 45 smpl_t onset_threshold = 0.0; // will be set if != 0. 46 smpl_t onset_minioi = 0.0; // will be set if != 0. 46 47 // pitch stuff 47 48 char_t * pitch_unit = "default"; … … 76 77 #if HAVE_JACK 77 78 aubio_jack_t *jack_setup; 79 jack_midi_event_t ev; 78 80 #endif /* HAVE_JACK */ 79 81 … … 127 129 void examples_common_del (void) 128 130 { 131 #ifdef HAVE_JACK 132 if (ev.buffer) free(ev.buffer); 133 #endif 129 134 del_fvec (ibuf); 130 135 del_fvec (obuf); … … 142 147 143 148 #ifdef HAVE_JACK 149 ev.size = 3; 150 ev.buffer = malloc (3 * sizeof (jack_midi_data_t)); 151 ev.time = 0; // send it now 144 152 debug ("Jack activation ...\n"); 145 153 aubio_jack_activate (jack_setup, process_func); … … 185 193 { 186 194 #ifdef HAVE_JACK 187 jack_midi_event_t ev;188 ev.size = 3;189 ev.buffer = malloc (3 * sizeof (jack_midi_data_t)); // FIXME190 ev.time = 0;191 195 if (usejack) { 192 196 ev.buffer[2] = velo; -
python/README.md
r71f2e5f r41b985f 36 36 ------------------------- 37 37 38 Python tests are in `python/tests` and use the [nose2 python package][nose2]. 39 38 40 To run the all the python tests, use the script: 39 41 … … 43 45 44 46 $ ./python/tests/test_note2midi.py -v 47 48 [nose2]: https://github.com/nose-devs/nose2 45 49 46 50 Install in a virtualenv -
python/demos/demo_timestretch_online.py
r71f2e5f r41b985f 12 12 import numpy as np 13 13 14 win_s = 102414 win_s = 512 15 15 hop_s = win_s // 8 # 87.5 % overlap 16 16 … … 93 93 old_grain.phas = np.copy(cur_grain.phas) 94 94 95 # until end of file 96 if read < hop_s: break 97 # increment block counter 95 98 block_read += 1 96 if read < hop_s: break97 99 98 100 for t in range(warmup + 2): # purge the last frames from the phase vocoder -
python/ext/aubio-types.h
r71f2e5f r41b985f 28 28 #include "aubio.h" 29 29 #else 30 #include "aubio/aubio.h"30 #include <aubio/aubio.h> 31 31 #endif 32 32 … … 45 45 #define AUBIO_NPY_SMPL_STR "float32" 46 46 #define AUBIO_NPY_SMPL_CHR "f" 47 #endif 48 49 #ifndef PATH_MAX 50 #ifdef MAX_PATH 51 #define PATH_MAX MAX_PATH 52 #else 53 #define PATH_MAX 1024 54 #endif 47 55 #endif 48 56 -
python/ext/aubiomodule.c
r71f2e5f r41b985f 2 2 #include "aubio-types.h" 3 3 #include "py-musicutils.h" 4 5 // this dummy macro is used to convince windows that a string passed as -D flag 6 // is just that, a string, and not a double. 7 #define REDEFINESTRING(x) #x 8 #define DEFINEDSTRING(x) REDEFINESTRING(x) 4 9 5 10 static char aubio_module_doc[] = "Python module for the aubio library"; … … 324 329 325 330 PyModule_AddStringConstant(m, "float_type", AUBIO_NPY_SMPL_STR); 331 PyModule_AddStringConstant(m, "__version__", DEFINEDSTRING(AUBIO_VERSION)); 326 332 327 333 // add generated objects -
python/ext/py-cvec.c
r71f2e5f r41b985f 148 148 if (length != vec->length) { 149 149 PyErr_Format (PyExc_ValueError, 150 "input array has length % ld, but cvec has length %d", length,150 "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length, 151 151 vec->length); 152 152 return 1; … … 169 169 if (length != vec->length) { 170 170 PyErr_Format (PyExc_ValueError, 171 "input array has length % ld, but cvec has length %d", length,171 "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length, 172 172 vec->length); 173 173 return 1; -
python/ext/py-sink.c
r71f2e5f r41b985f 81 81 } 82 82 83 self->uri = "none";83 self->uri = NULL; 84 84 if (uri != NULL) { 85 self->uri = uri; 85 self->uri = (char_t *)malloc(sizeof(char_t) * (strnlen(uri, PATH_MAX) + 1)); 86 strncpy(self->uri, uri, strnlen(uri, PATH_MAX) + 1); 86 87 } 87 88 88 89 self->samplerate = Py_aubio_default_samplerate; 89 if ( (sint_t)samplerate >0) {90 if (samplerate != 0) { 90 91 self->samplerate = samplerate; 91 } else if ((sint_t)samplerate < 0) {92 PyErr_SetString (PyExc_ValueError,93 "can not use negative value for samplerate");94 return NULL;95 92 } 96 93 97 94 self->channels = 1; 98 if ( (sint_t)channels >0) {95 if (channels != 0) { 99 96 self->channels = channels; 100 } else if ((sint_t)channels < 0) {101 PyErr_SetString (PyExc_ValueError,102 "can not use negative or null value for channels");103 return NULL;104 97 } 105 98 … … 110 103 Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds) 111 104 { 112 if (self->channels == 1) { 113 self->o = new_aubio_sink ( self->uri, self->samplerate ); 114 } else { 115 self->o = new_aubio_sink ( self->uri, 0 ); 116 aubio_sink_preset_channels ( self->o, self->channels ); 117 aubio_sink_preset_samplerate ( self->o, self->samplerate ); 118 } 105 self->o = new_aubio_sink ( self->uri, 0 ); 119 106 if (self->o == NULL) { 120 PyErr_SetString (PyExc_RuntimeError, "error creating sink with this uri");107 // error string was set in new_aubio_sink 121 108 return -1; 122 109 } 110 if (aubio_sink_preset_channels(self->o, self->channels) != 0) { 111 // error string was set in aubio_sink_preset_channels 112 return -1; 113 } 114 if (aubio_sink_preset_samplerate(self->o, self->samplerate) != 0) { 115 // error string was set in aubio_sink_preset_samplerate 116 return -1; 117 } 118 123 119 self->samplerate = aubio_sink_get_samplerate ( self->o ); 124 120 self->channels = aubio_sink_get_channels ( self->o ); … … 132 128 del_aubio_sink(self->o); 133 129 free(self->mwrite_data.data); 130 if (self->uri) { 131 free(self->uri); 132 } 134 133 Py_TYPE(self)->tp_free((PyObject *) self); 135 134 } … … 205 204 } 206 205 206 static char Pyaubio_sink_enter_doc[] = ""; 207 static PyObject* Pyaubio_sink_enter(Py_sink *self, PyObject *unused) { 208 Py_INCREF(self); 209 return (PyObject*)self; 210 } 211 212 static char Pyaubio_sink_exit_doc[] = ""; 213 static PyObject* Pyaubio_sink_exit(Py_sink *self, PyObject *unused) { 214 return Pyaubio_sink_close(self, unused); 215 } 216 207 217 static PyMethodDef Py_sink_methods[] = { 208 218 {"do", (PyCFunction) Py_sink_do, METH_VARARGS, Py_sink_do_doc}, 209 219 {"do_multi", (PyCFunction) Py_sink_do_multi, METH_VARARGS, Py_sink_do_multi_doc}, 210 220 {"close", (PyCFunction) Pyaubio_sink_close, METH_NOARGS, Py_sink_close_doc}, 221 {"__enter__", (PyCFunction)Pyaubio_sink_enter, METH_NOARGS, 222 Pyaubio_sink_enter_doc}, 223 {"__exit__", (PyCFunction)Pyaubio_sink_exit, METH_VARARGS, 224 Pyaubio_sink_exit_doc}, 211 225 {NULL} /* sentinel */ 212 226 }; -
python/ext/py-source.c
r71f2e5f r41b985f 101 101 } 102 102 103 self->uri = "none";103 self->uri = NULL; 104 104 if (uri != NULL) { 105 self->uri = uri; 105 self->uri = (char_t *)malloc(sizeof(char_t) * (strnlen(uri, PATH_MAX) + 1)); 106 strncpy(self->uri, uri, strnlen(uri, PATH_MAX) + 1); 106 107 } 107 108 … … 163 164 del_aubio_source(self->o); 164 165 free(self->c_mread_to.data); 166 } 167 if (self->uri) { 168 free(self->uri); 165 169 } 166 170 Py_XDECREF(self->read_to); … … 243 247 Pyaubio_source_close (Py_source *self, PyObject *unused) 244 248 { 245 aubio_source_close (self->o);249 if (aubio_source_close(self->o) != 0) return NULL; 246 250 Py_RETURN_NONE; 247 251 } … … 271 275 } 272 276 Py_RETURN_NONE; 277 } 278 279 static char Pyaubio_source_enter_doc[] = ""; 280 static PyObject* Pyaubio_source_enter(Py_source *self, PyObject *unused) { 281 Py_INCREF(self); 282 return (PyObject*)self; 283 } 284 285 static char Pyaubio_source_exit_doc[] = ""; 286 static PyObject* Pyaubio_source_exit(Py_source *self, PyObject *unused) { 287 return Pyaubio_source_close(self, unused); 288 } 289 290 static PyObject* Pyaubio_source_iter(PyObject *self) { 291 Py_INCREF(self); 292 return (PyObject*)self; 293 } 294 295 static PyObject* Pyaubio_source_iter_next(Py_source *self) { 296 PyObject *done, *size; 297 if (self->channels == 1) { 298 done = Py_source_do(self, NULL); 299 } else { 300 done = Py_source_do_multi(self, NULL); 301 } 302 if (!PyTuple_Check(done)) { 303 PyErr_Format(PyExc_ValueError, 304 "error when reading source: not opened?"); 305 return NULL; 306 } 307 size = PyTuple_GetItem(done, 1); 308 if (size != NULL && PyLong_Check(size)) { 309 if (PyLong_AsLong(size) == (long)self->hop_size) { 310 PyObject *vec = PyTuple_GetItem(done, 0); 311 return vec; 312 } else if (PyLong_AsLong(size) > 0) { 313 // short read, return a shorter array 314 PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0); 315 PyArray_Dims newdims; 316 PyObject *reshaped; 317 newdims.len = PyArray_NDIM(shortread); 318 newdims.ptr = PyArray_DIMS(shortread); 319 // mono or multiple channels? 320 if (newdims.len == 1) { 321 newdims.ptr[0] = PyLong_AsLong(size); 322 } else { 323 newdims.ptr[1] = PyLong_AsLong(size); 324 } 325 reshaped = PyArray_Newshape(shortread, &newdims, NPY_CORDER); 326 Py_DECREF(shortread); 327 return reshaped; 328 } else { 329 PyErr_SetNone(PyExc_StopIteration); 330 return NULL; 331 } 332 } else { 333 PyErr_SetNone(PyExc_StopIteration); 334 return NULL; 335 } 273 336 } 274 337 … … 286 349 {"seek", (PyCFunction) Pyaubio_source_seek, 287 350 METH_VARARGS, Py_source_seek_doc}, 351 {"__enter__", (PyCFunction)Pyaubio_source_enter, METH_NOARGS, 352 Pyaubio_source_enter_doc}, 353 {"__exit__", (PyCFunction)Pyaubio_source_exit, METH_VARARGS, 354 Pyaubio_source_exit_doc}, 288 355 {NULL} /* sentinel */ 289 356 }; … … 315 382 0, 316 383 0, 317 0,318 0,384 Pyaubio_source_iter, 385 (unaryfunc)Pyaubio_source_iter_next, 319 386 Py_source_methods, 320 387 Py_source_members, -
python/lib/aubio/__init__.py
r71f2e5f r41b985f 2 2 3 3 import numpy 4 from ._aubio import __version__ as version 5 from ._aubio import float_type 4 6 from ._aubio import * 5 from ._aubio import float_type6 7 from .midiconv import * 7 8 from .slicing import * -
python/lib/aubio/midiconv.py
r71f2e5f r41b985f 16 16 " convert note name to midi note number, e.g. [C-1, G9] -> [0, 127] " 17 17 _valid_notenames = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11} 18 _valid_modifiers = {None: 0, u'♮': 0, '#': +1, u'♯': +1, u'\udd2a': +2, 19 'b': -1, u'♭': -1, u'\ufffd': -2} 18 _valid_modifiers = { 19 u'𝄫': -2, # double flat 20 u'♭': -1, 'b': -1, '\u266d': -1, # simple flat 21 u'♮': 0, '\u266e': 0, None: 0, # natural 22 '#': +1, u'♯': +1, '\u266f': +1, # sharp 23 u'𝄪': +2, # double sharp 24 } 20 25 _valid_octaves = range(-1, 10) 21 26 if not isinstance(note, str_instances): -
python/lib/gen_external.py
r71f2e5f r41b985f 15 15 'filter', 16 16 'filterbank', 17 #'resampler',18 17 # AUBIO_UNSTABLE 19 18 'hist', … … 79 78 return cpp_cmd 80 79 81 def get_cpp_objects(header=header ):80 def get_cpp_objects(header=header, usedouble=False): 82 81 cpp_cmd = get_preprocessor() 83 82 84 83 macros = [('AUBIO_UNSTABLE', 1)] 84 if usedouble: 85 macros += [('HAVE_AUBIO_DOUBLE', 1)] 85 86 86 87 if not os.path.isfile(header): … … 180 181 elif not overwrite: return sorted(glob.glob(os.path.join(output_path, '*.c'))) 181 182 182 cpp_output, cpp_objects = get_cpp_objects(header )183 cpp_output, cpp_objects = get_cpp_objects(header, usedouble=usedouble) 183 184 184 185 lib = analyze_cpp_output(cpp_objects, cpp_output) … … 251 252 # no need to add header to list of sources 252 253 253 return so urces_list254 return sorted(sources_list) 254 255 255 256 if __name__ == '__main__': -
python/lib/moresetuptools.py
r71f2e5f r41b985f 4 4 import distutils, distutils.command.clean, distutils.dir_util 5 5 from .gen_external import generate_external, header, output_path 6 7 def get_aubio_version(): 8 # read from VERSION 9 this_file_dir = os.path.dirname(os.path.abspath(__file__)) 10 version_file = os.path.join(this_file_dir, '..', '..', 'VERSION') 11 12 if not os.path.isfile(version_file): 13 raise SystemError("VERSION file not found.") 14 15 for l in open(version_file).readlines(): 16 #exec (l.strip()) 17 if l.startswith('AUBIO_MAJOR_VERSION'): 18 AUBIO_MAJOR_VERSION = int(l.split('=')[1]) 19 if l.startswith('AUBIO_MINOR_VERSION'): 20 AUBIO_MINOR_VERSION = int(l.split('=')[1]) 21 if l.startswith('AUBIO_PATCH_VERSION'): 22 AUBIO_PATCH_VERSION = int(l.split('=')[1]) 23 if l.startswith('AUBIO_VERSION_STATUS'): 24 AUBIO_VERSION_STATUS = l.split('=')[1].strip()[1:-1] 25 26 if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \ 27 or AUBIO_PATCH_VERSION is None: 28 raise SystemError("Failed parsing VERSION file.") 29 30 verstr = '.'.join(map(str, [AUBIO_MAJOR_VERSION, 31 AUBIO_MINOR_VERSION, 32 AUBIO_PATCH_VERSION])) 33 34 if AUBIO_VERSION_STATUS is not None: 35 verstr += AUBIO_VERSION_STATUS 36 return verstr 37 38 def get_aubio_pyversion(): 39 # convert to version for python according to pep 440 40 # see https://www.python.org/dev/peps/pep-0440/ 41 verstr = get_aubio_version() 42 if '~alpha' in verstr: 43 verstr = verstr.split('~')[0] + 'a1' 44 # TODO: add rc, .dev, and .post suffixes, add numbering 45 return verstr 6 46 7 47 # inspired from https://gist.github.com/abergmeier/9488990 … … 22 62 23 63 for package in packages: 64 print("checking for {:s}".format(package)) 24 65 cmd = ['pkg-config', '--libs', '--cflags', package] 25 66 try: … … 53 94 ext.libraries += ['aubio'] 54 95 55 def add_local_aubio_sources(ext ):96 def add_local_aubio_sources(ext, usedouble = False): 56 97 """ build aubio inside python module instead of linking against libaubio """ 57 print("Warning: libaubio was not built with waf, adding src/") 58 # create an empty header, macros will be passed on the command line 59 fake_config_header = os.path.join('python', 'ext', 'config.h') 60 distutils.file_util.write_file(fake_config_header, "") 98 print("Info: libaubio was not installed or built locally with waf, adding src/") 61 99 aubio_sources = sorted(glob.glob(os.path.join('src', '**.c'))) 62 100 aubio_sources += sorted(glob.glob(os.path.join('src', '*', '**.c'))) 63 101 ext.sources += aubio_sources 102 103 def add_local_macros(ext, usedouble = False): 64 104 # define macros (waf puts them in build/src/config.h) 65 105 for define_macro in ['HAVE_STDLIB_H', 'HAVE_STDIO_H', … … 70 110 ext.define_macros += [(define_macro, 1)] 71 111 112 def add_external_deps(ext, usedouble = False): 72 113 # loof for additional packages 73 114 print("Info: looking for *optional* additional packages") 74 115 packages = ['libavcodec', 'libavformat', 'libavutil', 'libavresample', 75 116 'jack', 76 'sndfile', 'samplerate', 117 'sndfile', 118 'samplerate', 77 119 'rubberband', 78 120 #'fftw3f', 79 121 ] 122 # samplerate only works with float 123 if usedouble is False: 124 packages += ['samplerate'] 125 else: 126 print("Info: not adding libsamplerate in double precision mode") 80 127 add_packages(packages, ext=ext) 81 128 if 'avcodec' in ext.libraries \ … … 116 163 def add_system_aubio(ext): 117 164 # use pkg-config to find aubio's location 118 add_packages(['aubio'], ext) 165 aubio_version = get_aubio_version() 166 add_packages(['aubio = ' + aubio_version], ext) 119 167 if 'aubio' not in ext.libraries: 120 print("Error: libaubio not found") 168 print("Info: aubio " + aubio_version + " was not found by pkg-config") 169 else: 170 print("Info: using system aubio " + aubio_version + " found in " + ' '.join(ext.library_dirs)) 121 171 122 172 class CleanGenerated(distutils.command.clean.clean): 123 173 def run(self): 124 distutils.dir_util.remove_tree(output_path)125 distutils.command.clean.clean.run(self)174 if os.path.isdir(output_path): 175 distutils.dir_util.remove_tree(output_path) 126 176 127 177 from distutils.command.build_ext import build_ext as _build_ext … … 145 195 146 196 def build_extension(self, extension): 147 if self.enable_double :197 if self.enable_double or 'HAVE_AUBIO_DOUBLE' in os.environ: 148 198 extension.define_macros += [('HAVE_AUBIO_DOUBLE', 1)] 149 if os.path.isfile('src/aubio.h'): 150 # if aubio headers are found in this directory 151 add_local_aubio_header(extension) 152 # was waf used to build the shared lib? 153 if os.path.isdir(os.path.join('build','src')): 154 # link against build/src/libaubio, built with waf 199 enable_double = True 200 else: 201 enable_double = False 202 # seack for aubio headers and lib in PKG_CONFIG_PATH 203 add_system_aubio(extension) 204 # the lib was not installed on this system 205 if 'aubio' not in extension.libraries: 206 # use local src/aubio.h 207 if os.path.isfile(os.path.join('src', 'aubio.h')): 208 add_local_aubio_header(extension) 209 add_local_macros(extension) 210 # look for a local waf build 211 if os.path.isfile(os.path.join('build','src', 'fvec.c.1.o')): 155 212 add_local_aubio_lib(extension) 156 213 else: 214 # check for external dependencies 215 add_external_deps(extension, usedouble=enable_double) 157 216 # add libaubio sources and look for optional deps with pkg-config 158 add_local_aubio_sources(extension, usedouble=self.enable_double) 159 else: 160 # look for aubio headers and lib using pkg-config 161 add_system_aubio(extension) 217 add_local_aubio_sources(extension, usedouble=enable_double) 162 218 # generate files python/gen/*.c, python/gen/aubio-generated.h 163 219 extension.sources += generate_external(header, output_path, overwrite = False, 164 usedouble= self.enable_double)220 usedouble=enable_double) 165 221 return _build_ext.build_extension(self, extension) -
python/scripts/aubiocut
r71f2e5f r41b985f 6 6 7 7 import sys 8 #from aubio.task import *9 8 10 9 usage = "usage: %s [options] -i soundfile" % sys.argv[0] … … 118 117 action = "store", dest = "cut_until_nsamples", default = None, 119 118 help="how many extra samples should be added at the end of each slice") 119 parser.add_option("--cut-every-nslices", type = int, 120 metavar = "<samples>", 121 action = "store", dest = "cut_every_nslices", default = None, 122 help="how many slices should be groupped together at each cut") 120 123 parser.add_option("--cut-until-nslices", type = int, 121 124 metavar = "<slices>", … … 188 191 from aubio.slicing import slice_source_at_stamps 189 192 timestamps_end = None 193 if options.cut_every_nslices: 194 timestamps = timestamps[::options.cut_every_nslices] 195 nstamps = len(timestamps) 190 196 if options.cut_until_nslices and options.cut_until_nsamples: 191 197 print ("warning: using cut_until_nslices, but cut_until_nsamples is set") -
python/tests/eval_pitch
r71f2e5f r41b985f 25 25 import os.path 26 26 import numpy 27 from utils import array_from_text_file, array_from_yaml_file27 from .utils import array_from_text_file, array_from_yaml_file 28 28 from aubio import source, pitch, freqtomidi 29 29 -
python/tests/test_aubio.py
r71f2e5f r41b985f 10 10 import aubio 11 11 12 def test_version(self): 13 """ test aubio.version """ 14 import aubio 15 self.assertEqual('0', aubio.version[0]) 16 12 17 if __name__ == '__main__': 13 18 main() -
python/tests/test_fft.py
r71f2e5f r41b985f 34 34 fftgrain = f (timegrain) 35 35 assert_equal ( fftgrain.norm, 0 ) 36 assert_equal ( fftgrain.phas, 0 ) 36 try: 37 assert_equal ( fftgrain.phas, 0 ) 38 except AssertionError: 39 assert_equal (fftgrain.phas[fftgrain.phas > 0], +pi) 40 assert_equal (fftgrain.phas[fftgrain.phas < 0], -pi) 41 assert_equal (np.abs(fftgrain.phas[np.abs(fftgrain.phas) != pi]), 0) 42 self.skipTest('fft(fvec(%d)).phas != +0, ' % win_s \ 43 + 'This is expected when using fftw3 on powerpc.') 37 44 38 45 def test_impulse(self): -
python/tests/test_filter.py
r71f2e5f r41b985f 4 4 from numpy.testing import TestCase, assert_equal, assert_almost_equal 5 5 from aubio import fvec, digital_filter 6 from utils import array_from_text_file6 from .utils import array_from_text_file 7 7 8 8 class aubio_filter_test_case(TestCase): -
python/tests/test_filterbank.py
r71f2e5f r41b985f 6 6 import numpy as np 7 7 from aubio import cvec, filterbank, float_type 8 from utils import array_from_text_file8 from .utils import array_from_text_file 9 9 10 10 class aubio_filterbank_test_case(TestCase): -
python/tests/test_midi2note.py
r71f2e5f r41b985f 3 3 4 4 from aubio import midi2note 5 from nose2.tools import params 5 6 import unittest 6 7 … … 17 18 class midi2note_good_values(unittest.TestCase): 18 19 19 def test_midi2note_known_values(self): 20 @params(*list_of_known_midis) 21 def test_midi2note_known_values(self, midi, note): 20 22 " known values are correctly converted " 21 for midi, note in list_of_known_midis: 22 self.assertEqual ( midi2note(midi), note ) 23 self.assertEqual ( midi2note(midi), note ) 23 24 24 25 class midi2note_wrong_values(unittest.TestCase): … … 41 42 42 43 if __name__ == '__main__': 43 unittest.main() 44 import nose2 45 nose2.main() -
python/tests/test_note2midi.py
r71f2e5f r41b985f 5 5 6 6 from aubio import note2midi, freq2note 7 from nose2.tools import params 7 8 import unittest 8 9 … … 14 15 ( 'B3', 59 ), 15 16 ( 'B#3', 60 ), 17 ( 'C♯4', 61 ), 16 18 ( 'A4', 69 ), 17 19 ( 'A#4', 70 ), 20 ( 'A♯4', 70 ), 21 ( 'A\u266f4', 70 ), 18 22 ( 'Bb4', 70 ), 19 23 ( 'B♭4', 70 ), 24 ( 'B\u266d4', 70 ), 20 25 ( 'G8', 115 ), 21 26 ( 'G♯8', 116 ), 22 27 ( 'G9', 127 ), 23 ( 'G\udd2a2', 45 ),24 ( 'B\ufffd2', 45 ),25 28 ( 'A♮2', 45 ), 29 ) 30 31 list_of_known_notes_with_unicode_issues = ( 32 ('C𝄪4', 62 ), 33 ('E𝄫4', 62 ), 34 ) 35 36 list_of_unknown_notes = ( 37 ( 'G\udd2a2' ), 38 ( 'B\ufffd2' ), 39 ( 'B\u266e\u266e2' ), 40 ( 'B\u266f\u266d3' ), 41 ( 'B33' ), 42 ( 'C.3' ), 43 ( 'A' ), 44 ( '2' ), 26 45 ) 27 46 28 47 class note2midi_good_values(unittest.TestCase): 29 48 30 def test_note2midi_known_values(self): 49 @params(*list_of_known_notes) 50 def test_note2midi_known_values(self, note, midi): 31 51 " known values are correctly converted " 32 for note, midi in list_of_known_notes: 52 self.assertEqual ( note2midi(note), midi ) 53 54 @params(*list_of_known_notes_with_unicode_issues) 55 def test_note2midi_known_values_with_unicode_issues(self, note, midi): 56 " known values are correctly converted, unless decoding is expected to fail" 57 try: 33 58 self.assertEqual ( note2midi(note), midi ) 59 except UnicodeEncodeError as e: 60 import sys 61 strfmt = "len(u'\\U0001D12A') != 1, excpected decoding failure | {:s} | {:s} {:s}" 62 strres = strfmt.format(e, sys.platform, sys.version) 63 # happens with: darwin 2.7.10, windows 2.7.12 64 if len('\U0001D12A') != 1 and sys.version[0] == '2': 65 self.skipTest(strres + " | upgrade to Python 3 to fix") 66 else: 67 raise 34 68 35 69 class note2midi_wrong_values(unittest.TestCase): … … 67 101 self.assertRaises(TypeError, note2midi, 123) 68 102 103 def test_note2midi_wrong_data_too_long(self): 104 " fails when passed a note with a note name longer than expected" 105 self.assertRaises(ValueError, note2midi, 'CB+-3') 106 107 @params(*list_of_unknown_notes) 108 def test_note2midi_unknown_values(self, note): 109 " unknown values throw out an error " 110 self.assertRaises(ValueError, note2midi, note) 69 111 70 112 class freq2note_simple_test(unittest.TestCase): … … 75 117 76 118 if __name__ == '__main__': 77 unittest.main() 119 import nose2 120 nose2.main() -
python/tests/test_phasevoc.py
r71f2e5f r41b985f 47 47 assert_equal ( t, 0.) 48 48 assert_equal ( s.norm, 0.) 49 assert_equal ( s.phas, 0.) 49 try: 50 assert_equal ( s.phas, 0 ) 51 except AssertionError: 52 assert_equal (s.phas[s.phas > 0], +np.pi) 53 assert_equal (s.phas[s.phas < 0], -np.pi) 54 assert_equal (np.abs(s.phas[np.abs(s.phas) != np.pi]), 0) 55 self.skipTest('pvoc(fvec(%d)).phas != +0, ' % win_s \ 56 + 'This is expected when using fftw3 on powerpc.') 50 57 assert_equal ( r, 0.) 51 58 -
python/tests/test_sink.py
r71f2e5f r41b985f 5 5 from numpy.testing import TestCase 6 6 from aubio import fvec, source, sink 7 from utils import list_all_sounds, get_tmp_sink_path, del_tmp_sink_path 7 from .utils import list_all_sounds, get_tmp_sink_path, del_tmp_sink_path 8 9 import warnings 10 warnings.filterwarnings('ignore', category=UserWarning, append=True) 8 11 9 12 list_of_sounds = list_all_sounds('sounds') … … 26 29 if not len(list_of_sounds): 27 30 self.skipTest('add some sound files in \'python/tests/sounds\'') 31 32 def test_wrong_filename(self): 33 with self.assertRaises(RuntimeError): 34 sink('') 35 36 def test_wrong_samplerate(self): 37 with self.assertRaises(RuntimeError): 38 sink(get_tmp_sink_path(), -1) 39 40 def test_wrong_samplerate_too_large(self): 41 with self.assertRaises(RuntimeError): 42 sink(get_tmp_sink_path(), 1536001, 2) 43 44 def test_wrong_channels(self): 45 with self.assertRaises(RuntimeError): 46 sink(get_tmp_sink_path(), 44100, -1) 47 48 def test_wrong_channels_too_large(self): 49 with self.assertRaises(RuntimeError): 50 sink(get_tmp_sink_path(), 44100, 202020) 28 51 29 52 def test_many_sinks(self): … … 94 117 del_tmp_sink_path(sink_path) 95 118 119 def test_read_with(self): 120 sink_path =get_tmp_sink_path() 121 vec = fvec(128) 122 with sink(sink_path, samplerate) as g: 123 for i in range(10): 124 g(vec, 128) 125 96 126 if __name__ == '__main__': 97 127 main() -
python/tests/test_slicing.py
r71f2e5f r41b985f 4 4 from numpy.testing import TestCase, assert_equal 5 5 from aubio import slice_source_at_stamps 6 from utils import count_files_in_directory, get_default_test_sound7 from utils import count_samples_in_directory, count_samples_in_file6 from .utils import count_files_in_directory, get_default_test_sound 7 from .utils import count_samples_in_directory, count_samples_in_file 8 8 9 9 import tempfile -
python/tests/test_source.py
r71f2e5f r41b985f 5 5 from numpy.testing import TestCase, assert_equal 6 6 from aubio import source 7 from utils import list_all_sounds7 from .utils import list_all_sounds 8 8 import numpy as np 9 9 … … 57 57 if read < f.hop_size: 58 58 assert_equal(samples[read:], 0) 59 if 'brownnoise' in f.uri:60 self.assertEquals(np.count_nonzero(samples[:read]), read)61 59 break 62 60 #result_str = "read {:.2f}s ({:d} frames in {:d} blocks at {:d}Hz) from {:s}" … … 72 70 self.skipTest('failed opening with hop_s = {:d}, samplerate = {:d} ({:s})'.format(hop_size, samplerate, str(e))) 73 71 assert f.samplerate != 0 74 self.read_from_source(f) 72 read_frames = self.read_from_source(f) 73 if 'f_' in soundfile and samplerate == 0: 74 import re 75 f = re.compile('.*_\([0:9]*f\)_.*') 76 match_f = re.findall('([0-9]*)f_', soundfile) 77 if len(match_f) == 1: 78 expected_frames = int(match_f[0]) 79 self.assertEqual(expected_frames, read_frames) 75 80 76 81 @params(*list_of_sounds) … … 159 164 if read < f.hop_size: 160 165 assert_equal(samples[:,read:], 0) 161 if 'brownnoise' in f.uri:162 self.assertEquals(np.count_nonzero(samples[:,:read]), read)163 166 break 164 167 #result_str = "read {:.2f}s ({:d} frames in {:d} channels and {:d} blocks at {:d}Hz) from {:s}" … … 167 170 return total_frames 168 171 172 class aubio_source_with(aubio_source_test_case_base): 173 174 #@params(*list_of_sounds) 175 @params(*list_of_sounds) 176 def test_read_from_mono(self, filename): 177 total_frames = 0 178 hop_size = 2048 179 with source(filename, 0, hop_size) as input_source: 180 assert_equal(input_source.hop_size, hop_size) 181 #assert_equal(input_source.samplerate, samplerate) 182 total_frames = 0 183 for frames in input_source: 184 total_frames += frames.shape[-1] 185 # check we read as many samples as we expected 186 assert_equal(total_frames, input_source.duration) 187 169 188 if __name__ == '__main__': 170 189 main() -
scripts/build_apple_frameworks
r71f2e5f r41b985f 1 1 #! /bin/sh 2 3 # cd to aubio directory for consistency 4 cd `dirname $0`/.. 2 5 3 6 AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX` -
scripts/setenv_local.sh
r71f2e5f r41b985f 9 9 # PYTHONPATH variables. 10 10 11 PYTHON_PLATFORM=`python -c "import pkg_resources, sys; print '%s-%s' % (pkg_resources.get_build_platform(), '.'.join(map(str, sys.version_info[0:2])))"`11 PYTHON_PLATFORM=`python -c "import pkg_resources, sys; print ('%s-%s' % (pkg_resources.get_build_platform(), '.'.join(map(str, sys.version_info[0:2]))))"` 12 12 13 13 AUBIODIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -
setup.py
r71f2e5f r41b985f 7 7 from python.lib.gen_external import generate_external, header, output_path 8 8 9 # read from VERSION 10 for l in open('VERSION').readlines(): exec (l.strip()) 11 12 if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \ 13 or AUBIO_PATCH_VERSION is None: 14 raise SystemError("Failed parsing VERSION file.") 15 16 __version__ = '.'.join(map(str, [AUBIO_MAJOR_VERSION, 17 AUBIO_MINOR_VERSION, 18 AUBIO_PATCH_VERSION])) 19 if AUBIO_VERSION_STATUS is not None: 20 if AUBIO_VERSION_STATUS.startswith('~'): 21 AUBIO_VERSION_STATUS = AUBIO_VERSION_STATUS[1:] 22 __version__ += AUBIO_VERSION_STATUS 9 __version__ = get_aubio_pyversion() 23 10 24 11 include_dirs = [] 25 12 library_dirs = [] 26 define_macros = [ ]13 define_macros = [('AUBIO_VERSION', '%s' % __version__)] 27 14 extra_link_args = [] 28 15 … … 49 36 if os.path.isfile('src/aubio.h'): 50 37 if not os.path.isdir(os.path.join('build','src')): 51 __version__ += 'a2' # python only version 38 pass 39 #__version__ += 'a2' # python only version 52 40 53 41 classifiers = [ … … 79 67 maintainer = 'Paul Brossier', 80 68 maintainer_email = 'piem@aubio.org', 81 url = 'http ://aubio.org/',69 url = 'https://aubio.org/', 82 70 platforms = 'any', 83 71 classifiers = classifiers, 84 72 install_requires = ['numpy'], 73 setup_requires = ['numpy'], 85 74 cmdclass = { 86 75 'clean': CleanGenerated, … … 88 77 }, 89 78 test_suite = 'nose2.collector.collector', 79 extras_require = { 80 'tests': ['numpy'], 81 }, 90 82 ) -
src/aubio.h
r71f2e5f r41b985f 110 110 111 111 Several examples of C programs are available in the \p examples/ and \p tests/src 112 directories of the source tree. See more examples: 113 @ref spectral/test-fft.c 114 @ref spectral/test-phasevoc.c 115 @ref onset/test-onset.c 116 @ref pitch/test-pitch.c 117 @ref tempo/test-tempo.c 118 @ref test-fvec.c 119 @ref test-cvec.c 112 directories of the source tree. 113 114 Some examples: 115 - @ref spectral/test-fft.c 116 - @ref spectral/test-phasevoc.c 117 - @ref onset/test-onset.c 118 - @ref pitch/test-pitch.c 119 - @ref tempo/test-tempo.c 120 - @ref test-fvec.c 121 - @ref test-cvec.c 120 122 121 123 \subsection unstable_api Unstable API … … 138 140 139 141 Latest versions, further documentation, examples, wiki, and mailing lists can 140 be found at http ://aubio.org .142 be found at https://aubio.org . 141 143 142 144 */ -
src/aubio_priv.h
r71f2e5f r41b985f 34 34 */ 35 35 36 #ifdef HAVE_CONFIG_H 36 37 #include "config.h" 38 #endif 37 39 38 40 #ifdef HAVE_STDLIB_H … … 182 184 #ifdef HAVE_C99_VARARGS_MACROS 183 185 #define AUBIO_ERR(...) aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " __VA_ARGS__) 186 #define AUBIO_INF(...) aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " __VA_ARGS__) 184 187 #define AUBIO_MSG(...) aubio_log(AUBIO_LOG_MSG, __VA_ARGS__) 185 188 #define AUBIO_DBG(...) aubio_log(AUBIO_LOG_DBG, __VA_ARGS__) 186 189 #define AUBIO_WRN(...) aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " __VA_ARGS__) 187 190 #else 188 #define AUBIO_ERR(format, args...) aubio_log(stderr, "AUBIO ERROR: " format , ##args) 189 #define AUBIO_MSG(format, args...) aubio_log(stdout, format , ##args) 190 #define AUBIO_DBG(format, args...) aubio_log(stderr, format , ##args) 191 #define AUBIO_WRN(format, args...) aubio_log(stderr, "AUBIO WARNING: " format, ##args) 191 #define AUBIO_ERR(format, args...) aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " format , ##args) 192 #define AUBIO_INF(format, args...) aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " format , ##args) 193 #define AUBIO_MSG(format, args...) aubio_log(AUBIO_LOG_MSG, format , ##args) 194 #define AUBIO_DBG(format, args...) aubio_log(AUBIO_LOG_DBG, format , ##args) 195 #define AUBIO_WRN(format, args...) aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " format, ##args) 192 196 #endif 193 197 … … 196 200 #define AUBIO_QUIT(_s) exit(_s) 197 201 #define AUBIO_SPRINTF sprintf 202 203 #define AUBIO_MAX_SAMPLERATE (192000*8) 204 #define AUBIO_MAX_CHANNELS 1024 198 205 199 206 /* pi and 2*pi */ -
src/fmat.c
r71f2e5f r41b985f 111 111 uint_t i,j; 112 112 for (i=0; i< s->height; i++) { 113 for (j=0; j< FLOOR( s->length/2); j++) {113 for (j=0; j< FLOOR((smpl_t)s->length/2); j++) { 114 114 ELEM_SWAP(s->data[i][j], s->data[i][s->length-1-j]); 115 115 } -
src/fvec.c
r71f2e5f r41b985f 91 91 void fvec_rev(fvec_t *s) { 92 92 uint_t j; 93 for (j=0; j< FLOOR( s->length/2); j++) {93 for (j=0; j< FLOOR((smpl_t)s->length/2); j++) { 94 94 ELEM_SWAP(s->data[j], s->data[s->length-1-j]); 95 95 } -
src/io/audio_unit.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include " config.h"21 #include "aubio_priv.h" 22 22 #ifdef HAVE_AUDIO_UNIT 23 #include "aubio_priv.h"24 23 25 24 #include "fvec.h" -
src/io/sink.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include "config.h"22 21 #include "aubio_priv.h" 23 22 #include "fvec.h" … … 99 98 } 100 99 #endif /* HAVE_WAVWRITE */ 101 AUBIO_ERROR("sink: failed creating %s with samplerate %dHz\n", 102 uri, samplerate); 100 #if !defined(HAVE_WAVWRITE) && \ 101 !defined(HAVE_SNDFILE) && \ 102 !defined(HAVE_SINK_APPLE_AUDIO) 103 AUBIO_ERROR("sink: failed creating '%s' at %dHz (no sink built-in)\n", uri, samplerate); 104 #endif 103 105 AUBIO_FREE(s); 104 106 return NULL; -
src/io/sink_apple_audio.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include " config.h"21 #include "aubio_priv.h" 22 22 23 23 #ifdef HAVE_SINK_APPLE_AUDIO 24 25 #include "aubio_priv.h"26 24 #include "fvec.h" 27 25 #include "fmat.h" 28 26 #include "io/sink_apple_audio.h" 27 #include "io/ioutils.h" 29 28 30 29 // CFURLRef, CFURLCreateWithFileSystemPath, ... … … 63 62 s->async = false; 64 63 65 if ( uri == NULL) {64 if ( (uri == NULL) || (strlen(uri) < 1) ) { 66 65 AUBIO_ERROR("sink_apple_audio: Aborted opening null path\n"); 67 66 goto beach; … … 74 73 s->channels = 0; 75 74 76 // negative samplerate given, abort77 if ((sint_t)samplerate < 0) goto beach;78 75 // zero samplerate given. do not open yet 79 if ((sint_t)samplerate == 0) return s; 76 if ((sint_t)samplerate == 0) { 77 return s; 78 } 79 // invalid samplerate given, abort 80 if (aubio_io_validate_samplerate("sink_apple_audio", s->path, samplerate)) { 81 goto beach; 82 } 80 83 81 84 s->samplerate = samplerate; … … 95 98 uint_t aubio_sink_apple_audio_preset_samplerate(aubio_sink_apple_audio_t *s, uint_t samplerate) 96 99 { 97 if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL; 100 if (aubio_io_validate_samplerate("sink_apple_audio", s->path, samplerate)) { 101 return AUBIO_FAIL; 102 } 98 103 s->samplerate = samplerate; 99 104 // automatically open when both samplerate and channels have been set … … 106 111 uint_t aubio_sink_apple_audio_preset_channels(aubio_sink_apple_audio_t *s, uint_t channels) 107 112 { 108 if ((sint_t)(channels) <= 0) return AUBIO_FAIL; 113 if (aubio_io_validate_channels("sink_apple_audio", s->path, channels)) { 114 return AUBIO_FAIL; 115 } 109 116 s->channels = channels; 110 117 // automatically open when both samplerate and channels have been set -
src/io/sink_sndfile.c
r71f2e5f r41b985f 20 20 21 21 22 #include " config.h"22 #include "aubio_priv.h" 23 23 24 24 #ifdef HAVE_SNDFILE … … 26 26 #include <sndfile.h> 27 27 28 #include "aubio_priv.h"29 28 #include "fvec.h" 30 29 #include "fmat.h" 31 30 #include "io/sink_sndfile.h" 32 33 #define MAX_CHANNELS 6 31 #include "io/ioutils.h" 32 34 33 #define MAX_SIZE 4096 35 34 … … 70 69 s->channels = 0; 71 70 72 // negative samplerate given, abort73 if ((sint_t)samplerate < 0) goto beach;74 71 // zero samplerate given. do not open yet 75 if ((sint_t)samplerate == 0) return s; 72 if ((sint_t)samplerate == 0) { 73 return s; 74 } 75 // invalid samplerate given, abort 76 if (aubio_io_validate_samplerate("sink_sndfile", s->path, samplerate)) { 77 goto beach; 78 } 76 79 77 80 s->samplerate = samplerate; … … 90 93 uint_t aubio_sink_sndfile_preset_samplerate(aubio_sink_sndfile_t *s, uint_t samplerate) 91 94 { 92 if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL; 95 if (aubio_io_validate_samplerate("sink_sndfile", s->path, samplerate)) { 96 return AUBIO_FAIL; 97 } 93 98 s->samplerate = samplerate; 94 99 // automatically open when both samplerate and channels have been set … … 101 106 uint_t aubio_sink_sndfile_preset_channels(aubio_sink_sndfile_t *s, uint_t channels) 102 107 { 103 if ((sint_t)(channels) <= 0) return AUBIO_FAIL; 108 if (aubio_io_validate_channels("sink_sndfile", s->path, channels)) { 109 return AUBIO_FAIL; 110 } 104 111 s->channels = channels; 105 112 // automatically open when both samplerate and channels have been set … … 133 140 if (s->handle == NULL) { 134 141 /* show libsndfile err msg */ 135 AUBIO_ERR("sink_sndfile: Failed opening %s. %s\n", s->path, sf_strerror (NULL)); 142 AUBIO_ERR("sink_sndfile: Failed opening \"%s\" with %d channels, %dHz: %s\n", 143 s->path, s->channels, s->samplerate, sf_strerror (NULL)); 136 144 return AUBIO_FAIL; 137 145 } … … 139 147 s->scratch_size = s->max_size*s->channels; 140 148 /* allocate data for de/interleaving reallocated when needed. */ 141 if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) { 149 if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) { 150 abort(); 142 151 AUBIO_ERR("sink_sndfile: %d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n", 143 s->max_size, s->channels, MAX_ CHANNELS *MAX_CHANNELS);152 s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS); 144 153 return AUBIO_FAIL; 145 154 } -
src/io/sink_wavwrite.c
r71f2e5f r41b985f 20 20 21 21 22 #include " config.h"22 #include "aubio_priv.h" 23 23 24 24 #ifdef HAVE_WAVWRITE 25 25 26 #include "aubio_priv.h"27 26 #include "fvec.h" 28 27 #include "fmat.h" 29 28 #include "io/sink_wavwrite.h" 29 #include "io/ioutils.h" 30 30 31 31 #include <errno.h> 32 32 33 #define MAX_CHANNELS 634 33 #define MAX_SIZE 4096 35 34 … … 105 104 s->channels = 0; 106 105 107 // negative samplerate given, abort108 if ((sint_t)samplerate < 0) goto beach;109 106 // zero samplerate given. do not open yet 110 if ((sint_t)samplerate == 0) return s; 111 // samplerate way too large, fail 112 if ((sint_t)samplerate > 192000 * 4) goto beach; 107 if ((sint_t)samplerate == 0) { 108 return s; 109 } 110 // invalid samplerate given, abort 111 if (aubio_io_validate_samplerate("sink_wavwrite", s->path, samplerate)) { 112 goto beach; 113 } 113 114 114 115 s->samplerate = samplerate; … … 130 131 uint_t aubio_sink_wavwrite_preset_samplerate(aubio_sink_wavwrite_t *s, uint_t samplerate) 131 132 { 132 if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL; 133 if (aubio_io_validate_samplerate("sink_wavwrite", s->path, samplerate)) { 134 return AUBIO_FAIL; 135 } 133 136 s->samplerate = samplerate; 134 137 // automatically open when both samplerate and channels have been set … … 141 144 uint_t aubio_sink_wavwrite_preset_channels(aubio_sink_wavwrite_t *s, uint_t channels) 142 145 { 143 if ((sint_t)(channels) <= 0) return AUBIO_FAIL; 146 if (aubio_io_validate_channels("sink_wavwrite", s->path, channels)) { 147 return AUBIO_FAIL; 148 } 144 149 s->channels = channels; 145 150 // automatically open when both samplerate and channels have been set … … 214 219 s->scratch_size = s->max_size * s->channels; 215 220 /* allocate data for de/interleaving reallocated when needed. */ 216 if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {221 if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) { 217 222 AUBIO_ERR("sink_wavwrite: %d x %d exceeds SIZE maximum buffer size %d\n", 218 s->max_size, s->channels, MAX_SIZE * MAX_CHANNELS);223 s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS); 219 224 goto beach; 220 225 } -
src/io/source.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include "config.h"22 21 #include "aubio_priv.h" 23 22 #include "fvec.h" … … 116 115 } 117 116 #endif /* HAVE_WAVREAD */ 118 //AUBIO_ERROR("source: failed creating aubio source with %s" 119 // " at samplerate %d with hop_size %d\n", uri, samplerate, hop_size); 117 #if !defined(HAVE_WAVREAD) && \ 118 !defined(HAVE_LIBAV) && \ 119 !defined(HAVE_SOURCE_APPLE_AUDIO) && \ 120 !defined(HAVE_SNDFILE) 121 AUBIO_ERROR("source: failed creating with %s at %dHz with hop size %d" 122 " (no source built-in)\n", uri, samplerate, hop_size); 123 #endif 120 124 AUBIO_FREE(s); 121 125 return NULL; -
src/io/source_apple_audio.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include " config.h"21 #include "aubio_priv.h" 22 22 23 23 #ifdef HAVE_SOURCE_APPLE_AUDIO 24 24 25 #include "aubio_priv.h"26 25 #include "fvec.h" 27 26 #include "fmat.h" … … 281 280 { 282 281 OSStatus err = noErr; 283 if (!s->audioFile) { return AUBIO_ FAIL; }282 if (!s->audioFile) { return AUBIO_OK; } 284 283 err = ExtAudioFileDispose(s->audioFile); 285 284 s->audioFile = NULL; -
src/io/source_avcodec.c
r71f2e5f r41b985f 19 19 */ 20 20 21 22 #include "config.h" 21 #include "aubio_priv.h" 23 22 24 23 #ifdef HAVE_LIBAV 24 25 #include <libavcodec/avcodec.h> 26 #include <libavformat/avformat.h> 27 #include <libavresample/avresample.h> 28 #include <libavutil/opt.h> 29 #include <stdlib.h> 25 30 26 31 // determine whether we use libavformat from ffmpeg or from libav … … 33 38 ) 34 39 35 #include <libavcodec/avcodec.h> 36 #include <libavformat/avformat.h> 37 #include <libavresample/avresample.h> 38 #include <libavutil/opt.h> 39 #include <stdlib.h> 40 // backward compatibility with libavcodec55 41 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) 42 #warning "libavcodec55 is deprecated" 43 #define HAVE_AUBIO_LIBAVCODEC_DEPRECATED 1 44 #define av_frame_alloc avcodec_alloc_frame 45 #define av_frame_free avcodec_free_frame 46 #define av_packet_unref av_free_packet 47 #endif 40 48 41 49 #include "aubio_priv.h" … … 60 68 AVCodecContext *avCodecCtx; 61 69 AVFrame *avFrame; 70 AVPacket avPacket; 62 71 AVAudioResampleContext *avr; 63 float *output;72 smpl_t *output; 64 73 uint_t read_samples; 65 74 uint_t read_index; … … 151 160 sint_t selected_stream = -1; 152 161 for (i = 0; i < avFormatCtx->nb_streams; i++) { 162 #if FF_API_LAVF_AVCTX 163 if (avFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { 164 #else 153 165 if (avFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { 166 #endif 154 167 if (selected_stream == -1) { 155 168 selected_stream = i; … … 168 181 169 182 AVCodecContext *avCodecCtx = s->avCodecCtx; 183 #if FF_API_LAVF_AVCTX 184 AVCodecParameters *codecpar = avFormatCtx->streams[selected_stream]->codecpar; 185 if (codecpar == NULL) { 186 AUBIO_ERR("source_avcodec: Could not find decoder for %s", s->path); 187 goto beach; 188 } 189 AVCodec *codec = avcodec_find_decoder(codecpar->codec_id); 190 191 /* Allocate a codec context for the decoder */ 192 avCodecCtx = avcodec_alloc_context3(codec); 193 if (!avCodecCtx) { 194 AUBIO_ERR("source_avcodec: Failed to allocate the %s codec context for path %s\n", 195 av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path); 196 goto beach; 197 } 198 #else 170 199 avCodecCtx = avFormatCtx->streams[selected_stream]->codec; 171 200 AVCodec *codec = avcodec_find_decoder(avCodecCtx->codec_id); 201 #endif 172 202 if (codec == NULL) { 173 203 AUBIO_ERR("source_avcodec: Could not find decoder for %s", s->path); 174 204 goto beach; 175 205 } 206 207 #if FF_API_LAVF_AVCTX 208 /* Copy codec parameters from input stream to output codec context */ 209 if ((err = avcodec_parameters_to_context(avCodecCtx, codecpar)) < 0) { 210 AUBIO_ERR("source_avcodec: Failed to copy %s codec parameters to decoder context for %s\n", 211 av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path); 212 goto beach; 213 } 214 #endif 176 215 177 216 if ( ( err = avcodec_open2(avCodecCtx, codec, NULL) ) < 0) { … … 206 245 207 246 /* allocate output for avr */ 208 s->output = ( float *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(float));247 s->output = (smpl_t *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(smpl_t)); 209 248 210 249 s->read_samples = 0; … … 233 272 234 273 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, uint_t multi) { 274 // create or reset resampler to/from mono/multi-channel 235 275 if ( (multi != s->multi) || (s->avr == NULL) ) { 236 276 int64_t input_layout = av_get_default_channel_layout(s->input_channels); 237 277 uint_t output_channels = multi ? s->input_channels : 1; 238 278 int64_t output_layout = av_get_default_channel_layout(output_channels); 239 if (s->avr != NULL) { 240 avresample_close( s->avr ); 241 av_free ( s->avr ); 242 s->avr = NULL; 243 } 244 AVAudioResampleContext *avr = s->avr; 245 avr = avresample_alloc_context(); 279 AVAudioResampleContext *avr = avresample_alloc_context(); 280 AVAudioResampleContext *oldavr = s->avr; 246 281 247 282 av_opt_set_int(avr, "in_channel_layout", input_layout, 0); … … 250 285 av_opt_set_int(avr, "out_sample_rate", s->samplerate, 0); 251 286 av_opt_set_int(avr, "in_sample_fmt", s->avCodecCtx->sample_fmt, 0); 287 #if HAVE_AUBIO_DOUBLE 288 av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_DBL, 0); 289 #else 252 290 av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_FLT, 0); 291 #endif 292 // TODO: use planar? 293 //av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); 253 294 int err; 254 295 if ( ( err = avresample_open(avr) ) < 0) { … … 261 302 } 262 303 s->avr = avr; 304 if (oldavr != NULL) { 305 avresample_close( oldavr ); 306 av_free ( oldavr ); 307 oldavr = NULL; 308 } 263 309 s->multi = multi; 264 310 } … … 269 315 AVCodecContext *avCodecCtx = s->avCodecCtx; 270 316 AVFrame *avFrame = s->avFrame; 271 AVPacket avPacket ;317 AVPacket avPacket = s->avPacket; 272 318 av_init_packet (&avPacket); 273 319 AVAudioResampleContext *avr = s->avr; 274 float *output = s->output;320 smpl_t *output = s->output; 275 321 *read_samples = 0; 276 322 … … 291 337 292 338 int got_frame = 0; 339 #if FF_API_LAVF_AVCTX 340 int ret = avcodec_send_packet(avCodecCtx, &avPacket); 341 if (ret < 0 && ret != AVERROR_EOF) { 342 AUBIO_ERR("source_avcodec: error when sending packet for %s\n", s->path); 343 goto beach; 344 } 345 ret = avcodec_receive_frame(avCodecCtx, avFrame); 346 if (ret >= 0) { 347 got_frame = 1; 348 } 349 if (ret < 0) { 350 if (ret == AVERROR(EAGAIN)) { 351 AUBIO_WRN("source_avcodec: output is not available right now - user must try to send new input\n"); 352 } else if (ret == AVERROR_EOF) { 353 AUBIO_WRN("source_avcodec: the decoder has been fully flushed, and there will be no more output frames\n"); 354 } else { 355 AUBIO_ERR("source_avcodec: decoding errors on %s\n", s->path); 356 goto beach; 357 } 358 } 359 #else 293 360 int len = avcodec_decode_audio4(avCodecCtx, avFrame, &got_frame, &avPacket); 294 361 295 362 if (len < 0) { 296 AUBIO_ERR("Error while decoding %s\n", s->path); 297 goto beach; 298 } 363 AUBIO_ERR("source_avcodec: error while decoding %s\n", s->path); 364 goto beach; 365 } 366 #endif 299 367 if (got_frame == 0) { 300 //AUBIO_ERR("Could not get frame for (%s)\n", s->path);368 AUBIO_WRN("source_avcodec: did not get a frame when reading %s\n", s->path); 301 369 goto beach; 302 370 } … … 312 380 (uint8_t **)avFrame->data, in_linesize, in_samples); 313 381 if (out_samples <= 0) { 314 //AUBIO_ERR("No sample found while converting frame (%s)\n", s->path);382 AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n", s->path); 315 383 goto beach; 316 384 } … … 329 397 330 398 void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data, uint_t * read){ 331 if (s->multi == 1) aubio_source_avcodec_reset_resampler(s, 0);332 399 uint_t i; 333 400 uint_t end = 0; 334 401 uint_t total_wrote = 0; 402 // switch from multi 403 if (s->multi == 1) aubio_source_avcodec_reset_resampler(s, 0); 335 404 while (total_wrote < s->hop_size) { 336 405 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); … … 360 429 361 430 void aubio_source_avcodec_do_multi(aubio_source_avcodec_t * s, fmat_t * read_data, uint_t * read){ 362 if (s->multi == 0) aubio_source_avcodec_reset_resampler(s, 1);363 431 uint_t i,j; 364 432 uint_t end = 0; 365 433 uint_t total_wrote = 0; 434 // switch from mono 435 if (s->multi == 0) aubio_source_avcodec_reset_resampler(s, 1); 366 436 while (total_wrote < s->hop_size) { 367 437 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); … … 408 478 int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX); 409 479 int seek_flags = AVSEEK_FLAG_FRAME | AVSEEK_FLAG_ANY; 410 int ret = avformat_seek_file(s->avFormatCtx, s->selected_stream, 480 int ret = AUBIO_FAIL; 481 if (s->avFormatCtx != NULL && s->avr != NULL) { 482 ret = AUBIO_OK; 483 } else { 484 AUBIO_ERR("source_avcodec: failed seeking in %s (file not opened?)", s->path); 485 return ret; 486 } 487 if ((sint_t)pos < 0) { 488 AUBIO_ERR("source_avcodec: could not seek %s at %d (seeking position" 489 " should be >= 0)\n", s->path, pos); 490 return AUBIO_FAIL; 491 } 492 ret = avformat_seek_file(s->avFormatCtx, s->selected_stream, 411 493 min_ts, resampled_pos, max_ts, seek_flags); 412 494 if (ret < 0) { 413 AUBIO_ERR(" Failed seeking to %d in file %s", pos, s->path);495 AUBIO_ERR("source_avcodec: failed seeking to %d in file %s", pos, s->path); 414 496 } 415 497 // reset read status … … 442 524 s->avCodecCtx = NULL; 443 525 if (s->avFormatCtx != NULL) { 444 avformat_close_input ( &(s->avFormatCtx) ); 445 } 446 s->avFormatCtx = NULL; 526 avformat_close_input(&s->avFormatCtx); 527 #ifndef HAVE_AUBIO_LIBAVCODEC_DEPRECATED // avoid crash on old libavcodec54 528 avformat_free_context(s->avFormatCtx); 529 #endif 530 s->avFormatCtx = NULL; 531 } 532 av_packet_unref(&s->avPacket); 447 533 return AUBIO_OK; 448 534 } … … 458 544 av_frame_free( &(s->avFrame) ); 459 545 } 460 if (s->path) AUBIO_FREE(s->path);461 546 s->avFrame = NULL; 547 if (s->path) { 548 AUBIO_FREE(s->path); 549 } 550 s->path = NULL; 462 551 AUBIO_FREE(s); 463 552 } -
src/io/source_sndfile.c
r71f2e5f r41b985f 19 19 */ 20 20 21 22 #include "config.h" 21 #include "aubio_priv.h" 23 22 24 23 #ifdef HAVE_SNDFILE … … 26 25 #include <sndfile.h> 27 26 28 #include "aubio_priv.h"29 27 #include "fvec.h" 30 28 #include "fmat.h" … … 33 31 #include "temporal/resampler.h" 34 32 35 #define MAX_CHANNELS 636 33 #define MAX_SIZE 4096 37 #define MAX_SAMPLES MAX_CHANNELS * MAX_SIZE34 #define MAX_SAMPLES AUBIO_MAX_CHANNELS * MAX_SIZE 38 35 39 36 #if !HAVE_AUBIO_DOUBLE … … 141 138 if (s->ratio > 1) { 142 139 // we would need to add a ring buffer for these 143 if ( (uint_t) (s->input_hop_size * s->ratio + .5) != s->hop_size ) {140 if ( (uint_t)FLOOR(s->input_hop_size * s->ratio + .5) != s->hop_size ) { 144 141 AUBIO_ERR("source_sndfile: can not upsample %s from %d to %d\n", s->path, 145 142 s->input_samplerate, s->samplerate); … … 298 295 uint_t aubio_source_sndfile_seek (aubio_source_sndfile_t * s, uint_t pos) { 299 296 uint_t resampled_pos = (uint_t)ROUND(pos / s->ratio); 300 sf_count_t sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET); 297 sf_count_t sf_ret; 298 if (s->handle == NULL) { 299 AUBIO_ERR("source_sndfile: failed seeking in %s (file not opened?)\n", 300 s->path); 301 return AUBIO_FAIL; 302 } 303 if ((sint_t)pos < 0) { 304 AUBIO_ERR("source_sndfile: could not seek %s at %d (seeking position" 305 " should be >= 0)\n", s->path, pos); 306 return AUBIO_FAIL; 307 } 308 sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET); 301 309 if (sf_ret == -1) { 302 310 AUBIO_ERR("source_sndfile: Failed seeking %s at %d: %s\n", s->path, pos, sf_strerror (NULL)); … … 313 321 uint_t aubio_source_sndfile_close (aubio_source_sndfile_t *s) { 314 322 if (!s->handle) { 315 return AUBIO_ FAIL;323 return AUBIO_OK; 316 324 } 317 325 if(sf_close(s->handle)) { -
src/io/source_wavread.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include " config.h"21 #include "aubio_priv.h" 22 22 23 23 #ifdef HAVE_WAVREAD 24 24 25 #include "aubio_priv.h"26 25 #include "fvec.h" 27 26 #include "fmat.h" … … 330 329 uint_t end = 0; 331 330 uint_t total_wrote = 0; 331 if (s->fid == NULL) { 332 AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n", 333 s->path); 334 return; 335 } 332 336 while (total_wrote < s->hop_size) { 333 337 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); … … 364 368 uint_t end = 0; 365 369 uint_t total_wrote = 0; 370 if (s->fid == NULL) { 371 AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n", 372 s->path); 373 return; 374 } 366 375 while (total_wrote < s->hop_size) { 367 376 end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote); … … 404 413 uint_t aubio_source_wavread_seek (aubio_source_wavread_t * s, uint_t pos) { 405 414 uint_t ret = 0; 415 if (s->fid == NULL) { 416 AUBIO_ERR("source_wavread: could not seek %s (file not opened?)\n", s->path, pos); 417 return AUBIO_FAIL; 418 } 406 419 if ((sint_t)pos < 0) { 420 AUBIO_ERR("source_wavread: could not seek %s at %d (seeking position should be >= 0)\n", s->path, pos); 407 421 return AUBIO_FAIL; 408 422 } … … 426 440 427 441 uint_t aubio_source_wavread_close (aubio_source_wavread_t * s) { 428 if ( !s->fid) {429 return AUBIO_ FAIL;442 if (s->fid == NULL) { 443 return AUBIO_OK; 430 444 } 431 445 if (fclose(s->fid)) { -
src/io/utils_apple_audio.c
r71f2e5f r41b985f 1 #include " config.h"1 #include "aubio_priv.h" 2 2 3 3 #if defined(HAVE_SOURCE_APPLE_AUDIO) || defined(HAVE_SINK_APPLE_AUDIO) … … 7 7 // ExtAudioFileRef, AudioStreamBasicDescription, AudioBufferList, ... 8 8 #include <AudioToolbox/AudioToolbox.h> 9 #include "aubio_priv.h"10 9 11 10 int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize); -
src/mathutils.c
r71f2e5f r41b985f 25 25 #include "mathutils.h" 26 26 #include "musicutils.h" 27 #include "config.h"28 27 29 28 /** Window types */ -
src/notes/notes.c
r71f2e5f r41b985f 25 25 #include "notes/notes.h" 26 26 27 #define AUBIO_DEFAULT_NOTES_SILENCE -70. 28 // increase to 10. for .1 cent precision 29 // or to 100. for .01 cent precision 30 #define AUBIO_DEFAULT_CENT_PRECISION 1. 31 #define AUBIO_DEFAULT_NOTES_MINIOI_MS 30. 32 27 33 struct _aubio_notes_t { 28 34 … … 79 85 o->pitch = new_aubio_pitch (pitch_method, o->pitch_buf_size, o->hop_size, o->samplerate); 80 86 if (o->pitch_tolerance != 0.) aubio_pitch_set_tolerance (o->pitch, o->pitch_tolerance); 87 aubio_pitch_set_unit (o->pitch, "midi"); 81 88 o->pitch_output = new_fvec (1); 82 89 … … 91 98 o->newnote = 0.; 92 99 93 o->silence_threshold = -90.; 100 aubio_notes_set_silence(o, AUBIO_DEFAULT_NOTES_SILENCE); 101 aubio_notes_set_minioi_ms (o, AUBIO_DEFAULT_NOTES_MINIOI_MS); 94 102 95 103 return o; … … 98 106 del_aubio_notes(o); 99 107 return NULL; 108 } 109 110 uint_t aubio_notes_set_silence(aubio_notes_t *o, smpl_t silence) 111 { 112 uint_t err = AUBIO_OK; 113 if (aubio_pitch_set_silence(o->pitch, silence) != AUBIO_OK) { 114 err = AUBIO_FAIL; 115 } 116 if (aubio_onset_set_silence(o->onset, silence) != AUBIO_OK) { 117 err = AUBIO_FAIL; 118 } 119 o->silence_threshold = silence; 120 return err; 121 } 122 123 smpl_t aubio_notes_get_silence(const aubio_notes_t *o) 124 { 125 return aubio_pitch_get_silence(o->pitch); 126 } 127 128 uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms) 129 { 130 uint_t err = AUBIO_OK; 131 if (!o->onset || (aubio_onset_set_minioi_ms(o->onset, minioi_ms) != 0)) { 132 err = AUBIO_FAIL; 133 } 134 return err; 135 } 136 137 smpl_t aubio_notes_get_minioi_ms(const aubio_notes_t *o) 138 { 139 return aubio_onset_get_minioi_ms(o->onset); 100 140 } 101 141 … … 109 149 note_buffer->data[i] = note_buffer->data[i + 1]; 110 150 } 111 note_buffer->data[note_buffer->length - 1] = curnote; 151 //note_buffer->data[note_buffer->length - 1] = ROUND(10.*curnote)/10.; 152 note_buffer->data[note_buffer->length - 1] = ROUND(AUBIO_DEFAULT_CENT_PRECISION*curnote); 112 153 return; 113 154 } 114 155 115 static uint_t156 static smpl_t 116 157 aubio_notes_get_latest_note (aubio_notes_t *o) 117 158 { 118 uint_t i; 119 for (i = 0; i < o->note_buffer->length; i++) { 120 o->note_buffer2->data[i] = o->note_buffer->data[i]; 121 } 122 return fvec_median (o->note_buffer2); 159 fvec_copy(o->note_buffer, o->note_buffer2); 160 return fvec_median (o->note_buffer2) / AUBIO_DEFAULT_CENT_PRECISION; 123 161 } 124 162 -
src/notes/notes.h
r71f2e5f r41b985f 16 16 You should have received a copy of the GNU General Public License 17 17 along with aubio. If not, see <http://www.gnu.org/licenses/>. 18 19 */ 20 21 /** \file 22 23 Note detection object 18 24 19 25 */ … … 52 58 53 59 \param o note detection object as returned by new_aubio_notes() 54 \param in input signal of size [hop_size] 55 \param out output notes of size [3] ? FIXME 60 \param input input signal of size [hop_size] 61 \param output output notes, fvec of length 3 62 63 The notes output is a vector of length 3 containing: 64 - 0. the midi note value, or 0 if no note was found 65 - 1. the note velocity 66 - 2. the midi note to turn off 56 67 57 68 */ 58 69 void aubio_notes_do (aubio_notes_t *o, const fvec_t * input, fvec_t * output); 70 71 /** set notes detection silence threshold 72 73 \param o notes detection object as returned by new_aubio_notes() 74 \param silence new silence detection threshold 75 76 \return 0 on success, non-zero otherwise 77 78 */ 79 uint_t aubio_notes_set_silence(aubio_notes_t * o, smpl_t silence); 80 81 /** get notes detection silence threshold 82 83 \param o notes detection object as returned by new_aubio_notes() 84 85 \return current silence threshold 86 87 */ 88 smpl_t aubio_notes_get_silence(const aubio_notes_t * o); 89 90 /** get notes detection minimum inter-onset interval, in millisecond 91 92 \param o notes detection object as returned by new_aubio_notes() 93 94 \return current minimum inter onset interval 95 96 */ 97 smpl_t aubio_notes_get_minioi_ms(const aubio_notes_t *o); 98 99 /** set notes detection minimum inter-onset interval, in millisecond 100 101 \param o notes detection object as returned by new_aubio_notes() 102 \param minioi_ms new inter-onset interval 103 104 \return 0 on success, non-zero otherwise 105 106 */ 107 uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms); 59 108 60 109 #ifdef __cplusplus -
src/onset/peakpicker.c
r71f2e5f r41b985f 186 186 */ 187 187 t->biquad = new_aubio_filter_biquad (0.15998789, 0.31997577, 0.15998789, 188 -0.59488894, 0.23484048); 188 // FIXME: broken since c9e20ca, revert for now 189 //-0.59488894, 0.23484048); 190 0.23484048, 0); 189 191 190 192 return t; -
src/pitch/pitch.c
r71f2e5f r41b985f 112 112 aubio_pitch_t *p = AUBIO_NEW (aubio_pitch_t); 113 113 aubio_pitch_type pitch_type; 114 if (pitch_mode == NULL) { 115 AUBIO_ERR ("pitch: can not use ‘NULL‘ for pitch detection method\n"); 116 goto beach; 117 } 114 118 if (strcmp (pitch_mode, "mcomb") == 0) 115 119 pitch_type = aubio_pitcht_mcomb; … … 139 143 goto beach; 140 144 } else if (bufsize < hopsize) { 141 AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", bufsize, hopsize);145 AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", hopsize, bufsize); 142 146 goto beach; 143 147 } else if ((sint_t)samplerate < 1) { … … 156 160 p->buf = new_fvec (bufsize); 157 161 p->p_object = new_aubio_pitchyin (bufsize); 162 if (!p->p_object) goto beach; 158 163 p->detect_cb = aubio_pitch_do_yin; 159 164 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyin_get_confidence; … … 163 168 p->filtered = new_fvec (hopsize); 164 169 p->pv = new_aubio_pvoc (bufsize, hopsize); 170 if (!p->pv) goto beach; 165 171 p->fftgrain = new_cvec (bufsize); 166 172 p->p_object = new_aubio_pitchmcomb (bufsize, hopsize); … … 171 177 p->buf = new_fvec (bufsize); 172 178 p->p_object = new_aubio_pitchfcomb (bufsize, hopsize); 179 if (!p->p_object) goto beach; 173 180 p->detect_cb = aubio_pitch_do_fcomb; 174 181 break; … … 181 188 p->buf = new_fvec (bufsize); 182 189 p->p_object = new_aubio_pitchyinfft (samplerate, bufsize); 190 if (!p->p_object) goto beach; 183 191 p->detect_cb = aubio_pitch_do_yinfft; 184 192 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfft_get_confidence; … … 188 196 p->buf = new_fvec (bufsize); 189 197 p->p_object = new_aubio_pitchspecacf (bufsize); 198 if (!p->p_object) goto beach; 190 199 p->detect_cb = aubio_pitch_do_specacf; 191 200 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchspecacf_get_tolerance; … … 198 207 199 208 beach: 209 if (p->filtered) del_fvec(p->filtered); 210 if (p->buf) del_fvec(p->buf); 200 211 AUBIO_FREE(p); 201 212 return NULL; -
src/pitch/pitch.h
r71f2e5f r41b985f 151 151 \param mode set pitch units for output 152 152 153 mode can be one of "Hz", "midi", "cent", or "bin". Defaults to "Hz". 154 153 155 \return 0 if successfull, non-zero otherwise 154 156 -
src/pitch/pitchfcomb.c
r71f2e5f r41b985f 54 54 p->fftSize = bufsize; 55 55 p->stepSize = hopsize; 56 p->fft = new_aubio_fft (bufsize); 57 if (!p->fft) goto beach; 56 58 p->winput = new_fvec (bufsize); 57 59 p->fftOut = new_cvec (bufsize); 58 60 p->fftLastPhase = new_fvec (bufsize); 59 p->fft = new_aubio_fft (bufsize);60 61 p->win = new_aubio_window ("hanning", bufsize); 61 62 return p; 63 64 beach: 65 AUBIO_FREE(p); 66 return NULL; 62 67 } 63 68 -
src/pitch/pitchspecacf.c
r71f2e5f r41b985f 43 43 { 44 44 aubio_pitchspecacf_t *p = AUBIO_NEW (aubio_pitchspecacf_t); 45 p->fft = new_aubio_fft (bufsize); 46 if (!p->fft) goto beach; 45 47 p->win = new_aubio_window ("hanningz", bufsize); 46 48 p->winput = new_fvec (bufsize); 47 p->fft = new_aubio_fft (bufsize);48 49 p->fftout = new_fvec (bufsize); 49 50 p->sqrmag = new_fvec (bufsize); … … 52 53 p->confidence = 0.; 53 54 return p; 55 56 beach: 57 AUBIO_FREE(p); 58 return NULL; 54 59 } 55 60 -
src/pitch/pitchyin.c
r71f2e5f r41b985f 128 128 } 129 129 130 131 130 /* all the above in one */ 132 131 void 133 132 aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * input, fvec_t * out) 134 133 { 135 smpl_t tol = o->tol; 136 fvec_t *yin = o->yin; 137 uint_t j, tau = 0; 134 const smpl_t tol = o->tol; 135 fvec_t* yin = o->yin; 136 const smpl_t *input_data = input->data; 137 const uint_t length = yin->length; 138 smpl_t *yin_data = yin->data; 139 uint_t j, tau; 138 140 sint_t period; 139 smpl_t tmp = 0., tmp2 = 0.; 140 yin->data[0] = 1.; 141 for (tau = 1; tau < yin->length; tau++) { 142 yin->data[tau] = 0.; 143 for (j = 0; j < yin->length; j++) { 144 tmp = input->data[j] - input->data[j + tau]; 145 yin->data[tau] += SQR (tmp); 141 smpl_t tmp, tmp2 = 0.; 142 143 yin_data[0] = 1.; 144 for (tau = 1; tau < length; tau++) { 145 yin_data[tau] = 0.; 146 for (j = 0; j < length; j++) { 147 tmp = input_data[j] - input_data[j + tau]; 148 yin_data[tau] += SQR (tmp); 146 149 } 147 tmp2 += yin ->data[tau];150 tmp2 += yin_data[tau]; 148 151 if (tmp2 != 0) { 149 152 yin->data[tau] *= tau / tmp2; … … 152 155 } 153 156 period = tau - 3; 154 if (tau > 4 && (yin ->data[period] < tol) &&155 (yin ->data[period] < yin->data[period + 1])) {157 if (tau > 4 && (yin_data[period] < tol) && 158 (yin_data[period] < yin_data[period + 1])) { 156 159 out->data[0] = fvec_quadratic_peak_pos (yin, period); 157 160 goto beach; -
src/pitch/pitchyinfft.c
r71f2e5f r41b985f 63 63 p->winput = new_fvec (bufsize); 64 64 p->fft = new_aubio_fft (bufsize); 65 if (!p->fft) goto beach; 65 66 p->fftout = new_fvec (bufsize); 66 67 p->sqrmag = new_fvec (bufsize); … … 96 97 p->short_period = (uint_t)ROUND(samplerate / 1300.); 97 98 return p; 99 100 beach: 101 if (p->winput) del_fvec(p->winput); 102 AUBIO_FREE(p); 103 return NULL; 98 104 } 99 105 -
src/spectral/ooura_fft8g.c
r71f2e5f r41b985f 3 3 // - include "aubio_priv.h" (for config.h and types.h) 4 4 // - add missing prototypes 5 // - use COS and SIN macros 5 // - use COS, SIN, and ATAN macros 6 // - add cast to (smpl_t) to avoid float conversion warnings 6 7 // - declare initialization as static 7 8 // - prefix public function with aubio_ooura_ … … 364 365 a[1] = xi; 365 366 } else { 366 a[1] = 0.5 * (a[0] - a[1]);367 a[1] = (smpl_t)0.5 * (a[0] - a[1]); 367 368 a[0] -= a[1]; 368 369 if (n > 4) { … … 693 694 if (nw > 2) { 694 695 nwh = nw >> 1; 695 delta = atan(1.0) / nwh;696 delta = ATAN(1.0) / nwh; 696 697 w[0] = 1; 697 698 w[1] = 0; … … 727 728 if (nc > 1) { 728 729 nch = nc >> 1; 729 delta = atan(1.0) / nch;730 c[0] = cos(delta * nch);731 c[nch] = 0.5 * c[0];730 delta = ATAN(1.0) / nch; 731 c[0] = COS(delta * nch); 732 c[nch] = (smpl_t)0.5 * c[0]; 732 733 for (j = 1; j < nch; j++) { 733 c[j] = 0.5 * cos(delta * j);734 c[nc - j] = 0.5 * sin(delta * j);734 c[j] = (smpl_t)0.5 * COS(delta * j); 735 c[nc - j] = (smpl_t)0.5 * SIN(delta * j); 735 736 } 736 737 } … … 1588 1589 k = n - j; 1589 1590 kk += ks; 1590 wkr = 0.5 - c[nc - kk];1591 wkr = (smpl_t)0.5 - c[nc - kk]; 1591 1592 wki = c[kk]; 1592 1593 xr = a[j] - a[k]; … … 1614 1615 k = n - j; 1615 1616 kk += ks; 1616 wkr = 0.5 - c[nc - kk];1617 wkr = (smpl_t)0.5 - c[nc - kk]; 1617 1618 wki = c[kk]; 1618 1619 xr = a[j] - a[k]; -
src/spectral/phasevoc.c
r71f2e5f r41b985f 89 89 goto beach; 90 90 } else if (win_s < hop_s) { 91 AUBIO_ERR("pvoc: hop size (%d) is larger than win size (%d)\n", win_s, hop_s);91 AUBIO_ERR("pvoc: hop size (%d) is larger than win size (%d)\n", hop_s, win_s); 92 92 goto beach; 93 93 } -
src/synth/sampler.c
r71f2e5f r41b985f 21 21 #include <assert.h> 22 22 23 #include "config.h"24 23 #include "aubio_priv.h" 25 24 #include "fvec.h" -
src/synth/wavetable.c
r71f2e5f r41b985f 20 20 21 21 22 #include "config.h"23 22 #include "aubio_priv.h" 24 23 #include "fvec.h" -
src/tempo/tempo.h
r71f2e5f r41b985f 155 155 \param o beat tracking object 156 156 157 \return confidence with which the tempo has been observed, `0` if no158 consistent value is found.157 \return confidence with which the tempo has been observed, the higher the 158 more confidence, `0` if no consistent value is found. 159 159 160 160 */ -
src/temporal/biquad.c
r71f2e5f r41b985f 42 42 as->data[0] = 1.; 43 43 as->data[1] = a1; 44 as->data[ 1] = a2;44 as->data[2] = a2; 45 45 return AUBIO_OK; 46 46 } -
src/temporal/resampler.c
r71f2e5f r41b985f 18 18 19 19 */ 20 21 #include "config.h"22 20 23 21 #include "aubio_priv.h" -
src/utils/log.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include "config.h"22 21 #include "aubio_priv.h" 23 22 #include "log.h" … … 36 35 FILE *out; 37 36 out = stdout; 38 if (level == AUBIO_LOG_ DBG || level == AUBIO_LOG_ERR) {37 if (level == AUBIO_LOG_ERR || level == AUBIO_LOG_DBG || level == AUBIO_LOG_WRN) { 39 38 out = stderr; 40 39 } -
src/utils/log.h
r71f2e5f r41b985f 46 46 enum aubio_log_level { 47 47 AUBIO_LOG_ERR, /**< critical errors */ 48 AUBIO_LOG_ WRN, /**< warnings */48 AUBIO_LOG_INF, /**< infos */ 49 49 AUBIO_LOG_MSG, /**< general messages */ 50 50 AUBIO_LOG_DBG, /**< debug messages */ 51 AUBIO_LOG_WRN, /**< warnings */ 51 52 AUBIO_LOG_LAST_LEVEL, /**< number of valid levels */ 52 53 }; -
src/utils/parameter.c
r71f2e5f r41b985f 19 19 */ 20 20 21 #include "config.h"22 21 #include "aubio_priv.h" 23 22 #include "parameter.h" -
src/utils/windll.c
r71f2e5f r41b985f 25 25 */ 26 26 27 #include " config.h"27 #include "aubio_priv.h" 28 28 29 29 #ifdef HAVE_WIN_HACKS -
src/vecutils.c
r71f2e5f r41b985f 1 #include "config.h"2 1 #include "aubio_priv.h" 3 2 #include "types.h" -
src/wscript_build
r71f2e5f r41b985f 29 29 elif ctx.env['DEST_OS'] in ['emscripten']: 30 30 build_features = ['cstlib'] 31 else: #linux, darwin, android, mingw, ... 31 elif '--static' in ctx.env['LDFLAGS'] or '--static' in ctx.env['LINKFLAGS']: 32 # static in cflags, ... 33 build_features = ['cstlib'] 34 else: 35 # linux, darwin, android, mingw, ... 32 36 build_features = ['cstlib', 'cshlib'] 37 38 # also install static lib 39 from waflib.Tools.c import cstlib 40 from waflib.Tools.fc import fcstlib 41 fcstlib.inst_to = cstlib.inst_to = '${LIBDIR}' 33 42 34 43 for target in build_features: … … 39 48 40 49 # install headers, except _priv.h ones 41 ctx.install_files('${ PREFIX}/include/aubio/',50 ctx.install_files('${INCLUDEDIR}/aubio/', 42 51 ctx.path.ant_glob('**/*.h', excl = ['**_priv.h', 'config.h']), 43 52 relative_trick=True) -
tests/src/io/test-sink_sndfile-multi.c
r71f2e5f r41b985f 1 1 #define AUBIO_UNSTABLE 1 2 2 #include <aubio.h> 3 #include "config.h"4 3 #include "utils_tests.h" 5 4 -
tests/src/io/test-sink_sndfile.c
r71f2e5f r41b985f 1 1 #define AUBIO_UNSTABLE 1 2 2 #include <aubio.h> 3 #include "config.h"4 3 #include "utils_tests.h" 5 4 -
tests/src/spectral/test-phasevoc.c
r71f2e5f r41b985f 29 29 cvec_print (fftgrain); 30 30 31 // option naly rebuild the signa31 // optionally rebuild the signal 32 32 aubio_pvoc_rdo(pv,fftgrain,out); 33 33 -
tests/src/utils/test-log.c
r71f2e5f r41b985f 10 10 void logging(int level, const char_t *message, void *data) { 11 11 FILE *out; 12 fprintf(stdout, "using custom logging function\n");12 //fprintf(stdout, "using custom logging function\n"); 13 13 if (level == AUBIO_LOG_ERR) { 14 14 out = stderr; … … 26 26 fprintf(stdout, "### testing normal logging\n"); 27 27 AUBIO_ERR("testing normal AUBIO_LOG_ERR\n"); 28 AUBIO_INF("testing normal AUBIO_LOG_INF\n"); 28 29 AUBIO_WRN("testing normal AUBIO_LOG_WRN\n"); 29 30 AUBIO_MSG("testing normal AUBIO_LOG_MSG\n"); … … 32 33 fprintf(stdout, "### testing with one custom function\n"); 33 34 aubio_log_set_function(logging, (void *)hdr); 34 AUBIO_ERR("testing recustom AUBIO_LOG_ERR\n"); 35 AUBIO_WRN("testing recustom AUBIO_LOG_WRN\n"); 36 AUBIO_MSG("testing recustom AUBIO_LOG_MSG\n"); 37 AUBIO_DBG("testing recustom AUBIO_LOG_DBG\n"); 35 AUBIO_ERR("testing custom set_function AUBIO_LOG_ERR\n"); 36 AUBIO_INF("testing custom set_function AUBIO_LOG_INF\n"); 37 AUBIO_WRN("testing custom set_function AUBIO_LOG_WRN\n"); 38 AUBIO_MSG("testing custom set_function AUBIO_LOG_MSG\n"); 39 AUBIO_DBG("testing custom set_function AUBIO_LOG_DBG\n"); 38 40 39 41 fprintf(stdout, "### testing resetted logging\n"); 40 42 aubio_log_reset(); 41 AUBIO_ERR("testing uncustom AUBIO_LOG_ERR\n"); 42 AUBIO_WRN("testing uncustom AUBIO_LOG_WRN\n"); 43 AUBIO_MSG("testing uncustom AUBIO_LOG_MSG\n"); 44 AUBIO_DBG("testing uncustom AUBIO_LOG_DBG\n"); 43 AUBIO_ERR("testing again normal AUBIO_LOG_ERR\n"); 44 AUBIO_INF("testing again normal AUBIO_LOG_INF\n"); 45 AUBIO_WRN("testing again normal AUBIO_LOG_WRN\n"); 46 AUBIO_MSG("testing again normal AUBIO_LOG_MSG\n"); 47 AUBIO_DBG("testing again normal AUBIO_LOG_DBG\n"); 45 48 46 49 fprintf(stdout, "### testing per level customization\n"); … … 48 51 aubio_log_set_level_function(AUBIO_LOG_WRN, logging, NULL); 49 52 aubio_log_set_level_function(AUBIO_LOG_MSG, logging, (void *)hdr); 50 AUBIO_ERR("testing custom AUBIO_LOG_ERR\n"); 51 AUBIO_WRN("testing custom AUBIO_LOG_WRN with data=NULL\n"); 52 AUBIO_MSG("testing custom AUBIO_LOG_MSG\n"); 53 AUBIO_DBG("testing uncustomized AUBIO_LOG_DBG\n"); 53 AUBIO_ERR("testing custom set_level_function AUBIO_LOG_ERR\n"); 54 AUBIO_INF("testing again normal AUBIO_LOG_INF\n"); 55 AUBIO_WRN("testing custom set_level_function AUBIO_LOG_WRN with data=NULL\n"); 56 AUBIO_MSG("testing custom set_level_function AUBIO_LOG_MSG\n"); 57 AUBIO_DBG("testing again normal AUBIO_LOG_DBG\n"); 54 58 55 59 return 0; -
wscript
r71f2e5f r41b985f 48 48 49 49 def options(ctx): 50 ctx.add_option('--build-type', action = 'store', 51 default = "release", 52 choices = ('debug', 'release'), 53 dest = 'build_type', 54 help = 'whether to compile with (--build-type=release) or without (--build-type=debug) '\ 55 ' compiler opimizations [default: release]') 50 56 add_option_enable_disable(ctx, 'fftw3f', default = False, 51 57 help_str = 'compile with fftw3f instead of ooura (recommended)', … … 87 93 help_str = 'use CoreFoundation (darwin only) (auto)', 88 94 help_disable_str = 'do not use CoreFoundation framework') 89 add_option_enable_disable(ctx, 'atlas', default = None,90 help_str = 'use Atlas library ( auto)',95 add_option_enable_disable(ctx, 'atlas', default = False, 96 help_str = 'use Atlas library (no)', 91 97 help_disable_str = 'do not use Atlas library') 92 98 add_option_enable_disable(ctx, 'wavread', default = True, … … 134 140 ctx.env['DEST_OS'] = target_platform 135 141 142 if ctx.options.build_type == "debug": 143 ctx.define('DEBUG', 1) 144 else: 145 ctx.define('NDEBUG', 1) 146 136 147 if ctx.env.CC_NAME != 'msvc': 137 ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra'] 148 if ctx.options.build_type == "debug": 149 # no optimization in debug mode 150 ctx.env.prepend_value('CFLAGS', ['-O0']) 151 else: 152 # default to -O2 in release mode 153 ctx.env.prepend_value('CFLAGS', ['-O2']) 154 # enable debug symbols and configure warnings 155 ctx.env.prepend_value('CFLAGS', ['-g', '-Wall', '-Wextra']) 138 156 else: 139 ctx.env.CFLAGS += ['/W4', '/MD'] 140 ctx.env.CFLAGS += ['/D_CRT_SECURE_NO_WARNINGS'] 157 # enable debug symbols 158 ctx.env.CFLAGS += ['/Z7', '/FS'] 159 ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO'] 160 # configure warnings 161 ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS'] 162 # set optimization level and runtime libs 163 if (ctx.options.build_type == "release"): 164 ctx.env.CFLAGS += ['/Ox'] 165 ctx.env.CFLAGS += ['/MD'] 166 else: 167 assert(ctx.options.build_type == "debug") 168 ctx.env.CFLAGS += ['/MDd'] 141 169 142 170 ctx.check_cc(lib='m', uselib_store='M', mandatory=False) … … 160 188 ctx.define('HAVE_SOURCE_APPLE_AUDIO', 1) 161 189 ctx.define('HAVE_SINK_APPLE_AUDIO', 1) 190 ctx.msg('Checking for AudioToolbox.framework', 'yes') 191 else: 192 ctx.msg('Checking for AudioToolbox.framework', 'no (disabled)', color = 'YELLOW') 162 193 if (ctx.options.enable_accelerate != False): 163 194 ctx.define('HAVE_ACCELERATE', 1) 164 195 ctx.env.FRAMEWORK += ['Accelerate'] 196 ctx.msg('Checking for Accelerate framework', 'yes') 197 else: 198 ctx.msg('Checking for Accelerate framework', 'no (disabled)', color = 'YELLOW') 165 199 166 200 if target_platform in [ 'ios', 'iosimulator' ]: … … 270 304 271 305 # check for libsamplerate 306 if (ctx.options.enable_double): 307 if (ctx.options.enable_samplerate): 308 ctx.fatal("Could not compile aubio in double precision mode with libsamplerate") 309 else: 310 ctx.options.enable_samplerate = False 311 ctx.msg('Checking if using samplerate', 'no (disabled in double precision mode)', 312 color = 'YELLOW') 272 313 if (ctx.options.enable_samplerate != False): 273 314 ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15', … … 330 371 # the following defines will be passed as arguments to the compiler 331 372 # instead of being written to src/config.h 373 ctx.define('HAVE_CONFIG_H', 1) 332 374 333 375 # add some defines used in examples … … 362 404 bld.env['LIB_VERSION'] = LIB_VERSION 363 405 406 # main source 407 bld.recurse('src') 408 364 409 # add sub directories 365 bld.recurse('src')366 410 if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']: 367 411 bld.recurse('examples') 368 412 bld.recurse('tests') 369 413 414 # pkg-config template 370 415 bld( source = 'aubio.pc.in' ) 371 416 417 # documentation 418 txt2man(bld) 419 doxygen(bld) 420 sphinx(bld) 421 422 def txt2man(bld): 372 423 # build manpages from txt files using txt2man 373 424 if bld.env['TXT2MAN']: 374 425 from waflib import TaskGen 375 426 if 'MANDIR' not in bld.env: 376 bld.env['MANDIR'] = bld.env['PREFIX'] + '/share/man' 427 bld.env['MANDIR'] = bld.env['DATAROOTDIR'] + '/man' 428 bld.env.VERSION = VERSION 377 429 rule_str = '${TXT2MAN} -t `basename ${TGT} | cut -f 1 -d . | tr a-z A-Z`' 378 430 rule_str += ' -r ${PACKAGE}\\ ${VERSION} -P ${PACKAGE}' … … 389 441 bld( source = bld.path.ant_glob('doc/*.txt') ) 390 442 443 def doxygen(bld): 391 444 # build documentation from source files using doxygen 392 445 if bld.env['DOXYGEN']: 393 446 bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null', 394 447 source = 'doc/web.cfg', 448 target = '../doc/web/html/index.html', 395 449 cwd = 'doc') 396 bld.install_files( '${ PREFIX}' + '/share/doc/libaubio-doc',450 bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc', 397 451 bld.path.ant_glob('doc/web/html/**'), 398 452 cwd = bld.path.find_dir ('doc/web'), 399 453 relative_trick = True) 400 454 455 def sphinx(bld): 401 456 # build documentation from source files using sphinx-build 457 # note: build in ../doc/_build/html, otherwise waf wont install unsigned files 402 458 if bld.env['SPHINX']: 403 bld( name = 'sphinx', rule = 'make html', 404 source = ['doc/conf.py'] + bld.path.ant_glob('doc/**.rst'), 405 cwd = 'doc') 406 bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc/sphinx', 459 bld.env.VERSION = VERSION 460 bld( name = 'sphinx', 461 rule = '${SPHINX} -b html -D release=${VERSION} -D version=${VERSION} -a -q `dirname ${SRC}` `dirname ${TGT}`', 462 source = 'doc/conf.py', 463 target = '../doc/_build/html/index.html') 464 bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc/sphinx', 407 465 bld.path.ant_glob('doc/_build/html/**'), 408 cwd = bld.path.find_dir 466 cwd = bld.path.find_dir('doc/_build/html'), 409 467 relative_trick = True) 468 469 # register the previous rules as build rules 470 from waflib.Build import BuildContext 471 472 class build_txt2man(BuildContext): 473 cmd = 'txt2man' 474 fun = 'txt2man' 475 476 class build_manpages(BuildContext): 477 cmd = 'manpages' 478 fun = 'txt2man' 479 480 class build_sphinx(BuildContext): 481 cmd = 'sphinx' 482 fun = 'sphinx' 483 484 class build_doxygen(BuildContext): 485 cmd = 'doxygen' 486 fun = 'doxygen' 410 487 411 488 def shutdown(bld): … … 418 495 419 496 def dist(ctx): 420 ctx.excl = ' **/.waf -1* **/*~ **/*.pyc **/*.swp **/*.swo **/*.swn **/.lock-w* **/.git*'497 ctx.excl = ' **/.waf* **/*~ **/*.pyc **/*.swp **/*.swo **/*.swn **/.lock-w* **/.git*' 421 498 ctx.excl += ' **/build/*' 422 499 ctx.excl += ' doc/_build' … … 427 504 ctx.excl += ' **.egg-info' 428 505 ctx.excl += ' **/**.zip **/**.tar.bz2' 506 ctx.excl += ' **.tar.bz2' 429 507 ctx.excl += ' **/doc/full/* **/doc/web/*' 508 ctx.excl += ' **/doc/full.cfg' 430 509 ctx.excl += ' **/python/*.db' 431 510 ctx.excl += ' **/python.old/*'
Note: See TracChangeset
for help on using the changeset viewer.