samplerate 0.1.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- samplerate-0.2.1/.gitattributes +1 -0
- samplerate-0.2.1/.github/workflows/pythonpackage.yml +78 -0
- samplerate-0.2.1/.gitignore +16 -0
- samplerate-0.2.1/CMakeLists.txt +46 -0
- samplerate-0.2.1/MANIFEST.in +8 -0
- samplerate-0.2.1/PKG-INFO +123 -0
- {samplerate-0.1.0 → samplerate-0.2.1}/README.rst +21 -4
- samplerate-0.2.1/docs/Makefile +20 -0
- samplerate-0.2.1/docs/changelog.rst +7 -0
- samplerate-0.2.1/docs/conf.py +189 -0
- samplerate-0.2.1/docs/index.rst +29 -0
- samplerate-0.2.1/docs/samplerate/converters.rst +34 -0
- samplerate-0.2.1/docs/samplerate/exceptions.rst +7 -0
- samplerate-0.2.1/docs/samplerate/index.rst +9 -0
- samplerate-0.2.1/docs/samplerate/samplerate.rst +35 -0
- {samplerate-0.1.0 → samplerate-0.2.1}/examples/play_modulation.py +3 -1
- samplerate-0.2.1/external/CMakeLists.txt +22 -0
- samplerate-0.2.1/pyproject.toml +32 -0
- samplerate-0.2.1/requirements.txt +2 -0
- samplerate-0.2.1/setup.cfg +4 -0
- samplerate-0.2.1/setup.py +132 -0
- samplerate-0.2.1/src/samplerate.cpp +617 -0
- samplerate-0.2.1/src/samplerate.egg-info/PKG-INFO +123 -0
- samplerate-0.2.1/src/samplerate.egg-info/SOURCES.txt +30 -0
- samplerate-0.2.1/src/samplerate.egg-info/requires.txt +1 -0
- samplerate-0.2.1/tests/test_api.py +166 -0
- samplerate-0.2.1/tests/test_exception.py +114 -0
- samplerate-0.2.1/tests/test_resampling.py +125 -0
- samplerate-0.2.1/tests/test_resize.py +12 -0
- samplerate-0.1.0/MANIFEST.in +0 -7
- samplerate-0.1.0/PKG-INFO +0 -106
- samplerate-0.1.0/samplerate/__init__.py +0 -15
- samplerate-0.1.0/samplerate/_samplerate_data/libsamplerate-32bit.dll +0 -0
- samplerate-0.1.0/samplerate/_samplerate_data/libsamplerate-64bit.dll +0 -0
- samplerate-0.1.0/samplerate/_samplerate_data/libsamplerate.dylib +0 -0
- samplerate-0.1.0/samplerate/_src.py +0 -10
- samplerate-0.1.0/samplerate/_version.py +0 -21
- samplerate-0.1.0/samplerate/converters.py +0 -304
- samplerate-0.1.0/samplerate/exceptions.py +0 -14
- samplerate-0.1.0/samplerate/lowlevel.py +0 -255
- samplerate-0.1.0/samplerate/samplerate_build.py +0 -57
- samplerate-0.1.0/samplerate.egg-info/PKG-INFO +0 -106
- samplerate-0.1.0/samplerate.egg-info/SOURCES.txt +0 -23
- samplerate-0.1.0/samplerate.egg-info/not-zip-safe +0 -1
- samplerate-0.1.0/samplerate.egg-info/requires.txt +0 -2
- samplerate-0.1.0/setup.cfg +0 -19
- samplerate-0.1.0/setup.py +0 -36
- samplerate-0.1.0/versioneer.py +0 -1822
- {samplerate-0.1.0 → samplerate-0.2.1}/LICENSE.rst +0 -0
- {samplerate-0.1.0 → samplerate-0.2.1/src}/samplerate.egg-info/dependency_links.txt +0 -0
- {samplerate-0.1.0 → samplerate-0.2.1/src}/samplerate.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
samplerate/_version.py export-subst
|
@@ -0,0 +1,78 @@
|
|
1
|
+
name: samplerate
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ${{ matrix.os }}
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
max-parallel: 12
|
12
|
+
matrix:
|
13
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
14
|
+
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: Checkout submodules
|
18
|
+
shell: bash
|
19
|
+
run: |
|
20
|
+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
|
21
|
+
git submodule sync --recursive
|
22
|
+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
24
|
+
uses: actions/setup-python@v4
|
25
|
+
with:
|
26
|
+
python-version: ${{ matrix.python-version }}
|
27
|
+
- name: Install dependencies
|
28
|
+
run: |
|
29
|
+
python -m pip install --upgrade pip
|
30
|
+
pip install -U setuptools setuptools_scm wheel build twine
|
31
|
+
pip install -r requirements.txt
|
32
|
+
- name: Build package
|
33
|
+
run: |
|
34
|
+
python -m pip install -e .
|
35
|
+
- name: Test with pytest
|
36
|
+
run: |
|
37
|
+
pytest
|
38
|
+
- name: Test the universal wheels
|
39
|
+
if: matrix.os == 'ubuntu-latest'
|
40
|
+
run: |
|
41
|
+
# do not build binary wheels on linux
|
42
|
+
python -m build --sdist
|
43
|
+
twine check dist/*
|
44
|
+
- name: Test the binary wheels
|
45
|
+
if: matrix.os != 'ubuntu-latest'
|
46
|
+
run: |
|
47
|
+
python -m build
|
48
|
+
twine check dist/*
|
49
|
+
- name: Publish sdist to pypi
|
50
|
+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest'
|
51
|
+
env:
|
52
|
+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
53
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
54
|
+
run: |
|
55
|
+
twine upload --skip-existing dist/*
|
56
|
+
- name: Publish bdist to pypi
|
57
|
+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && matrix.os != 'ubuntu-latest'
|
58
|
+
env:
|
59
|
+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
60
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
61
|
+
run: |
|
62
|
+
twine upload --skip-existing dist/*
|
63
|
+
- name: Publish sdist to pypi-test
|
64
|
+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') && matrix.os == 'ubuntu-latest'
|
65
|
+
env:
|
66
|
+
TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
|
67
|
+
TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
|
68
|
+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
|
69
|
+
run: |
|
70
|
+
twine upload --skip-existing dist/*
|
71
|
+
- name: Publish bdist to pypi-test
|
72
|
+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') && matrix.os != 'ubuntu-latest'
|
73
|
+
env:
|
74
|
+
TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
|
75
|
+
TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
|
76
|
+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
|
77
|
+
run: |
|
78
|
+
twine upload --skip-existing dist/*
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# https://stackoverflow.com/questions/51907755/building-a-pybind11-module-with-cpp-and-cuda-sources-using-cmake
|
2
|
+
|
3
|
+
cmake_minimum_required(VERSION 3.15)
|
4
|
+
|
5
|
+
message(STATUS "Found Python prefix ${PYTHON_PREFIX}")
|
6
|
+
list(PREPEND CMAKE_PREFIX_PATH "${PYTHON_PREFIX}")
|
7
|
+
|
8
|
+
project(python-samplerate)
|
9
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
10
|
+
|
11
|
+
cmake_policy(SET CMP0094 NEW)
|
12
|
+
|
13
|
+
# adds the external dependencies
|
14
|
+
add_subdirectory(external)
|
15
|
+
|
16
|
+
pybind11_add_module(python-samplerate src/samplerate.cpp)
|
17
|
+
|
18
|
+
target_include_directories(python-samplerate PRIVATE ./external/libsamplerate/include)
|
19
|
+
|
20
|
+
if(MSVC)
|
21
|
+
target_compile_options(python-samplerate PRIVATE /EHsc /MP /bigobj)
|
22
|
+
set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO)
|
23
|
+
endif()
|
24
|
+
|
25
|
+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
|
26
|
+
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
|
27
|
+
(CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32))
|
28
|
+
target_compile_options(python-samplerate PRIVATE -std=c++14 -O3 -Wall -Wextra)
|
29
|
+
endif()
|
30
|
+
|
31
|
+
### stick the package and libsamplerate version into the module
|
32
|
+
target_compile_definitions(python-samplerate
|
33
|
+
PUBLIC LIBSAMPLERATE_VERSION="${LIBSAMPLERATE_VERSION}"
|
34
|
+
PRIVATE $<$<BOOL:${PACKAGE_VERSION_INFO}>:VERSION_INFO="${PACKAGE_VERSION_INFO}">
|
35
|
+
)
|
36
|
+
|
37
|
+
### Final target setup
|
38
|
+
set_target_properties(
|
39
|
+
python-samplerate
|
40
|
+
PROPERTIES
|
41
|
+
PREFIX ""
|
42
|
+
OUTPUT_NAME "samplerate"
|
43
|
+
LINKER_LANGUAGE C
|
44
|
+
)
|
45
|
+
|
46
|
+
target_link_libraries(python-samplerate PUBLIC samplerate)
|
@@ -0,0 +1,123 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: samplerate
|
3
|
+
Version: 0.2.1
|
4
|
+
Summary: Monolithic python wrapper for libsamplerate based on pybind11 and NumPy
|
5
|
+
Author-email: Robin Scheibler <fakufaku@gmail.com>, Tino Wagner <ich@tinowagner.com>
|
6
|
+
License: MIT
|
7
|
+
Keywords: samplerate,converter,signal processing,audio
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
9
|
+
Classifier: Environment :: Console
|
10
|
+
Classifier: Intended Audience :: Developers
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Operating System :: OS Independent
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
16
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
17
|
+
Requires-Python: >=3.7
|
18
|
+
Description-Content-Type: text/x-rst
|
19
|
+
License-File: LICENSE.rst
|
20
|
+
Requires-Dist: numpy
|
21
|
+
|
22
|
+
python-samplerate
|
23
|
+
=================
|
24
|
+
|
25
|
+
.. image:: https://img.shields.io/pypi/v/samplerate.svg
|
26
|
+
:target: https://pypi.python.org/pypi/samplerate
|
27
|
+
|
28
|
+
.. image:: https://img.shields.io/pypi/l/samplerate.svg
|
29
|
+
:target: https://pypi.python.org/pypi/samplerate
|
30
|
+
|
31
|
+
.. image:: https://img.shields.io/pypi/wheel/samplerate.svg
|
32
|
+
:target: https://pypi.python.org/pypi/samplerate
|
33
|
+
|
34
|
+
.. image:: https://img.shields.io/pypi/pyversions/samplerate.svg
|
35
|
+
:target: https://pypi.python.org/pypi/samplerate
|
36
|
+
|
37
|
+
.. image:: https://readthedocs.org/projects/python-samplerate/badge/?version=latest
|
38
|
+
:target: http://python-samplerate.readthedocs.io/en/latest/?badge=latest
|
39
|
+
:alt: Documentation Status
|
40
|
+
|
41
|
+
|
42
|
+
This is a wrapper around Erik de Castro Lopo's `libsamplerate`_ (aka Secret
|
43
|
+
Rabbit Code) for high-quality sample rate conversion.
|
44
|
+
|
45
|
+
It implements all three `APIs
|
46
|
+
<http://www.mega-nerd.com/libsamplerate/api.html>`_ available in
|
47
|
+
`libsamplerate`_:
|
48
|
+
|
49
|
+
* **Simple API**: for resampling a large chunk of data with a single library
|
50
|
+
call
|
51
|
+
* **Full API**: for obtaining the resampled signal from successive chunks of
|
52
|
+
data
|
53
|
+
* **Callback API**: like Full API, but input samples are provided by a callback
|
54
|
+
function
|
55
|
+
|
56
|
+
The `libsamplerate`_ library is statically built together with the python bindings
|
57
|
+
using `pybind11 <https://github.com/pybind/pybind11/>`_.
|
58
|
+
|
59
|
+
|
60
|
+
Installation
|
61
|
+
------------
|
62
|
+
|
63
|
+
$ pip install samplerate
|
64
|
+
|
65
|
+
Binary wheels of `libsamplerate`_ for macOS and Windows (64 bit) are available.
|
66
|
+
For other systems, a C++ 14 or above compiler is required to build the package.
|
67
|
+
|
68
|
+
|
69
|
+
Usage
|
70
|
+
-----
|
71
|
+
|
72
|
+
.. code-block:: python
|
73
|
+
|
74
|
+
import numpy as np
|
75
|
+
import samplerate
|
76
|
+
|
77
|
+
# Synthesize data
|
78
|
+
fs = 1000.
|
79
|
+
t = np.arange(fs * 2) / fs
|
80
|
+
input_data = np.sin(2 * np.pi * 5 * t)
|
81
|
+
|
82
|
+
# Simple API
|
83
|
+
ratio = 1.5
|
84
|
+
converter = 'sinc_best' # or 'sinc_fastest', ...
|
85
|
+
output_data_simple = samplerate.resample(input_data, ratio, converter)
|
86
|
+
|
87
|
+
# Full API
|
88
|
+
resampler = samplerate.Resampler(converter, channels=1)
|
89
|
+
output_data_full = resampler.process(input_data, ratio, end_of_input=True)
|
90
|
+
|
91
|
+
# The result is the same for both APIs.
|
92
|
+
assert np.allclose(output_data_simple, output_data_full)
|
93
|
+
|
94
|
+
# See `samplerate.CallbackResampler` for the Callback API, or
|
95
|
+
# `examples/play_modulation.py` for an example.
|
96
|
+
|
97
|
+
See ``samplerate.resample``, ``samplerate.Resampler``, and
|
98
|
+
``samplerate.CallbackResampler`` in the API documentation for details.
|
99
|
+
|
100
|
+
|
101
|
+
See also
|
102
|
+
--------
|
103
|
+
|
104
|
+
* `scikits.samplerate <https://pypi.python.org/pypi/scikits.samplerate>`_
|
105
|
+
implements only the Simple API and uses `Cython <http://cython.org/>`_ for
|
106
|
+
extern calls. The `resample` function of `scikits.samplerate` and this package
|
107
|
+
share the same function signature for compatiblity.
|
108
|
+
|
109
|
+
* `resampy <https://github.com/bmcfee/resampy>`_: sample rate conversion in
|
110
|
+
Python + Cython.
|
111
|
+
|
112
|
+
|
113
|
+
License
|
114
|
+
-------
|
115
|
+
|
116
|
+
This project is licensed under the `MIT license
|
117
|
+
<https://opensource.org/licenses/MIT>`_.
|
118
|
+
|
119
|
+
As of version 0.1.9, `libsamplerate`_ is licensed under the `2-clause BSD
|
120
|
+
license <https://opensource.org/licenses/BSD-2-Clause>`_.
|
121
|
+
|
122
|
+
|
123
|
+
.. _libsamplerate: http://www.mega-nerd.com/libsamplerate/
|
@@ -1,6 +1,23 @@
|
|
1
1
|
python-samplerate
|
2
2
|
=================
|
3
3
|
|
4
|
+
.. image:: https://img.shields.io/pypi/v/samplerate.svg
|
5
|
+
:target: https://pypi.python.org/pypi/samplerate
|
6
|
+
|
7
|
+
.. image:: https://img.shields.io/pypi/l/samplerate.svg
|
8
|
+
:target: https://pypi.python.org/pypi/samplerate
|
9
|
+
|
10
|
+
.. image:: https://img.shields.io/pypi/wheel/samplerate.svg
|
11
|
+
:target: https://pypi.python.org/pypi/samplerate
|
12
|
+
|
13
|
+
.. image:: https://img.shields.io/pypi/pyversions/samplerate.svg
|
14
|
+
:target: https://pypi.python.org/pypi/samplerate
|
15
|
+
|
16
|
+
.. image:: https://readthedocs.org/projects/python-samplerate/badge/?version=latest
|
17
|
+
:target: http://python-samplerate.readthedocs.io/en/latest/?badge=latest
|
18
|
+
:alt: Documentation Status
|
19
|
+
|
20
|
+
|
4
21
|
This is a wrapper around Erik de Castro Lopo's `libsamplerate`_ (aka Secret
|
5
22
|
Rabbit Code) for high-quality sample rate conversion.
|
6
23
|
|
@@ -15,8 +32,8 @@ It implements all three `APIs
|
|
15
32
|
* **Callback API**: like Full API, but input samples are provided by a callback
|
16
33
|
function
|
17
34
|
|
18
|
-
|
19
|
-
<
|
35
|
+
The `libsamplerate`_ library is statically built together with the python bindings
|
36
|
+
using `pybind11 <https://github.com/pybind/pybind11/>`_.
|
20
37
|
|
21
38
|
|
22
39
|
Installation
|
@@ -24,8 +41,8 @@ Installation
|
|
24
41
|
|
25
42
|
$ pip install samplerate
|
26
43
|
|
27
|
-
|
28
|
-
|
44
|
+
Binary wheels of `libsamplerate`_ for macOS and Windows (64 bit) are available.
|
45
|
+
For other systems, a C++ 14 or above compiler is required to build the package.
|
29
46
|
|
30
47
|
|
31
48
|
Usage
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
2
|
+
#
|
3
|
+
|
4
|
+
# You can set these variables from the command line.
|
5
|
+
SPHINXOPTS =
|
6
|
+
SPHINXBUILD = sphinx-build
|
7
|
+
SPHINXPROJ = python-samplerate
|
8
|
+
SOURCEDIR = .
|
9
|
+
BUILDDIR = _build
|
10
|
+
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
12
|
+
help:
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
14
|
+
|
15
|
+
.PHONY: help Makefile
|
16
|
+
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
19
|
+
%: Makefile
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@@ -0,0 +1,189 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# python-samplerate documentation build configuration file, created by
|
5
|
+
# sphinx-quickstart on Thu Feb 9 12:32:39 2017.
|
6
|
+
#
|
7
|
+
# This file is execfile()d with the current directory set to its
|
8
|
+
# containing dir.
|
9
|
+
#
|
10
|
+
# Note that not all possible configuration values are present in this
|
11
|
+
# autogenerated file.
|
12
|
+
#
|
13
|
+
# All configuration values have a default; values that are commented out
|
14
|
+
# serve to show the default.
|
15
|
+
|
16
|
+
# If extensions (or modules to document with autodoc) are in another directory,
|
17
|
+
# add these directories to sys.path here. If the directory is relative to the
|
18
|
+
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
19
|
+
#
|
20
|
+
# import os
|
21
|
+
# import sys
|
22
|
+
|
23
|
+
# sys.path.insert(0, os.path.abspath('.'))
|
24
|
+
|
25
|
+
import samplerate
|
26
|
+
|
27
|
+
# -- General configuration ------------------------------------------------
|
28
|
+
|
29
|
+
# If your documentation needs a minimal Sphinx version, state it here.
|
30
|
+
#
|
31
|
+
# needs_sphinx = '1.0'
|
32
|
+
|
33
|
+
# Add any Sphinx extension module names here, as strings. They can be
|
34
|
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
35
|
+
# ones.
|
36
|
+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.napoleon"]
|
37
|
+
|
38
|
+
# Add any paths that contain templates here, relative to this directory.
|
39
|
+
templates_path = ["_templates"]
|
40
|
+
|
41
|
+
# The suffix(es) of source filenames.
|
42
|
+
# You can specify multiple suffix as a list of string:
|
43
|
+
#
|
44
|
+
# source_suffix = ['.rst', '.md']
|
45
|
+
source_suffix = ".rst"
|
46
|
+
|
47
|
+
# The master toctree document.
|
48
|
+
master_doc = "index"
|
49
|
+
|
50
|
+
# General information about the project.
|
51
|
+
project = "python-samplerate"
|
52
|
+
copyright = "2017, Tino Wagner"
|
53
|
+
author = "Tino Wagner"
|
54
|
+
|
55
|
+
# The version info for the project you're documenting, acts as replacement for
|
56
|
+
# |version| and |release|, also used in various other places throughout the
|
57
|
+
# built documents.
|
58
|
+
#
|
59
|
+
|
60
|
+
# The full version, including alpha/beta/rc tags.
|
61
|
+
release = samplerate.__version__
|
62
|
+
|
63
|
+
|
64
|
+
# The short X.Y version.
|
65
|
+
def get_short_version(version):
|
66
|
+
"""Return short version from PEP-440 compatible version string."""
|
67
|
+
if "+" in version:
|
68
|
+
return version[: version.find("+")]
|
69
|
+
return version
|
70
|
+
|
71
|
+
|
72
|
+
version = get_short_version(release)
|
73
|
+
|
74
|
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
75
|
+
# for a list of supported languages.
|
76
|
+
#
|
77
|
+
# This is also used if you do content translation via gettext catalogs.
|
78
|
+
# Usually you set "language" from the command line for these cases.
|
79
|
+
language = "en"
|
80
|
+
|
81
|
+
# List of patterns, relative to source directory, that match files and
|
82
|
+
# directories to ignore when looking for source files.
|
83
|
+
# This patterns also effect to html_static_path and html_extra_path
|
84
|
+
exclude_patterns = []
|
85
|
+
|
86
|
+
# The name of the Pygments (syntax highlighting) style to use.
|
87
|
+
pygments_style = "sphinx"
|
88
|
+
|
89
|
+
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
90
|
+
todo_include_todos = False
|
91
|
+
|
92
|
+
|
93
|
+
# -- Options for HTML output ----------------------------------------------
|
94
|
+
|
95
|
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
96
|
+
# a list of builtin themes.
|
97
|
+
#
|
98
|
+
html_theme = "alabaster"
|
99
|
+
|
100
|
+
# Theme options are theme-specific and customize the look and feel of a theme
|
101
|
+
# further. For a list of options available for each theme, see the
|
102
|
+
# documentation.
|
103
|
+
#
|
104
|
+
html_theme_options = {
|
105
|
+
"description": "Sample rate conversion in Python using libsamplerate",
|
106
|
+
"github_user": "tuxu",
|
107
|
+
"github_repo": "python-samplerate",
|
108
|
+
"github_banner": True,
|
109
|
+
"fixed_sidebar": True,
|
110
|
+
}
|
111
|
+
|
112
|
+
html_sidebars = {
|
113
|
+
"**": [
|
114
|
+
"about.html",
|
115
|
+
"navigation.html",
|
116
|
+
"relations.html",
|
117
|
+
"searchbox.html",
|
118
|
+
"donate.html",
|
119
|
+
]
|
120
|
+
}
|
121
|
+
|
122
|
+
# Add any paths that contain custom static files (such as style sheets) here,
|
123
|
+
# relative to this directory. They are copied after the builtin static files,
|
124
|
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
125
|
+
html_static_path = ["_static"]
|
126
|
+
|
127
|
+
|
128
|
+
# -- Options for HTMLHelp output ------------------------------------------
|
129
|
+
|
130
|
+
# Output file base name for HTML help builder.
|
131
|
+
htmlhelp_basename = "python-sampleratedoc"
|
132
|
+
|
133
|
+
|
134
|
+
# -- Options for LaTeX output ---------------------------------------------
|
135
|
+
|
136
|
+
latex_elements = {
|
137
|
+
# The paper size ('letterpaper' or 'a4paper').
|
138
|
+
#
|
139
|
+
# 'papersize': 'letterpaper',
|
140
|
+
# The font size ('10pt', '11pt' or '12pt').
|
141
|
+
#
|
142
|
+
# 'pointsize': '10pt',
|
143
|
+
# Additional stuff for the LaTeX preamble.
|
144
|
+
#
|
145
|
+
# 'preamble': '',
|
146
|
+
# Latex figure (float) alignment
|
147
|
+
#
|
148
|
+
# 'figure_align': 'htbp',
|
149
|
+
}
|
150
|
+
|
151
|
+
# Grouping the document tree into LaTeX files. List of tuples
|
152
|
+
# (source start file, target name, title,
|
153
|
+
# author, documentclass [howto, manual, or own class]).
|
154
|
+
latex_documents = [
|
155
|
+
(
|
156
|
+
master_doc,
|
157
|
+
"python-samplerate.tex",
|
158
|
+
"python-samplerate Documentation",
|
159
|
+
"Tino Wagner",
|
160
|
+
"manual",
|
161
|
+
),
|
162
|
+
]
|
163
|
+
|
164
|
+
|
165
|
+
# -- Options for manual page output ---------------------------------------
|
166
|
+
|
167
|
+
# One entry per manual page. List of tuples
|
168
|
+
# (source start file, name, description, authors, manual section).
|
169
|
+
man_pages = [
|
170
|
+
(master_doc, "python-samplerate", "python-samplerate Documentation", [author], 1)
|
171
|
+
]
|
172
|
+
|
173
|
+
|
174
|
+
# -- Options for Texinfo output -------------------------------------------
|
175
|
+
|
176
|
+
# Grouping the document tree into Texinfo files. List of tuples
|
177
|
+
# (source start file, target name, title, author,
|
178
|
+
# dir menu entry, description, category)
|
179
|
+
texinfo_documents = [
|
180
|
+
(
|
181
|
+
master_doc,
|
182
|
+
"python-samplerate",
|
183
|
+
"python-samplerate Documentation",
|
184
|
+
author,
|
185
|
+
"python-samplerate",
|
186
|
+
"One line description of project.",
|
187
|
+
"Miscellaneous",
|
188
|
+
),
|
189
|
+
]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
.. include:: ../README.rst
|
2
|
+
|
3
|
+
|
4
|
+
API documentation
|
5
|
+
-----------------
|
6
|
+
|
7
|
+
.. toctree::
|
8
|
+
:maxdepth: 2
|
9
|
+
|
10
|
+
samplerate/index
|
11
|
+
|
12
|
+
|
13
|
+
Change Log
|
14
|
+
----------
|
15
|
+
.. toctree::
|
16
|
+
:maxdepth: 2
|
17
|
+
|
18
|
+
changelog
|
19
|
+
|
20
|
+
|
21
|
+
Indices and tables
|
22
|
+
------------------
|
23
|
+
|
24
|
+
* :ref:`genindex`
|
25
|
+
* :ref:`modindex`
|
26
|
+
* :ref:`search`
|
27
|
+
|
28
|
+
|
29
|
+
.. _libsamplerate: http://www.mega-nerd.com/libsamplerate/
|
@@ -0,0 +1,34 @@
|
|
1
|
+
:mod:`samplerate.converters` -- Sample rate converters
|
2
|
+
======================================================
|
3
|
+
.. module:: samplerate.converters
|
4
|
+
|
5
|
+
Converter types
|
6
|
+
---------------
|
7
|
+
|
8
|
+
.. autoclass:: ConverterType
|
9
|
+
:members:
|
10
|
+
:undoc-members:
|
11
|
+
|
12
|
+
|
13
|
+
Sample rate converters
|
14
|
+
----------------------
|
15
|
+
|
16
|
+
Simple
|
17
|
+
^^^^^^
|
18
|
+
.. autofunction:: resample
|
19
|
+
|
20
|
+
|
21
|
+
Full API
|
22
|
+
^^^^^^^^
|
23
|
+
|
24
|
+
.. autoclass:: Resampler
|
25
|
+
:members:
|
26
|
+
:undoc-members:
|
27
|
+
|
28
|
+
|
29
|
+
Callback API
|
30
|
+
^^^^^^^^^^^^
|
31
|
+
|
32
|
+
.. autoclass:: CallbackResampler
|
33
|
+
:members:
|
34
|
+
:undoc-members:
|
@@ -0,0 +1,35 @@
|
|
1
|
+
:mod:`samplerate` -- Python bindings for libsamplerate based on CFFI and NumPy
|
2
|
+
==============================================================================
|
3
|
+
.. module:: samplerate
|
4
|
+
|
5
|
+
|
6
|
+
Simple API
|
7
|
+
----------
|
8
|
+
|
9
|
+
.. function:: samplerate.resample
|
10
|
+
|
11
|
+
See :func:`samplerate.converters.resample`.
|
12
|
+
|
13
|
+
|
14
|
+
Full API
|
15
|
+
--------
|
16
|
+
|
17
|
+
.. class:: samplerate.Resampler
|
18
|
+
|
19
|
+
See :func:`samplerate.converters.Resampler`.
|
20
|
+
|
21
|
+
|
22
|
+
Callback API
|
23
|
+
------------
|
24
|
+
|
25
|
+
.. class:: samplerate.CallbackResampler
|
26
|
+
|
27
|
+
See :func:`samplerate.converters.CallbackResampler`.
|
28
|
+
|
29
|
+
|
30
|
+
Exceptions
|
31
|
+
----------
|
32
|
+
|
33
|
+
.. class:: samplerate.ResamplingError
|
34
|
+
|
35
|
+
See :func:`samplerate.converters.CallbackResampler`.
|
@@ -6,9 +6,11 @@ played back on the default sound output. During playback, the modulation signal
|
|
6
6
|
is generated at source samplerate, then resampled to target samplerate, and
|
7
7
|
mixed onto the carrier.
|
8
8
|
"""
|
9
|
-
from __future__ import
|
9
|
+
from __future__ import division, print_function
|
10
|
+
|
10
11
|
import numpy as np
|
11
12
|
import sounddevice as sd
|
13
|
+
|
12
14
|
import samplerate as sr
|
13
15
|
|
14
16
|
source_samplerate = 3600
|