samplerate


Namesamplerate JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryMonolithic python wrapper for libsamplerate based on pybind11 and NumPy
upload_time2024-01-23 23:52:03
maintainer
docs_urlNone
author
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": "",
    "name": "samplerate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "samplerate,converter,signal processing,audio",
    "author": "",
    "author_email": "Robin Scheibler <fakufaku@gmail.com>, Tino Wagner <ich@tinowagner.com>",
    "download_url": "https://files.pythonhosted.org/packages/bf/9c/d8978b13b8af2f28fdc425e2893f7419d1d6429da1c6a850be83ad095d4f/samplerate-0.2.1.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.1",
    "project_urls": null,
    "split_keywords": [
        "samplerate",
        "converter",
        "signal processing",
        "audio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a818e8b7d04cdd63ac9eec969519103deae38ea4c75ea8245f90c9a3c5663d05",
                "md5": "2eff979b8d39463e259898ecfceb14f7",
                "sha256": "9b392e857cfeda712585d702871eab7169ba2c63209e8d2314fa2196d6127354"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp310-cp310-macosx_12_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2eff979b8d39463e259898ecfceb14f7",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 1442136,
            "upload_time": "2024-01-23T23:53:18",
            "upload_time_iso_8601": "2024-01-23T23:53:18.529080Z",
            "url": "https://files.pythonhosted.org/packages/a8/18/e8b7d04cdd63ac9eec969519103deae38ea4c75ea8245f90c9a3c5663d05/samplerate-0.2.1-cp310-cp310-macosx_12_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72d75d54efb240a691b233a20f5960661e903e5993fddc8a553f804757c0c6ed",
                "md5": "fdd5ed81ed1189a3cb60c9cf0fb58f55",
                "sha256": "c237959ba0fd391b3293f2905c23f1ae15a096fc987cd776aef380ba426491c6"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fdd5ed81ed1189a3cb60c9cf0fb58f55",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 1440887,
            "upload_time": "2024-01-23T23:55:49",
            "upload_time_iso_8601": "2024-01-23T23:55:49.318699Z",
            "url": "https://files.pythonhosted.org/packages/72/d7/5d54efb240a691b233a20f5960661e903e5993fddc8a553f804757c0c6ed/samplerate-0.2.1-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74f7f6c5d7fe3b85a33b29bbf6868c897600492c5258b4b2d4d49bc2a9fdb9cc",
                "md5": "5d06569c2f6c6ce6aee478f78da413b5",
                "sha256": "b0e1b5cb08edb19d232bd1ba67632590ed7a579b526ab4bf3983b4f2b2e9acb4"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp311-cp311-macosx_12_0_universal2.whl",
            "has_sig": false,
            "md5_digest": "5d06569c2f6c6ce6aee478f78da413b5",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 2880717,
            "upload_time": "2024-01-23T23:53:12",
            "upload_time_iso_8601": "2024-01-23T23:53:12.291013Z",
            "url": "https://files.pythonhosted.org/packages/74/f7/f6c5d7fe3b85a33b29bbf6868c897600492c5258b4b2d4d49bc2a9fdb9cc/samplerate-0.2.1-cp311-cp311-macosx_12_0_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cda5f9deb72c8ba4f7264eb38cb5756a37c87fd3a685a486b2ca97063207d68e",
                "md5": "ccc93182322ce787712f3df9a5ad9c57",
                "sha256": "3ebd447f2040950edc1dac32cb4afed3a74ed37e8e5ffe4775470213f799801f"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "ccc93182322ce787712f3df9a5ad9c57",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 1440933,
            "upload_time": "2024-01-23T23:55:50",
            "upload_time_iso_8601": "2024-01-23T23:55:50.606205Z",
            "url": "https://files.pythonhosted.org/packages/cd/a5/f9deb72c8ba4f7264eb38cb5756a37c87fd3a685a486b2ca97063207d68e/samplerate-0.2.1-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be5e03eee29d705c82137a869333258228746f66a4a065a5dcce98e6dc1d17ef",
                "md5": "a6b509c087def9c864c9a0cad4386841",
                "sha256": "69cc7ad887c36294129315a04a7f43837c7ed9caf42db94e9687cf66c9709200"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp312-cp312-macosx_12_0_universal2.whl",
            "has_sig": false,
            "md5_digest": "a6b509c087def9c864c9a0cad4386841",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 2885578,
            "upload_time": "2024-01-23T23:53:41",
            "upload_time_iso_8601": "2024-01-23T23:53:41.046964Z",
            "url": "https://files.pythonhosted.org/packages/be/5e/03eee29d705c82137a869333258228746f66a4a065a5dcce98e6dc1d17ef/samplerate-0.2.1-cp312-cp312-macosx_12_0_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e9d0ac5500843d947a82d7552c098954219ca460199a14dc5ebf72b090a46b42",
                "md5": "8b579dbc5384183ca74f6e6a81775428",
                "sha256": "c7f5e81b24debfa25981e367e3f5d191cf72e32b5c92613139f5ba94e7f18c01"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "8b579dbc5384183ca74f6e6a81775428",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 1441712,
            "upload_time": "2024-01-23T23:55:50",
            "upload_time_iso_8601": "2024-01-23T23:55:50.706295Z",
            "url": "https://files.pythonhosted.org/packages/e9/d0/ac5500843d947a82d7552c098954219ca460199a14dc5ebf72b090a46b42/samplerate-0.2.1-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b17569d049ab3ec2ab16d77891a932414d6e21afb46d5412bb7822f36b927d98",
                "md5": "165fcd52773fcbe1805cbf14f397a2dd",
                "sha256": "a2b39a7131da065072508548f0ab80c9565d8c75212eac2f61fc1b1f82bb1611"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp38-cp38-macosx_12_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "165fcd52773fcbe1805cbf14f397a2dd",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 1442148,
            "upload_time": "2024-01-23T23:52:52",
            "upload_time_iso_8601": "2024-01-23T23:52:52.346796Z",
            "url": "https://files.pythonhosted.org/packages/b1/75/69d049ab3ec2ab16d77891a932414d6e21afb46d5412bb7822f36b927d98/samplerate-0.2.1-cp38-cp38-macosx_12_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1664c83b56b441dbcc74ac838deb4e7c647f763d4ce1a9c35533f0af62ade10",
                "md5": "cbcd77dc6de3544d1987d18d601a6ae7",
                "sha256": "c02d6e0f7541c4f6a64b97ff6d0a84f53a0c432c965031491b48d9d75a81f102"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "cbcd77dc6de3544d1987d18d601a6ae7",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 1440900,
            "upload_time": "2024-01-23T23:55:45",
            "upload_time_iso_8601": "2024-01-23T23:55:45.464968Z",
            "url": "https://files.pythonhosted.org/packages/c1/66/4c83b56b441dbcc74ac838deb4e7c647f763d4ce1a9c35533f0af62ade10/samplerate-0.2.1-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8609bbe626df90664eb0053d7165dbc80780f9169fc490c8e5a2a35febaebf95",
                "md5": "6e3c8882a5ead76926092be35ec62bcf",
                "sha256": "137563c6069e23441b4c2059cf95a3ed5b20a6d747d0488014becb94b4dfc32f"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp39-cp39-macosx_12_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "6e3c8882a5ead76926092be35ec62bcf",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 1442286,
            "upload_time": "2024-01-23T23:53:37",
            "upload_time_iso_8601": "2024-01-23T23:53:37.894489Z",
            "url": "https://files.pythonhosted.org/packages/86/09/bbe626df90664eb0053d7165dbc80780f9169fc490c8e5a2a35febaebf95/samplerate-0.2.1-cp39-cp39-macosx_12_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82a426e48ccbbfb0f3add1e7955506f35a3ec8aaf49be691600e991173f3dc65",
                "md5": "65dca3918d387360dc1919351d1576bc",
                "sha256": "0656233932f76af6070f56edf34d8ef56e62e2c503553229d2388953a2166cda"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "65dca3918d387360dc1919351d1576bc",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 1441099,
            "upload_time": "2024-01-23T23:55:37",
            "upload_time_iso_8601": "2024-01-23T23:55:37.376081Z",
            "url": "https://files.pythonhosted.org/packages/82/a4/26e48ccbbfb0f3add1e7955506f35a3ec8aaf49be691600e991173f3dc65/samplerate-0.2.1-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf9cd8978b13b8af2f28fdc425e2893f7419d1d6429da1c6a850be83ad095d4f",
                "md5": "9801600a41437221df0d6c4e34fa3fe7",
                "sha256": "464d3574412024184fb7428ecbaa1b2e207bddf5fbc10a5d9ddc3fc1c7b7ab1e"
            },
            "downloads": -1,
            "filename": "samplerate-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9801600a41437221df0d6c4e34fa3fe7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 21494,
            "upload_time": "2024-01-23T23:52:03",
            "upload_time_iso_8601": "2024-01-23T23:52:03.960816Z",
            "url": "https://files.pythonhosted.org/packages/bf/9c/d8978b13b8af2f28fdc425e2893f7419d1d6429da1c6a850be83ad095d4f/samplerate-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 23:52:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "samplerate"
}
        
Elapsed time: 0.29258s