samplerate


Namesamplerate JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryMonolithic python wrapper for libsamplerate based on pybind11 and NumPy
upload_time2025-10-10 23:14:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords samplerate converter signal processing audio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            python-samplerate
=================

.. image:: https://img.shields.io/pypi/v/samplerate.svg
    :target: https://pypi.python.org/pypi/samplerate

.. image:: https://img.shields.io/pypi/l/samplerate.svg
    :target: https://pypi.python.org/pypi/samplerate

.. image:: https://img.shields.io/pypi/wheel/samplerate.svg
    :target: https://pypi.python.org/pypi/samplerate

.. image:: https://img.shields.io/pypi/pyversions/samplerate.svg
    :target: https://pypi.python.org/pypi/samplerate

.. image:: https://readthedocs.org/projects/python-samplerate/badge/?version=latest
   :target: http://python-samplerate.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation Status


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
<http://www.mega-nerd.com/libsamplerate/api.html>`_ 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 <https://github.com/pybind/pybind11/>`_.


Installation
------------

    $ pip install samplerate

Binary wheels of `libsamplerate`_ for macOS and Windows (64 bit) are available.
For other systems, a C++ 14 or above compiler is required to build the package.


Usage
-----

.. code-block:: python

   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 <https://pypi.python.org/pypi/scikits.samplerate>`_
  implements only the Simple API and uses `Cython <http://cython.org/>`_ for
  extern calls. The `resample` function of `scikits.samplerate` and this package
  share the same function signature for compatiblity.

* `resampy <https://github.com/bmcfee/resampy>`_: sample rate conversion in
  Python + Cython.


License
-------

This project is licensed under the `MIT license
<https://opensource.org/licenses/MIT>`_.

As of version 0.1.9, `libsamplerate`_ is licensed under the `2-clause BSD
license <https://opensource.org/licenses/BSD-2-Clause>`_.


.. _libsamplerate: http://www.mega-nerd.com/libsamplerate/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "samplerate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "samplerate, converter, signal processing, audio",
    "author": null,
    "author_email": "Robin Scheibler <fakufaku@gmail.com>, Tino Wagner <ich@tinowagner.com>",
    "download_url": "https://files.pythonhosted.org/packages/78/b9/6db4045509ea5d709ff6147971ca0625f898c0c32fc61a2f8f76c016d61b/samplerate-0.2.2.tar.gz",
    "platform": null,
    "description": "python-samplerate\n=================\n\n.. image:: https://img.shields.io/pypi/v/samplerate.svg\n    :target: https://pypi.python.org/pypi/samplerate\n\n.. image:: https://img.shields.io/pypi/l/samplerate.svg\n    :target: https://pypi.python.org/pypi/samplerate\n\n.. image:: https://img.shields.io/pypi/wheel/samplerate.svg\n    :target: https://pypi.python.org/pypi/samplerate\n\n.. image:: https://img.shields.io/pypi/pyversions/samplerate.svg\n    :target: https://pypi.python.org/pypi/samplerate\n\n.. image:: https://readthedocs.org/projects/python-samplerate/badge/?version=latest\n   :target: http://python-samplerate.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n\nThis is a wrapper around Erik de Castro Lopo's `libsamplerate`_ (aka Secret\nRabbit Code) for high-quality sample rate conversion.\n\nIt implements all three `APIs\n<http://www.mega-nerd.com/libsamplerate/api.html>`_ available in\n`libsamplerate`_:\n\n* **Simple API**: for resampling a large chunk of data with a single library\n  call\n* **Full API**: for obtaining the resampled signal from successive chunks of\n  data\n* **Callback API**: like Full API, but input samples are provided by a callback\n  function\n\nThe `libsamplerate`_ library is statically built together with the python bindings\nusing `pybind11 <https://github.com/pybind/pybind11/>`_.\n\n\nInstallation\n------------\n\n    $ pip install samplerate\n\nBinary wheels of `libsamplerate`_ for macOS and Windows (64 bit) are available.\nFor other systems, a C++ 14 or above compiler is required to build the package.\n\n\nUsage\n-----\n\n.. code-block:: python\n\n   import numpy as np\n   import samplerate\n\n   # Synthesize data\n   fs = 1000.\n   t = np.arange(fs * 2) / fs\n   input_data = np.sin(2 * np.pi * 5 * t)\n\n   # Simple API\n   ratio = 1.5\n   converter = 'sinc_best'  # or 'sinc_fastest', ...\n   output_data_simple = samplerate.resample(input_data, ratio, converter)\n\n   # Full API\n   resampler = samplerate.Resampler(converter, channels=1)\n   output_data_full = resampler.process(input_data, ratio, end_of_input=True)\n\n   # The result is the same for both APIs.\n   assert np.allclose(output_data_simple, output_data_full)\n\n   # See `samplerate.CallbackResampler` for the Callback API, or\n   # `examples/play_modulation.py` for an example.\n\nSee ``samplerate.resample``, ``samplerate.Resampler``, and\n``samplerate.CallbackResampler`` in the API documentation for details.\n\n\nSee also\n--------\n\n* `scikits.samplerate <https://pypi.python.org/pypi/scikits.samplerate>`_\n  implements only the Simple API and uses `Cython <http://cython.org/>`_ for\n  extern calls. The `resample` function of `scikits.samplerate` and this package\n  share the same function signature for compatiblity.\n\n* `resampy <https://github.com/bmcfee/resampy>`_: sample rate conversion in\n  Python + Cython.\n\n\nLicense\n-------\n\nThis project is licensed under the `MIT license\n<https://opensource.org/licenses/MIT>`_.\n\nAs of version 0.1.9, `libsamplerate`_ is licensed under the `2-clause BSD\nlicense <https://opensource.org/licenses/BSD-2-Clause>`_.\n\n\n.. _libsamplerate: http://www.mega-nerd.com/libsamplerate/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Monolithic python wrapper for libsamplerate based on pybind11 and NumPy",
    "version": "0.2.2",
    "project_urls": null,
    "split_keywords": [
        "samplerate",
        " converter",
        " signal processing",
        " audio"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "776c397ec88acbee0171d7ac8fc4e167d18bddfc61f4f417e8b44661254622f5",
                "md5": "421f3a12aa18a0e0cf66d6a81c40bbff",
                "sha256": "99b47c238ef7216b87ccf5e8860b94b527cceef7a8add38f146e75f6efec257f"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp310-cp310-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "421f3a12aa18a0e0cf66d6a81c40bbff",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 2899412,
            "upload_time": "2025-10-10T23:16:56",
            "upload_time_iso_8601": "2025-10-10T23:16:56.367874Z",
            "url": "https://files.pythonhosted.org/packages/77/6c/397ec88acbee0171d7ac8fc4e167d18bddfc61f4f417e8b44661254622f5/samplerate-0.2.2-cp310-cp310-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a47de8d8f5f2ed9124148e8ee3c91330a7715704e689b416580c8a6db990cd35",
                "md5": "5f0543bb372962e22220ea2c2ba0490a",
                "sha256": "0aa6ae933cb85eac5ffdebc38abc198be890c2bcbac263c30301699d651e9513"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "5f0543bb372962e22220ea2c2ba0490a",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 1458762,
            "upload_time": "2025-10-10T23:17:19",
            "upload_time_iso_8601": "2025-10-10T23:17:19.917134Z",
            "url": "https://files.pythonhosted.org/packages/a4/7d/e8d8f5f2ed9124148e8ee3c91330a7715704e689b416580c8a6db990cd35/samplerate-0.2.2-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2de4dd57ac31cf73b0acb6661f74cff8043bb25b5f37867b26e37c753d1b0cf7",
                "md5": "994f3c560ec54a07237f3246ff0d4fe1",
                "sha256": "a41fe7a8c68101bf9900ba415cf2a0a58199bba9cac15e0a3b22b70006705b29"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp311-cp311-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "994f3c560ec54a07237f3246ff0d4fe1",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 2901869,
            "upload_time": "2025-10-10T23:14:26",
            "upload_time_iso_8601": "2025-10-10T23:14:26.266842Z",
            "url": "https://files.pythonhosted.org/packages/2d/e4/dd57ac31cf73b0acb6661f74cff8043bb25b5f37867b26e37c753d1b0cf7/samplerate-0.2.2-cp311-cp311-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a2aab17359705cdb70d995e14e324195502b41ba4d84789fba321a27926f3c0d",
                "md5": "fc32201c45fff741704aba845f7e238d",
                "sha256": "86fb8eb9a6c75d4c17f8125e203d29bf2d87bf5ce0e671184ba5111f015c9264"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fc32201c45fff741704aba845f7e238d",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 1459355,
            "upload_time": "2025-10-10T23:19:55",
            "upload_time_iso_8601": "2025-10-10T23:19:55.296631Z",
            "url": "https://files.pythonhosted.org/packages/a2/aa/b17359705cdb70d995e14e324195502b41ba4d84789fba321a27926f3c0d/samplerate-0.2.2-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "afcd6ac82cf1e121bc1c3c46c4214d0cb1025a2bb6d48aa18a21becc4d9b953e",
                "md5": "c8de27ec0ea4e5b9c0ef8f4cb46bd088",
                "sha256": "3f30fea3e42b51e2441cf464e24c4744fa0b9a837b7beefb6a8eb6cc72af1e51"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp312-cp312-macosx_10_13_universal2.whl",
            "has_sig": false,
            "md5_digest": "c8de27ec0ea4e5b9c0ef8f4cb46bd088",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 2903112,
            "upload_time": "2025-10-10T23:14:18",
            "upload_time_iso_8601": "2025-10-10T23:14:18.739965Z",
            "url": "https://files.pythonhosted.org/packages/af/cd/6ac82cf1e121bc1c3c46c4214d0cb1025a2bb6d48aa18a21becc4d9b953e/samplerate-0.2.2-cp312-cp312-macosx_10_13_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "86c1e4079d3893d568bce8f7d9125dd2474f621b67937e953632077988aae6e9",
                "md5": "b698e2a43bf1fac9fa4d83408abd34b4",
                "sha256": "1170c5e4f68d9c1bbec2fce1549108838a473058f69cca7bc377e053ee43457b"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "b698e2a43bf1fac9fa4d83408abd34b4",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 1459874,
            "upload_time": "2025-10-10T23:16:59",
            "upload_time_iso_8601": "2025-10-10T23:16:59.827579Z",
            "url": "https://files.pythonhosted.org/packages/86/c1/e4079d3893d568bce8f7d9125dd2474f621b67937e953632077988aae6e9/samplerate-0.2.2-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4b7252d1102b2be4f1393f3fe8b700204fa2057dc24af3701b278a2ba238c8ca",
                "md5": "021f11182837dba847f762fe14d9cc2f",
                "sha256": "567dfe3888634435b8da1ac4bc06ad289ba777876f446760249e923e6b3585c5"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp38-cp38-macosx_11_0_universal2.whl",
            "has_sig": false,
            "md5_digest": "021f11182837dba847f762fe14d9cc2f",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 2898830,
            "upload_time": "2025-10-10T23:14:59",
            "upload_time_iso_8601": "2025-10-10T23:14:59.246033Z",
            "url": "https://files.pythonhosted.org/packages/4b/72/52d1102b2be4f1393f3fe8b700204fa2057dc24af3701b278a2ba238c8ca/samplerate-0.2.2-cp38-cp38-macosx_11_0_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "313a9c9dd0bee4f2b7e29ce245d2de4925182d70528f6aefcc64e8f43e057a52",
                "md5": "25708e0ee676930241de314a020a0cfa",
                "sha256": "6c819b0360e9632be0391ec3eecc15510e30775632f4022e384e28908f59648c"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "25708e0ee676930241de314a020a0cfa",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 1458409,
            "upload_time": "2025-10-10T23:16:54",
            "upload_time_iso_8601": "2025-10-10T23:16:54.847265Z",
            "url": "https://files.pythonhosted.org/packages/31/3a/9c9dd0bee4f2b7e29ce245d2de4925182d70528f6aefcc64e8f43e057a52/samplerate-0.2.2-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "410f15a695af801fc2f6c2ca87e8d697a9f1bad59c2f00b0140689bb400788db",
                "md5": "f10fccacfb2644157281a645dfc32768",
                "sha256": "d072b658e438d55fed1224da9b226be1328ff9aea4268d02dbc7d864a72ce4f4"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp39-cp39-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "f10fccacfb2644157281a645dfc32768",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 2899523,
            "upload_time": "2025-10-10T23:15:16",
            "upload_time_iso_8601": "2025-10-10T23:15:16.715940Z",
            "url": "https://files.pythonhosted.org/packages/41/0f/15a695af801fc2f6c2ca87e8d697a9f1bad59c2f00b0140689bb400788db/samplerate-0.2.2-cp39-cp39-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "527140d25ba7663d8e8bac2eb26083b482cf143df5474743facb0818f5beeb53",
                "md5": "08ba1c0da797bb8de8c5d1164abc4e3c",
                "sha256": "bdae4f21890378f3886816800c8ef3395dabaa13fcac07bb0de7ad413703bfef"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "08ba1c0da797bb8de8c5d1164abc4e3c",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 1458430,
            "upload_time": "2025-10-10T23:16:10",
            "upload_time_iso_8601": "2025-10-10T23:16:10.810453Z",
            "url": "https://files.pythonhosted.org/packages/52/71/40d25ba7663d8e8bac2eb26083b482cf143df5474743facb0818f5beeb53/samplerate-0.2.2-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "78b96db4045509ea5d709ff6147971ca0625f898c0c32fc61a2f8f76c016d61b",
                "md5": "75263bc8693d57f83ba1c20b119f85d0",
                "sha256": "40964bfa28d33bc948389d958c2e742585f21891d8372ebba89260f491a15caa"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "75263bc8693d57f83ba1c20b119f85d0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 21626,
            "upload_time": "2025-10-10T23:14:02",
            "upload_time_iso_8601": "2025-10-10T23:14:02.732043Z",
            "url": "https://files.pythonhosted.org/packages/78/b9/6db4045509ea5d709ff6147971ca0625f898c0c32fc61a2f8f76c016d61b/samplerate-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-10 23:14:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "samplerate"
}
        
Elapsed time: 3.56431s