This is a wrapper around Erik de Castro Lopo’s libsamplerate (aka Secret Rabbit Code) for high-quality sample rate conversion.
It implements all three APIs available in libsamplerate:
Simple API: for resampling a large chunk of data with a single library call
Full API: for obtaining the resampled signal from successive chunks of data
Callback API: like Full API, but input samples are provided by a callback function
The libsamplerate library is statically built together with the python bindings using pybind11.
Installation
$ pip install samplerate
Binary wheels of libsamplerate are available for macOS (x86_64, arm64), Linux (x86_64, aarch64), and Windows (x86_64). Building from source on other platforms requires a C++14 or later compiler.
Usage
import numpy as np
import samplerate
# Synthesize data
fs = 1000.
t = np.arange(fs * 2) / fs
input_data = np.sin(2 * np.pi * 5 * t)
# Simple API
ratio = 1.5
converter = 'sinc_best' # or 'sinc_fastest', ...
output_data_simple = samplerate.resample(input_data, ratio, converter)
# Full API
resampler = samplerate.Resampler(converter, channels=1)
output_data_full = resampler.process(input_data, ratio, end_of_input=True)
# The result is the same for both APIs.
assert np.allclose(output_data_simple, output_data_full)
# See `samplerate.CallbackResampler` for the Callback API, or
# `examples/play_modulation.py` for an example.
See samplerate.resample, samplerate.Resampler, and samplerate.CallbackResampler in the API documentation for details.
See also
scikits.samplerate implements only the Simple API and uses Cython for extern calls. The resample function of scikits.samplerate and this package share the same function signature for compatiblity.
resampy: sample rate conversion in Python + Cython.
License
This project is licensed under the MIT license.
As of version 0.1.9, libsamplerate is licensed under the 2-clause BSD license.
Release files for samplerate 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| samplerate-0.2.4.tar.gz | 22.1 kB | Details |
Built distributions (wheels)
Total release size: 40.9 MB
Release files / samplerate-0.2.4.tar.gz
| Download URL | samplerate-0.2.4.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c44dcb6fe680246f8f36588ba1f0fc7a0c5fbce710ad5e9b3812d88e8c39ac7d
|
|
BLAKE2b-256 checksum How to use checksums |
cfc9d73630d0c4b85d19d4d1e936a5a87a727567a54a445119c6f46563df5627
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp314-cp314-win_amd64.whl
| Download URL | samplerate-0.2.4-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f8093c12d698ae821501efeb0796f189cb354d48ea8f6299ad9d79468df22eec
|
|
BLAKE2b-256 checksum How to use checksums |
20c6b358ba51344985295bcd95226efa5344b2b1267b27e7a2205a8cb36c46ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | samplerate-0.2.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
98f13c280f9e220eeb7512896eedeab45bf8fcb7914a9507f79b3f88add72bef
|
|
BLAKE2b-256 checksum How to use checksums |
d94348dd9cd11206613b1d00afa8f384f37d649912def16f13103c517350aca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | samplerate-0.2.4-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ad01c5f49181dd50ac2e36e7590619e743985a1a783540c7f4eb138482091da0
|
|
BLAKE2b-256 checksum How to use checksums |
a9031d314ef23ecc771157de27c20bc3363009dc1edb2be7e7142f16b44e9ffc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp314-cp314-macosx_10_15_universal2.whl
| Download URL | samplerate-0.2.4-cp314-cp314-macosx_10_15_universal2.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
4555da77c9b85c94688a31cde24a974ca467d45896f4b31dd16c185545d49198
|
|
BLAKE2b-256 checksum How to use checksums |
5956646992579c7226daa8649a553545bf70d8ddd48130678b586990771d24c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp313-cp313-win_amd64.whl
| Download URL | samplerate-0.2.4-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
be2159e7119647214f93da735d3f09753dd9f7969ff8be061c23f8eb218b1a2a
|
|
BLAKE2b-256 checksum How to use checksums |
98b1f30b80822196ab4f4607863a5ed8803e113e0a256dea668848a7c49c5082
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | samplerate-0.2.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
4a6b9fc423687dd84323cea7a2629bf18b9b102f2df430b5654631f134fe8fcf
|
|
BLAKE2b-256 checksum How to use checksums |
24087eb005757e9cfa9a6a0670bcc55c7f948cfe85a0f6400d1493339062e852
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | samplerate-0.2.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
610a33a2d7e2a68b94dffc5918cb8354de1b2f2ab1f03394190b58aa8a5da320
|
|
BLAKE2b-256 checksum How to use checksums |
3b2273cd4fd91482345426edcbe13ac17285a2a354621ae0199dbae49f3a3d26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | samplerate-0.2.4-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
c5db609a3e54484882a18536ef7e7d6216f3f29944bdda440771c066607e1beb
|
|
BLAKE2b-256 checksum How to use checksums |
2630cd92169274384aec71d7e12584a43a89b301af63eb2fd1ac7aca005b337b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp312-cp312-win_amd64.whl
| Download URL | samplerate-0.2.4-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2625a21eeffb81c896887659d6dffc01eedfdd60caaf653126a42871eee77aa6
|
|
BLAKE2b-256 checksum How to use checksums |
8917b287f445d475d4c560fea1a7c0c8674f5431c407209109133446d2d09a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | samplerate-0.2.4-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
089a19db605be2385558294480169afdcb1e89dcf1fdb72bd5a2e0849dd783b5
|
|
BLAKE2b-256 checksum How to use checksums |
868864a67d74737080cc3aeedd98bdc4999d22156fa70dba806badfdcd1504d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | samplerate-0.2.4-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ae92e3bcea4f74b2a66dc68b2cccef939250fca749982a45a614d10fe9f71440
|
|
BLAKE2b-256 checksum How to use checksums |
fdf4ef9cd26ebee43755182b6c2f0c60e6e5c524bc283383e07c5b7082f028c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | samplerate-0.2.4-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
b6a2c5cda090f3d5007a443c0f22635efe87b2fc0d2ea18dbdbd933cc2e560d2
|
|
BLAKE2b-256 checksum How to use checksums |
bad517218978d0a87510dc70270a2ed00a4e3df30404a41001e803b9e349b330
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp311-cp311-win_amd64.whl
| Download URL | samplerate-0.2.4-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d10c3088f63a55923cfda33dfc55498df0f92bf2afeeeca4a90751589e3b6af0
|
|
BLAKE2b-256 checksum How to use checksums |
ab93d6ccdeb89a07df6129106b545b100aee31ca3c6c68e48c24c71c0d8122fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | samplerate-0.2.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3a0bbbf088894208386b0dc30ebacd51bab7406931cd9c6c31c1cf99baf026ee
|
|
BLAKE2b-256 checksum How to use checksums |
b7e1d1a3ed051730a0f18301db6c182b9458a12c95cd899b16c08c1d4226ca53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | samplerate-0.2.4-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
af5ec978ed22567042ad188db622409d3c059245fe32a19202b9281b1352b962
|
|
BLAKE2b-256 checksum How to use checksums |
446a947b84aa0eeb846fc53f8f17d6f92342c482969ccfe817df1a547e3908c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | samplerate-0.2.4-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
e692d453ae6952a9fe7c66b451027370333553d31ca4690375f34f725ba6a6cd
|
|
BLAKE2b-256 checksum How to use checksums |
a52e6cc13a051e98348464ef6e3771ad6b457a303d77ed7823a86ec3f8e41310
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp310-cp310-win_amd64.whl
| Download URL | samplerate-0.2.4-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
26cea1b3ba494a9632ec46a43c31bcca2e24b341f41ea42f333a1183f25773a5
|
|
BLAKE2b-256 checksum How to use checksums |
c74c00dfc125b9ef29baa136f4b619ae7fc5c012b26f5cf0a01b0e60b3aadb30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | samplerate-0.2.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
5a4c2bd7f4fa3a1d638857adf8fb6f364383b18c5f5d877dc1b9eb1b6e45405d
|
|
BLAKE2b-256 checksum How to use checksums |
3f9b6834935e989ad4796a16d601892131ead71062431538716f50f6b8e7be3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | samplerate-0.2.4-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
558ad3b4416559a9b3a0e30a5315fd750d8d814162415531e961098a37976ddc
|
|
BLAKE2b-256 checksum How to use checksums |
ce2914fa4ee7184227de773c7d409d3314a7ab62fb8da735ddf867be12d0a9b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp39-cp39-win_amd64.whl
| Download URL | samplerate-0.2.4-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
68316335e3710de4991d31a715268c6c7bdc95a931858b8e4dc6e721859a2473
|
|
BLAKE2b-256 checksum How to use checksums |
711152ef12ddc13d05fd173a5e22553efd4c0069744dc2e02eadc1ea1f72b585
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | samplerate-0.2.4-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.9 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
41249f544776a4b133443e811df3e1e364d3f66706fc6b45ea9a450ea2d6259f
|
|
BLAKE2b-256 checksum How to use checksums |
f26b18196edff415f03be3e98b8286057d1884b96a93136b43c9ed67da736206
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / samplerate-0.2.4-cp39-cp39-macosx_10_9_universal2.whl
| Download URL | samplerate-0.2.4-cp39-cp39-macosx_10_9_universal2.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
316736283db9c24a7058caaa56d9782d8446361ceb343930a0be5eebbd8d09fd
|
|
BLAKE2b-256 checksum How to use checksums |
5cc40aca4e0ae15d4d30aef6a09f495846e0aa1673e0a1999e92282a32bff523
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|