hance


Namehance JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://hance.ai
SummaryThe Python API to the HANCE engine, which offers realtime audio enhancement.
upload_time2024-12-05 13:05:51
maintainerNone
docs_urlNone
authorHANCE
requires_python!=2.*,>=3.0
licenseNone
keywords hance audio enhancement noise reduction
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Audio Enhancement in Python with HANCE

The **HANCE** Engine is a model inference library built with audio in mind. A large set of pre-trained models ranging from speech noise supression and de-reverberation to stem separation and recovery of missing frequency content are available.

Our models are trained specifically for real-time usage, achieving low latencies down to 20 milliseconds in speech enhancement applications. Furthermore, the models are designed to be small and resource-efficient, with model file sizes down to 242 KB for the smallest noise suppression model.

The HANCE engine is built in C++ and is compatible across various architectures. With our Python wrapper, you can easily integrate HANCE into your Python projects and quickly process files and benchmark our models.

If you're looking for a way to quickly test our models, we recommend downloading the [HANCE Model Player for Mac and Windows](https://hance.ai/downloads)

To learn more about HANCE, visit [Hance.ai](https://hance.ai).

## Installation

To install the Python wrapper for HANCE, use `pip`:

    python -m pip install hance

HANCE is compatible with Python 3 and later.

## How to Use

The HANCE Python API is a wrapper around the C++ library. 

For those eager to dive in, the `examples.py` script in our PythonAPI GitHub repository is the perfect starting point. This script features a command-line interface that simplifies the process of experimenting with our models. You can quickly test out various audio enhancement models without writing a single line of code. Here's how to get started:

1. First, clone or download the [examples.py](https://github.com/hance-engine/hance-api/blob/main/PythonAPI/examples.py) file from GitHub to your local machine. 
2. Open your terminal or command prompt and navigate to the directory where you downloaded the file.
3. Execute `python examples.py` to access the command-line interface. Follow the on-screen instructions to select and run audio enhancement models.

## Using the API

To use the API, import it and list the available models:

    import hance
    models = hance.list_models()
    print(models)


To download and update to the latest models, simply call:
    
    hance.update_models()

## Process a File

To process a file with HANCE, you can use the `process_file` function as follows:

    import hance

    # Initialize HanceEngine and create processor
    hance_engine = hance.HanceEngine()

    # List the available models in the models folder.
    models = hance.list_models()

    # Many HANCE models support multiple outputs, and they can be mixed as preferred.
    # There are models that let you adjust reverb and noise reduction separately,
    # as well as stem separation allowing you, for instance, to output just vocals,
    # or perhaps mix drums and guitar.

    # Create a dummy processor to list the available output busses.
    processor = hance_engine.create_processor(selected_model, 2, 44100)

    # List available output buses
    num_buses = processor.get_number_of_output_buses()
    bus_names = []
    for i in range(num_buses):
        bus_names.append(processor.get_output_bus_name(i))

    # The bus_names list will show you the name of the available output buses.

    hance.process_file(
        model_file_path=selected_model[0],  # Selecting the first model in the list
        input_file_path=input_file_path,
        output_file_path=out_file_path,
        selected_output_bus=0  # Selecting output bus 0, which will be the processed result in most models.
    )

This will apply the enhancement model specified by `models[0]` to the input file located at `input_file_path`, and save the enhanced audio to the output file at `output_file_path`. 

### Models
The models in the models folder have semantic names. For example, speech-denoise-48kHz-32ms.hance, signifies that this is a model that _denoises_ speech, expects an input samplerate of 48kHz, and has a latency of 32ms. For product information, take a look at [this page](https://hance.ai/products)

All models within a family, e.g. the speech-denoise family, have similar characteristics. For denoising purposes, we recommend starting with speech-denoise-48kHz-32ms-tiny.hance to see if that meets your requirements, and move up in size if needed. We also note that if you have special requirements for particular audio circumstances, we offer can build models to better suit those circumstances. Contact us if this is the case.

Please note that hance.process_file is using PySoundFile to read and write audio files. While PySoundFile is not a requirement for using HANCE, it is a convenient library for handling audio files in Python.

Check out the `hance_file.py` file to see how you can read and write files block by block for real-time processing.

For more information and examples on using HANCE, see the HANCE documentation.

            

Raw data

            {
    "_id": null,
    "home_page": "https://hance.ai",
    "name": "hance",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=2.*,>=3.0",
    "maintainer_email": null,
    "keywords": "hance, audio enhancement, noise reduction",
    "author": "HANCE",
    "author_email": "HANCE <mail@hance.ai>",
    "download_url": null,
    "platform": null,
    "description": "# Audio Enhancement in Python with HANCE\n\nThe **HANCE** Engine is a model inference library built with audio in mind. A large set of pre-trained models ranging from speech noise supression and de-reverberation to stem separation and recovery of missing frequency content are available.\n\nOur models are trained specifically for real-time usage, achieving low latencies down to 20 milliseconds in speech enhancement applications. Furthermore, the models are designed to be small and resource-efficient, with model file sizes down to 242 KB for the smallest noise suppression model.\n\nThe HANCE engine is built in C++ and is compatible across various architectures. With our Python wrapper, you can easily integrate HANCE into your Python projects and quickly process files and benchmark our models.\n\nIf you're looking for a way to quickly test our models, we recommend downloading the [HANCE Model Player for Mac and Windows](https://hance.ai/downloads)\n\nTo learn more about HANCE, visit [Hance.ai](https://hance.ai).\n\n## Installation\n\nTo install the Python wrapper for HANCE, use `pip`:\n\n    python -m pip install hance\n\nHANCE is compatible with Python 3 and later.\n\n## How to Use\n\nThe HANCE Python API is a wrapper around the C++ library. \n\nFor those eager to dive in, the `examples.py` script in our PythonAPI GitHub repository is the perfect starting point. This script features a command-line interface that simplifies the process of experimenting with our models. You can quickly test out various audio enhancement models without writing a single line of code. Here's how to get started:\n\n1. First, clone or download the [examples.py](https://github.com/hance-engine/hance-api/blob/main/PythonAPI/examples.py) file from GitHub to your local machine. \n2. Open your terminal or command prompt and navigate to the directory where you downloaded the file.\n3. Execute `python examples.py` to access the command-line interface. Follow the on-screen instructions to select and run audio enhancement models.\n\n## Using the API\n\nTo use the API, import it and list the available models:\n\n    import hance\n    models = hance.list_models()\n    print(models)\n\n\nTo download and update to the latest models, simply call:\n    \n    hance.update_models()\n\n## Process a File\n\nTo process a file with HANCE, you can use the `process_file` function as follows:\n\n    import hance\n\n    # Initialize HanceEngine and create processor\n    hance_engine = hance.HanceEngine()\n\n    # List the available models in the models folder.\n    models = hance.list_models()\n\n    # Many HANCE models support multiple outputs, and they can be mixed as preferred.\n    # There are models that let you adjust reverb and noise reduction separately,\n    # as well as stem separation allowing you, for instance, to output just vocals,\n    # or perhaps mix drums and guitar.\n\n    # Create a dummy processor to list the available output busses.\n    processor = hance_engine.create_processor(selected_model, 2, 44100)\n\n    # List available output buses\n    num_buses = processor.get_number_of_output_buses()\n    bus_names = []\n    for i in range(num_buses):\n        bus_names.append(processor.get_output_bus_name(i))\n\n    # The bus_names list will show you the name of the available output buses.\n\n    hance.process_file(\n        model_file_path=selected_model[0],  # Selecting the first model in the list\n        input_file_path=input_file_path,\n        output_file_path=out_file_path,\n        selected_output_bus=0  # Selecting output bus 0, which will be the processed result in most models.\n    )\n\nThis will apply the enhancement model specified by `models[0]` to the input file located at `input_file_path`, and save the enhanced audio to the output file at `output_file_path`. \n\n### Models\nThe models in the models folder have semantic names. For example, speech-denoise-48kHz-32ms.hance, signifies that this is a model that _denoises_ speech, expects an input samplerate of 48kHz, and has a latency of 32ms. For product information, take a look at [this page](https://hance.ai/products)\n\nAll models within a family, e.g. the speech-denoise family, have similar characteristics. For denoising purposes, we recommend starting with speech-denoise-48kHz-32ms-tiny.hance to see if that meets your requirements, and move up in size if needed. We also note that if you have special requirements for particular audio circumstances, we offer can build models to better suit those circumstances. Contact us if this is the case.\n\nPlease note that hance.process_file is using PySoundFile to read and write audio files. While PySoundFile is not a requirement for using HANCE, it is a convenient library for handling audio files in Python.\n\nCheck out the `hance_file.py` file to see how you can read and write files block by block for real-time processing.\n\nFor more information and examples on using HANCE, see the HANCE documentation.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The Python API to the HANCE engine, which offers realtime audio enhancement.",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://hance.ai"
    },
    "split_keywords": [
        "hance",
        " audio enhancement",
        " noise reduction"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2fa7c9e0d328ab4c50217f5874ac2693c1b7c481878a7033316c7a56dc60d61",
                "md5": "814a1fe52730487eabbd5a76758aa7da",
                "sha256": "8a632ccba31e41e69a68bc20d272e404ef0cda5c99c0218fafba014e162e1fb0"
            },
            "downloads": -1,
            "filename": "hance-3.0.0-py3-none-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "814a1fe52730487eabbd5a76758aa7da",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=2.*,>=3.0",
            "size": 28505774,
            "upload_time": "2024-12-05T13:05:51",
            "upload_time_iso_8601": "2024-12-05T13:05:51.397125Z",
            "url": "https://files.pythonhosted.org/packages/a2/fa/7c9e0d328ab4c50217f5874ac2693c1b7c481878a7033316c7a56dc60d61/hance-3.0.0-py3-none-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4fd895af05e41611f0a9da8c2d9e6ca711a46b7a42313da6519b042a4aa91bc8",
                "md5": "2beaaab3d5ed773e8f783c7ac8f25063",
                "sha256": "76281152b11820f868d2abe48e48a49e7e426011c91742985dd8f5de743a3d5e"
            },
            "downloads": -1,
            "filename": "hance-3.0.0-py3-none-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "2beaaab3d5ed773e8f783c7ac8f25063",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=2.*,>=3.0",
            "size": 28505774,
            "upload_time": "2024-12-05T13:05:55",
            "upload_time_iso_8601": "2024-12-05T13:05:55.465225Z",
            "url": "https://files.pythonhosted.org/packages/4f/d8/95af05e41611f0a9da8c2d9e6ca711a46b7a42313da6519b042a4aa91bc8/hance-3.0.0-py3-none-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11e1efc012dd5cb45a902ebbdd02b8bd82c3babd475e99b6cddd804be4be528c",
                "md5": "ea86c7b03953dadef2f1f6c444cf7269",
                "sha256": "fb098f97c30042dfeca5948ae98b50a3a135baff07f618a98a96cb4a6bf11b7f"
            },
            "downloads": -1,
            "filename": "hance-3.0.0-py3-none-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ea86c7b03953dadef2f1f6c444cf7269",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=2.*,>=3.0",
            "size": 27539830,
            "upload_time": "2024-12-05T13:05:59",
            "upload_time_iso_8601": "2024-12-05T13:05:59.637108Z",
            "url": "https://files.pythonhosted.org/packages/11/e1/efc012dd5cb45a902ebbdd02b8bd82c3babd475e99b6cddd804be4be528c/hance-3.0.0-py3-none-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3924d23d22c52bae4cf7e3f701446a1d5b7f5bc2d183948075d892022319f72",
                "md5": "e800b8c4f1287e2a79e7f827bbb93a47",
                "sha256": "e8c41b887b7f54d0ffdf7c385e5f9c2d5ee91186862bd51ff21ac717e9c05b50"
            },
            "downloads": -1,
            "filename": "hance-3.0.0-py3-none-win32.whl",
            "has_sig": false,
            "md5_digest": "e800b8c4f1287e2a79e7f827bbb93a47",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=2.*,>=3.0",
            "size": 24399292,
            "upload_time": "2024-12-05T13:06:03",
            "upload_time_iso_8601": "2024-12-05T13:06:03.953258Z",
            "url": "https://files.pythonhosted.org/packages/f3/92/4d23d22c52bae4cf7e3f701446a1d5b7f5bc2d183948075d892022319f72/hance-3.0.0-py3-none-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a3527f5a30d577934fd5b86e6310cee5f01148ac1eeb2de7b43af59e3a4475a",
                "md5": "b5c38f74406bbeb2eb34b2695f0a97f6",
                "sha256": "afab32d4f9467940fa10e7c950032c4e82a8e7e5670ae07e8af0c12078535542"
            },
            "downloads": -1,
            "filename": "hance-3.0.0-py3-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "b5c38f74406bbeb2eb34b2695f0a97f6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=2.*,>=3.0",
            "size": 26245409,
            "upload_time": "2024-12-05T13:06:07",
            "upload_time_iso_8601": "2024-12-05T13:06:07.754555Z",
            "url": "https://files.pythonhosted.org/packages/2a/35/27f5a30d577934fd5b86e6310cee5f01148ac1eeb2de7b43af59e3a4475a/hance-3.0.0-py3-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 13:05:51",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hance"
}
        
Elapsed time: 6.48678s