diff --git a/docs/benchmark.rst b/docs/benchmark.rst index 19c3593..3269eff 100644 --- a/docs/benchmark.rst +++ b/docs/benchmark.rst @@ -30,13 +30,12 @@ Python packages The following Python packages are benchmarked against each other: -* aubio_ 0.4.5 -* audioread_ 2.1.9 -* :mod:`audiofile` 1.1.0 -* librosa_ 0.9.1 -* pedalboard_ 0.5.3 -* scipy_ 1.8.0 -* soundfile_ 0.10.3.post1 +* audioread_ 3.0.1 +* :mod:`audiofile` 1.3.0 +* librosa_ 0.10.1 +* pedalboard_ 0.8.6 +* scipy_ 1.11.4 +* soundfile_ 0.21.1 * sox_ 1.4.1 scipy_ and librosa_ are only tested for reading files, @@ -75,7 +74,7 @@ The benchmark was executed on the following machine: * RAM: 15.37 GB * Hard drive: Samsung SSD 860 * Linux: Ubuntu 18.04.6 -* Python: 3.8.13 +* Python: 3.10.11 To rerun the benchmark yourself, clone the repository @@ -88,7 +87,7 @@ and execute: $ bash generate_audio.sh $ bash run.sh -This requires that Python 3.8 is installed +This requires that Python 3.10 is installed and will ask for a sudo password to install missing apt packages. @@ -153,7 +152,6 @@ and is shown as audiofile (sloppy) in the figure. -.. _aubio: https://github.com/aubio/aubio/ .. _audioread: https://github.com/beetbox/audioread/ .. _ffmpeg: https://ffmpeg.org/ .. _gstreamer: https://gstreamer.freedesktop.org/ diff --git a/docs/benchmark/benchmark_info.py b/docs/benchmark/benchmark_info.py index c3e0793..592b5f5 100644 --- a/docs/benchmark/benchmark_info.py +++ b/docs/benchmark/benchmark_info.py @@ -57,7 +57,6 @@ def __len__(self): libs = [ 'ar_ffmpeg', 'ar_mad', - 'aubio', 'audiofile', 'audiofile_sloppy', 'pedalboard', diff --git a/docs/benchmark/benchmark_read.py b/docs/benchmark/benchmark_read.py index 8cec446..3cd5d1f 100644 --- a/docs/benchmark/benchmark_read.py +++ b/docs/benchmark/benchmark_read.py @@ -63,7 +63,6 @@ def __len__(self): libs = [ 'ar_ffmpeg', 'ar_mad', - 'aubio', 'audiofile', 'librosa', 'pedalboard', diff --git a/docs/benchmark/install_dependencies.sh b/docs/benchmark/install_dependencies.sh index b133996..481dfa3 100644 --- a/docs/benchmark/install_dependencies.sh +++ b/docs/benchmark/install_dependencies.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Libraries for audioread and aubio -sudo apt-get install -y libmad0-dev sox ffmpeg libaubio-dev +# Libraries for audioread +sudo apt-get install -y libmad0-dev sox ffmpeg sudo apt-get install -y libavresample-dev libswresample-dev libavutil-dev sudo apt-get install -y libavcodec-dev libavformat-dev libsamplerate0-dev @@ -12,16 +12,11 @@ then fi ENV_DIR="${HOME}/.envs/audiofile-benchmark" rm -rf ${ENV_DIR} -virtualenv --python=python3.8 ${ENV_DIR} +virtualenv --python=python3.10 ${ENV_DIR} source ${ENV_DIR}/bin/activate pip install --upgrade pip # Enforce rebuilding of wheels pip cache purge -# Fix numpy header include for aubio -pip install "numpy==1.21.6" -mkdir -p ${ENV_DIR}/include/ -ln -sf ${ENV_DIR}lib/python3.8/site-packages/numpy/core/include/numpy ${ENV_DIR}/include/ - pip install -r requirements.txt.lock diff --git a/docs/benchmark/loaders.py b/docs/benchmark/loaders.py index ecf5b4c..07b759e 100644 --- a/docs/benchmark/loaders.py +++ b/docs/benchmark/loaders.py @@ -1,4 +1,3 @@ -import aubio import audiofile as af import audioread.rawread import audioread.gstdec @@ -17,20 +16,6 @@ """ -def load_aubio(fp): - f = aubio.source(fp, hop_size=1024) - sig = np.zeros(f.duration, dtype=aubio.float_type) - total_frames = 0 - while True: - samples, read = f() - if total_frames + read <= f.duration: - sig[total_frames:total_frames + read] = samples[:read] - total_frames += read - if read < f.hop_size: - break - return sig - - def load_soundfile(fp): sig, rate = sf.read(fp) return sig @@ -156,19 +141,6 @@ def info_ar_ffmpeg(fp): return info -def info_aubio(fp): - info = {} - with aubio.source(fp) as f: - info['duration'] = f.duration / f.samplerate - with aubio.source(fp) as f: - info['samples'] = f.duration - with aubio.source(fp) as f: - info['channels'] = f.channels - with aubio.source(fp) as f: - info['sampling_rate'] = f.samplerate - return info - - def info_sox(fp): info = {} info['duration'] = sox.file_info.duration(fp) diff --git a/docs/benchmark/plot.py b/docs/benchmark/plot.py index ec73909..36ab88b 100644 --- a/docs/benchmark/plot.py +++ b/docs/benchmark/plot.py @@ -6,7 +6,6 @@ NBFILES = 10 # must be identical to generate_audio.sh MAPPINGS = { # library name mappings - 'aubio': 'aubio', 'audiofile': 'audiofile', 'audiofile_sloppy': 'audiofile (sloppy)', 'ar_ffmpeg': 'audioread (ffmpeg)', @@ -42,7 +41,6 @@ lib_order = [ MAPPINGS['audiofile'], MAPPINGS['soundfile'], - MAPPINGS['aubio'], MAPPINGS['librosa'], MAPPINGS['ar_ffmpeg'], MAPPINGS['pedalboard'], @@ -54,7 +52,6 @@ lib_order = [ MAPPINGS['audiofile'], MAPPINGS['soundfile'], - MAPPINGS['aubio'], MAPPINGS['pedalboard'], ] height = 3.36 @@ -62,7 +59,6 @@ elif 'mp3' in exts and package == 'read': lib_order = [ MAPPINGS['audiofile'], - MAPPINGS['aubio'], MAPPINGS['librosa'], MAPPINGS['ar_ffmpeg'], MAPPINGS['ar_mad'], @@ -74,7 +70,6 @@ lib_order = [ MAPPINGS['audiofile'], MAPPINGS['audiofile_sloppy'], - MAPPINGS['aubio'], MAPPINGS['ar_ffmpeg'], MAPPINGS['ar_mad'], MAPPINGS['pedalboard'], @@ -90,13 +85,12 @@ MAPPINGS['audiofile']: '#4a74b5', MAPPINGS['audiofile_sloppy']: '#6b93d7', MAPPINGS['soundfile']: '#db8548', - MAPPINGS['aubio']: '#5dab64', MAPPINGS['librosa']: '#c34c4d', MAPPINGS['scipy']: '#8174b8', MAPPINGS['ar_mad']: '#94785e', MAPPINGS['ar_ffmpeg']: '#94785e', MAPPINGS['sox']: '#db8cc5', - MAPPINGS['pedalboard']: '#cdbb75', + MAPPINGS['pedalboard']: '#5dab64', } g = sns.catplot( @@ -110,10 +104,9 @@ data=y, height=height, aspect=aspect, - legend=False + legend=True, ) g.despine(left=True) - plt.legend(loc='upper right') plt.xlabel('time / s per file') plt.ylabel('file format') if package == 'info': diff --git a/docs/benchmark/requirements.txt b/docs/benchmark/requirements.txt index f9927d1..a9f41e6 100644 --- a/docs/benchmark/requirements.txt +++ b/docs/benchmark/requirements.txt @@ -1,10 +1,9 @@ -aubio ==0.4.5 audiofile audioread librosa pandas -pedalboard ==0.5.3 -pygobject +pedalboard +pygobject==3.42.1 pymad scipy seaborn diff --git a/docs/benchmark/requirements.txt.lock b/docs/benchmark/requirements.txt.lock index 9f5682d..4b5e2d2 100644 --- a/docs/benchmark/requirements.txt.lock +++ b/docs/benchmark/requirements.txt.lock @@ -1,134 +1,132 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: # # pip-compile --output-file=requirements.txt.lock requirements.txt # --index-url https://artifactory.audeering.com/artifactory/api/pypi/pypi/simple +--trusted-host artifactory.audeering.com -appdirs==1.4.4 - # via pooch -aubio==0.4.5 - # via -r requirements.txt -audeer==1.18.0 +audeer==1.20.2 # via audiofile -audiofile==1.1.0 +audiofile==1.3.0 # via -r requirements.txt -audioread==2.1.9 +audioread==3.0.1 # via # -r requirements.txt # librosa -certifi==2021.10.8 +audmath==1.4.0 + # via audiofile +certifi==2023.11.17 # via requests -cffi==1.15.0 +cffi==1.16.0 # via soundfile -charset-normalizer==2.0.12 +charset-normalizer==3.3.2 # via requests -cycler==0.11.0 +contourpy==1.2.0 + # via matplotlib +cycler==0.12.1 # via matplotlib decorator==5.1.1 # via librosa -fonttools==4.32.0 +fonttools==4.45.1 # via matplotlib -idna==3.3 +idna==3.6 # via requests -joblib==1.1.0 +joblib==1.3.2 # via # librosa # scikit-learn -kiwisolver==1.4.2 +kiwisolver==1.4.5 # via matplotlib -librosa==0.9.1 +lazy-loader==0.3 + # via librosa +librosa==0.10.1 # via -r requirements.txt -llvmlite==0.38.0 +llvmlite==0.41.1 # via numba -matplotlib==3.5.1 +matplotlib==3.8.2 # via seaborn -numba==0.55.1 - # via - # librosa - # resampy -numpy==1.21.6 +msgpack==1.0.7 + # via librosa +numba==0.58.1 + # via librosa +numpy==1.26.2 # via - # aubio # audiofile + # audmath + # contourpy # librosa # matplotlib # numba # pandas # pedalboard - # resampy # scikit-learn # scipy # seaborn # sox -packaging==21.3 + # soxr +packaging==23.2 # via - # librosa # matplotlib # pooch -pandas==1.4.2 +pandas==2.1.3 # via # -r requirements.txt # seaborn -pedalboard==0.5.3 +pedalboard==0.8.6 # via -r requirements.txt -pillow==9.1.0 +pillow==10.1.0 # via matplotlib -pooch==1.6.0 +platformdirs==4.0.0 + # via pooch +pooch==1.8.0 # via librosa -pycairo==1.21.0 +pycairo==1.25.1 # via pygobject pycparser==2.21 # via cffi pygobject==3.42.1 # via -r requirements.txt -pymad==0.10 +pymad==0.11.3 # via -r requirements.txt -pyparsing==3.0.8 - # via - # matplotlib - # packaging +pyparsing==3.1.1 + # via matplotlib python-dateutil==2.8.2 # via # matplotlib # pandas -pytz==2022.1 +pytz==2023.3.post1 # via pandas -requests==2.27.1 +requests==2.31.0 # via pooch -resampy==0.2.2 - # via librosa -scikit-learn==1.0.2 +scikit-learn==1.3.2 # via librosa -scipy==1.8.0 +scipy==1.11.4 # via # -r requirements.txt # librosa - # resampy # scikit-learn - # seaborn -seaborn==0.11.2 +seaborn==0.13.0 # via -r requirements.txt six==1.16.0 - # via - # python-dateutil - # resampy -soundfile==0.10.3.post1 + # via python-dateutil +soundfile==0.12.1 # via # -r requirements.txt # audiofile # librosa sox==1.4.1 - # via - # -r requirements.txt - # audiofile -threadpoolctl==3.1.0 + # via -r requirements.txt +soxr==0.3.7 + # via librosa +threadpoolctl==3.2.0 # via scikit-learn -tqdm==4.64.0 +tqdm==4.66.1 # via audeer -urllib3==1.26.9 +typing-extensions==4.8.0 + # via librosa +tzdata==2023.3 + # via pandas +urllib3==2.1.0 # via requests - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/docs/benchmark/results/benchmark_info_wav.pickle b/docs/benchmark/results/benchmark_info_wav.pickle index 13c2a6e..7e15b74 100644 Binary files a/docs/benchmark/results/benchmark_info_wav.pickle and b/docs/benchmark/results/benchmark_info_wav.pickle differ diff --git a/docs/benchmark/results/benchmark_mp3-mp4_info.png b/docs/benchmark/results/benchmark_mp3-mp4_info.png index 89173d7..1b3303e 100644 Binary files a/docs/benchmark/results/benchmark_mp3-mp4_info.png and b/docs/benchmark/results/benchmark_mp3-mp4_info.png differ diff --git a/docs/benchmark/results/benchmark_mp3-mp4_read.png b/docs/benchmark/results/benchmark_mp3-mp4_read.png index 46f6683..d62fbec 100644 Binary files a/docs/benchmark/results/benchmark_mp3-mp4_read.png and b/docs/benchmark/results/benchmark_mp3-mp4_read.png differ diff --git a/docs/benchmark/results/benchmark_read_wav.pickle b/docs/benchmark/results/benchmark_read_wav.pickle index 74850f3..62dd552 100644 Binary files a/docs/benchmark/results/benchmark_read_wav.pickle and b/docs/benchmark/results/benchmark_read_wav.pickle differ diff --git a/docs/benchmark/results/benchmark_wav-flac-ogg_info.png b/docs/benchmark/results/benchmark_wav-flac-ogg_info.png index b6e88a4..7429044 100644 Binary files a/docs/benchmark/results/benchmark_wav-flac-ogg_info.png and b/docs/benchmark/results/benchmark_wav-flac-ogg_info.png differ diff --git a/docs/benchmark/results/benchmark_wav-flac-ogg_read.png b/docs/benchmark/results/benchmark_wav-flac-ogg_read.png index 65c7b47..ce1d283 100644 Binary files a/docs/benchmark/results/benchmark_wav-flac-ogg_read.png and b/docs/benchmark/results/benchmark_wav-flac-ogg_read.png differ