Audio sample rate and sample type converter for VapourSynth utilizing the SoX Resampler library
Project description
VapourSynth Ares
This package contains the VS-AudioResample VapourSynth plugin.
Installation
pip install vapoursynth-ares
Building from source
uv build --package vapoursynth-ares
Detailed parameter information from the parent project follows.
VS-AudioResample
This is an audio sample rate and sample type converter for VapourSynth utilizing the SoX Resampler library.
Usage
ares.Resample(clip: vs.AudioNode,
sample_rate: int = -1,
sample_type: str = None,
quality: str = 'very_high',
overflow: str = 'error',
overflow_log: str = 'once'
) -> vs.AudioNode
clip - input audio clip (any format)
sample_rate - new sample rate (e.g. 16000, 44100, 48000, ...); same as input clip if negative; default: -1
sample_type - new sample type; same as input clip if None; default: None
'i16' - integer 16-bit
'i24' - integer 24-bit
'i32' - integer 32-bit
'f32' - float 32-bit
quality - resample quality; default: 'very_high'
'quick' - quick cubic interpolation
'low' - low quality
'medium' - medium quality
'high' - high quality
'very_high' - very high quality (default)
'max' - maximum quality
overflow - sample overflow handling; default: 'error'
'error' - raise an error (default)
'clip' - clip overflowing samples (all types)
'clip_int' - clip overflowing samples for integer output sample types
keep overflowing samples for float output sample types
'keep_float' - keep overflowing samples for float output sample types
raise an error if output sample type is not float
To properly handle overflows the clip should be converted to a float sample type ('f32'), if not already.
⚠️ Overflowing samples of integer sample types (output) are always clipped (disruptive), or they raise an error
Use overflow='keep_float' for float output sample types to leave overflowing samples unchanged.
Then call a scaling function like std.AudioGain that scales the peak sample value below or to equal 1.0 (see Example 3)
overflow_log - sample overflow logging; default: 'once'
'all' - log all sample overflows (not recommended, this can be a lot)
'once' - log only the first sample overflow (default)
'none' - do not log any sample overflows
Note: a summary of all overflowing samples will be logged at the end of each function (if any)
Example 1
basic usage
import vapoursynth as vs
# load audio
audio = ...
# convert sample rate to 48000 and sample type to 24-bit integer
audio = vs.core.ares.Resample(audio, sample_rate=48000, sample_type='i24')
Example 2
change speed of an audio clip (but keep the sample rate)
import vapoursynth as vs
# load audio
audio = ...
# speedup factor
factor = 2.0
resample_rate = round(audio.sample_rate / factor)
res_audio = vs.core.ares.Resample(audio, sample_rate=resample_rate)
audio = vs.core.std.AssumeSampleRate(res_audio, samplerate=audio.sample_rate)
Example 3
handle overflowing samples
import vapoursynth as vs
# load audio (integer or float sample type)
audio = ...
# convert sample rate to 48000 and sample type to 32-bit float
# leave possible overflowing samples unchanged with 'keep_float'
audio = vs.core.ares.Resample(audio, sample_rate=48000, sample_type='f32', overflow='keep_float')
# scale audio samples
# choose a factor that limits the peak value below or to equal 1
audio = vs.core.std.AudioGain(audio, 0.5)
# optional: convert sample type back to integer if needed (e.g. 24-bit)
audio = vs.core.ares.Resample(audio, sample_type='i24')
Dependencies
This project uses the SoX Resampler library (soxr), which is licensed under the GNU Lesser General Public License (LGPL) v2.1.
The distributed binaries of this plugin statically link to soxr for performance and ease of use. If you prefer to use a customized version of soxr, or to link dynamically instead, you can build the plugin from source. See the Build from source section for instructions.
Build from source
To build the plugin, you’ll need CMake and a C++20-compatible compiler. OpenMP support is optional.
Run CMake to configure your preferred build system, then build the project. This process will automatically download and build the soxr dependency along with the plugin.
Note: You don’t need to download or build soxr yourself. However, if you prefer to use a local or customized version of soxr, you can provide its source path during configuration (see options below).
e.g. CMake with Ninja:
# EITHER build with statically linked soxr
cmake -G Ninja -B ./build-ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
# OR build with dynamically linked soxr
cmake -G Ninja -B ./build-ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
ninja -C ./build-ninja
Custom options for cmake:
-DSOXR_SOURCE_DIR=<PATH> Use a custom soxr source directory
(must contain CMakeLists.txt)
-DSOXR_USE_PATCHES=<ON|OFF> Enable patches needed for outdated
soxr build scripts (default: ON)
-DWITH_OPENMP=<ON|OFF> Enable or disable OpenMP support (default: ON)
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vapoursynth_ares-0.4.0.tar.gz.
File metadata
- Download URL: vapoursynth_ares-0.4.0.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9e734f5b46455d96d6b780607a76afbf9882668fea7216e29c1170a00b5619
|
|
| MD5 |
2bdd0086d78041fd11c4c2892e941a11
|
|
| BLAKE2b-256 |
580f46bdfb8025c9aa9f681cb087039ebada37b01d5719faadfa5892f64b2a22
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0.tar.gz:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0.tar.gz -
Subject digest:
bc9e734f5b46455d96d6b780607a76afbf9882668fea7216e29c1170a00b5619 - Sigstore transparency entry: 1761713340
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-win_amd64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-win_amd64.whl
- Upload date:
- Size: 369.1 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a003256e25c5a1d6e52337252f728a1753d272ce3a4473bfbcc3ff79cbca8564
|
|
| MD5 |
c6e0355cd2c9872e59cc2e03875ba248
|
|
| BLAKE2b-256 |
e476194e28c33268e47ac7763c7e9f3292b62668a0ab67944b184fd4688da28f
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-win_amd64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-win_amd64.whl -
Subject digest:
a003256e25c5a1d6e52337252f728a1753d272ce3a4473bfbcc3ff79cbca8564 - Sigstore transparency entry: 1761713549
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ca7018a95787c9e872e87be551275e91242a6b9fdd438c4826ea5718cdd56b9
|
|
| MD5 |
938049815755c23eee661209d964365f
|
|
| BLAKE2b-256 |
26b8db812f2c9d89ff98155c22e1ef2648e35d8168175f8da3aeb80167f857ad
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_x86_64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_x86_64.whl -
Subject digest:
7ca7018a95787c9e872e87be551275e91242a6b9fdd438c4826ea5718cdd56b9 - Sigstore transparency entry: 1761713930
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dedf00df405257def04fd21f3112fceecede93aaf43a04782d86d74e173ce85
|
|
| MD5 |
9af001abd021cbf287a5476732bf60de
|
|
| BLAKE2b-256 |
6dddfe5361d42cf64008e1d5fa0c02a9f0906e651af4047503132788e4154035
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_aarch64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-musllinux_1_2_aarch64.whl -
Subject digest:
2dedf00df405257def04fd21f3112fceecede93aaf43a04782d86d74e173ce85 - Sigstore transparency entry: 1761713635
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 328.9 kB
- Tags: Python 3, manylinux: glibc 2.26+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78e3c2e69629ee2b8c40e35801408548ca814ee186a43a20ba15b39ff70174c1
|
|
| MD5 |
b3d4e5ad217a3d5e7f0cb14141105981
|
|
| BLAKE2b-256 |
174b6b8ad085b2ae6417c16ff7c4f2ca6c24b8b3fa839c0092b6152583eeb69b
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
78e3c2e69629ee2b8c40e35801408548ca814ee186a43a20ba15b39ff70174c1 - Sigstore transparency entry: 1761714024
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 266.2 kB
- Tags: Python 3, manylinux: glibc 2.24+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9d70e35d74db82d7240e4e54a8e00e3edb7c47bd1c10a02ca9b29700bf61c29
|
|
| MD5 |
b21ee0f8024b8f8d2a4e509fa35d8214
|
|
| BLAKE2b-256 |
71dadfd030d62fef18bae2bffaf8d9ec99730dabfc2661f954dbe2de0f59e45d
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
d9d70e35d74db82d7240e4e54a8e00e3edb7c47bd1c10a02ca9b29700bf61c29 - Sigstore transparency entry: 1761713821
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-macosx_13_0_x86_64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-macosx_13_0_x86_64.whl
- Upload date:
- Size: 207.9 kB
- Tags: Python 3, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d334ee53c7d527590e0974ed62bd5ed3d7b36307d34f3a7c52e9a44b8fcbf60
|
|
| MD5 |
1be4931e03ff575f060ff97d8e4b66e2
|
|
| BLAKE2b-256 |
150ce147426fdf2762152ec17d82eff474ffb3fcee5afd5587ae1a50aa0f1c92
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-macosx_13_0_x86_64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-macosx_13_0_x86_64.whl -
Subject digest:
7d334ee53c7d527590e0974ed62bd5ed3d7b36307d34f3a7c52e9a44b8fcbf60 - Sigstore transparency entry: 1761713431
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vapoursynth_ares-0.4.0-py3-none-macosx_13_0_arm64.whl.
File metadata
- Download URL: vapoursynth_ares-0.4.0-py3-none-macosx_13_0_arm64.whl
- Upload date:
- Size: 140.6 kB
- Tags: Python 3, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae1fd239eedb5e3bcf99c644b9d356c982a3d314028fe5bb00b7f7b7e63a4380
|
|
| MD5 |
5e195d351e155db81f5b005315093eb3
|
|
| BLAKE2b-256 |
184a2204227e6b7dcb97ec2fd6610dc2436cc1872373fc6493abf2664483359b
|
Provenance
The following attestation bundles were made for vapoursynth_ares-0.4.0-py3-none-macosx_13_0_arm64.whl:
Publisher:
cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_ares-0.4.0-py3-none-macosx_13_0_arm64.whl -
Subject digest:
ae1fd239eedb5e3bcf99c644b9d356c982a3d314028fe5bb00b7f7b7e63a4380 - Sigstore transparency entry: 1761713730
- Sigstore integration time:
-
Permalink:
Jaded-Encoding-Thaumaturgy/vs-wheels@11e12f7fb57638f75d0de11183e4d38d247041fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Jaded-Encoding-Thaumaturgy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish.yml@11e12f7fb57638f75d0de11183e4d38d247041fe -
Trigger Event:
workflow_dispatch
-
Statement type: