{"id":23167048,"url":"https://github.com/s0d3s/pyaudiowpatch","last_synced_at":"2025-05-16T13:04:53.124Z","repository":{"id":58748986,"uuid":"532029819","full_name":"s0d3s/PyAudioWPatch","owner":"s0d3s","description":"🐍 PyAudio | PortAudio fork with WASAPI loopback support 🔊 Record audio from speakers on Windows","archived":false,"fork":false,"pushed_at":"2025-01-29T16:02:35.000Z","size":1501,"stargazers_count":182,"open_issues_count":2,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-16T13:04:50.189Z","etag":null,"topics":["audio","loopback","pyaudio","python","record-speaker-output","record-what-you-hear","speaker-recording","wasapi","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s0d3s.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"s0d3s","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-09-02T18:01:18.000Z","updated_at":"2025-05-13T04:10:14.000Z","dependencies_parsed_at":"2024-03-29T09:25:30.110Z","dependency_job_id":"3ee22b9a-46ea-4504-a649-fdd643a02300","html_url":"https://github.com/s0d3s/PyAudioWPatch","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":"0.27586206896551724","last_synced_commit":"11aa1a24a2df5dd2c6d3c944078cffbbe1caf544"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0d3s%2FPyAudioWPatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0d3s%2FPyAudioWPatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0d3s%2FPyAudioWPatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0d3s%2FPyAudioWPatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s0d3s","download_url":"https://codeload.github.com/s0d3s/PyAudioWPatch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535827,"owners_count":22087399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","loopback","pyaudio","python","record-speaker-output","record-what-you-hear","speaker-recording","wasapi","windows"],"created_at":"2024-12-18T02:16:41.383Z","updated_at":"2025-05-16T13:04:53.082Z","avatar_url":"https://github.com/s0d3s.png","language":"C","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003c!---![PyAudioWasapiLoopbackPatch](assets/snake-350_patch.png)--\u003e\n\u003cimg alt=\"PyAudio Wasapi Loopback Patch\" src=\"https://raw.githubusercontent.com/s0d3s/PyAudioWPatch/media_content_distribution/assets/snake_trace_clear.svg\" height=\"414\"/\u003e\n\n# PyAudioWPatch\n\nThis fork will allow you to use the WASAPI device as loopback using **PyAudio**.\n\u003cbr\u003e\nSo you can *use speakers to record audio* ✨\n\n\n![Last Commit](https://img.shields.io/github/last-commit/s0d3s/PyAudioWPatch)\n[![Wheels](https://img.shields.io/pypi/wheel/PyAudioWpatch)](https://pypi.org/project/PyAudioWPatch/)\n![Downloads](https://img.shields.io/pypi/dm/PyAudioWPatch)\n![Py Version](https://img.shields.io/pypi/pyversions/PyAudioWpatch)\n[![Latest release](https://img.shields.io/github/v/release/s0d3s/PyAudioWPatch)](https://github.com/s0d3s/PyAudioWPatch/releases/latest)\n\n\u003c/div\u003e\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## For whom?\n\nIf you want to record sound from speakers in python, then this fork is for you. You can get recording from any device that supports WASAPI, for example, you can even record audio from *Bluetooth* headphones🎧\n\n\u003e PyAudioW(*indows|ASAPI*)Patch come only with WMME, DirectX and WASAPI support\n\u003e if you need more -\u003e create an issue\n\n## How\n\nThe Windows Audio Session API ([WASAPI](https://docs.microsoft.com/en-us/windows/win32/coreaudio/wasapi)) allows you to use output devices (that support this API) in loopback mode. At the time of release, it was impossible to achieve this using the original version of PyAudio.\n\n\u003e Note: Now WASAPI loopback devices are duplicated at the end of the list as virtual devices. That is, to record from speakers, you need to use not just a WASAPI device, but its loopback analogue. All loopback devices are **input devices**.\n\n## How to use\n\n*Read -\u003e Install -\u003e Enjoy!* ↣ *Press ⭐*\n\n### Installation\n\n```bash\npip install PyAudioWPatch\n```\n\u003e Wheels are available for **Windows**, Python *3.{7,8,9,10,11,12,13}*.\u003cbr /\u003e\n\u003e All wheels support APIs: WMME, WASAPI, DirectX(DSound).\n\n### In code\n\nWith new features:\n\n```python\nimport pyaudiowpatch as pyaudio\n\nwith pyaudio.PyAudio() as p:\n    # Open PyA manager via context manager\n    with p.open(...) as stream:\n        # Open audio stream via context manager\n        # Do some stuff\n        ...\n```\n\nOr in original PyAudio way:\n\n```python\nimport pyaudiowpatch as pyaudio\n\np = pyaudio.PyAudio()\nstream = p.open(...)\n\n# Do some stuff\n...\n\nstream.stop_stream()\nstream.close()\n\n# close PyAudio\np.terminate()\n```\n\n### Difference with PyAudio\n\n - The behavior of all standard methods is unchanged\n - Added several *life-improving* methods\n - Fixed problem with name encoding\n - Ability to record audio from WASAPI loopback devices (see [example](https://github.com/s0d3s/PyAudioWPatch/blob/master/examples/pawp_record_wasapi_loopback.py))\n \n#### More detailed\n - new methods:\n   - [`get_host_api_info_generator`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1082) - Iterate over all Host APIs\n   - [`get_device_info_generator`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1096) - Iterate over all devices\n   - [`get_device_info_generator_by_host_api`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1109) - Iterate over all devices, by specific Host API(index/type)\n   - [`get_loopback_device_info_generator`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1133) - Iterate over all devices(with loopback mode)\n   - [`print_detailed_system_info`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1149) - Print some info about Host Api and devices\n   - [`get_default_wasapi_loopback`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1255) - Return `loopback` for default speakers\n   - [`get_wasapi_loopback_analogue_by_index`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1243) - Return `loopback` for device via index\n   - [`get_wasapi_loopback_analogue_by_dict`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1213) - Return `loopback` for device related to `info_dict`\n   - [`get_default_wasapi_device`](https://github.com/s0d3s/PyAudioWPatch/blob/master/src/pyaudiowpatch/__init__.py#L1191) - Return default (out/in)put device for `WASAPI` driver\n\n - new features:\n   - Context manager support, for PyAudio(manager) and Stream classes\n   - Run `python -m pyaudiowpatch` to get list of devices(like `print_detailed_system_info` call)\n \n#### Examples:\n - 🆕 [Sequential recording from speakers](https://github.com/s0d3s/PyAudioWPatch/blob/master/examples/pawp_another_record_wasapi_loopback.py)\n - [Play sine, using \\'new context manager'](https://github.com/s0d3s/PyAudioWPatch/blob/master/examples/pawp_play_sine_using_context_manger.py)\n - [Record audio from default speakers](https://github.com/s0d3s/PyAudioWPatch/blob/master/examples/pawp_record_wasapi_loopback.py)\n - [Simple recording app](https://github.com/s0d3s/PyAudioWPatch/blob/master/examples/pawp_simple_recording_app.py)\n - [Cross-platform concept (Not example)](https://github.com/s0d3s/PyAudioWPatch/blob/master/examples/pawp_crossplatform_concept.py)\n\u003c!---\n - [Play sine, using \\'new context manager'](examples/pawp_play_sine_using_context_manger.py)\n - [Record from audio from default speakers](examples/pawp_record_wasapi_loopback.py)\n - [Cross-platform concept (Not example)](examples/pawp_crossplatform_concept.py)--\u003e\n \n## Sources\n\nThe following were taken as a basis:\n\n - PortAudio v19 \\[[8b6d16f26ad660e68a97743842ac29b939f3c0c1](https://github.com/PortAudio/portaudio/commit/8b6d16f26ad660e68a97743842ac29b939f3c0c1)]\n - PyAudio v0.2.12\n \n## How to build manually\n\n - Build PortAudio (using the instructions in the [README](portaudio_v19/README.md))\n - ~~Install [~~python~~](https://www.python.org/downloads/)~~\n - run in the PyAudioWPatch directory:\n   ```bush\n   python setup.py install\n   ```\n - ???\n - Profit.\n \n Also you can build wheel**s**:\n - `pip install cibuildwheel`\n - Run in Cygwin:\n    ```bash\n    ./cygwin_cibuildwheel_build.sh\n    ```\n - Get your wheels in the `./wheelhouse` folder\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n## Star History\n[![Star History Chart](https://api.star-history.com/svg?repos=s0d3s/PyAudioWPatch\u0026type=Date)](https://star-history.com/#s0d3s/PyAudioWPatch\u0026Date)\n\n## Origin README\n\n\u003c/div\u003e\n\n\u003cimg align=\"right\" width=\"200\" style=\"margin-left: 3px\" src=\"https://people.csail.mit.edu/hubert/pyaudio/images/snake-300.png\"\u003e\n\n## PyAudio\n\nPyAudio provides Python bindings for PortAudio v19, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms, such as GNU/Linux, Microsoft Windows, and Apple macOS.\n\nPyAudio is distributed under the MIT License.\n\n* [Homepage](https://people.csail.mit.edu/hubert/pyaudio/)\n* [API Documentation](https://people.csail.mit.edu/hubert/pyaudio/docs/)\n* [PyPi](https://pypi.python.org/pypi/PyAudio)\n\n## Installation\n\nSee the INSTALLATION file in the source distribution for details. In summary, install PyAudio using `pip` on most platforms.\n\n### Windows\n\n```sh\npython -m pip install pyaudio\n```\n\nThis installs the precompiled PyAudio library with PortAudio v19 19.7.0 included. The library is compiled with support for Windows MME API, DirectSound, WASAPI, and WDM-KS. It does not include support for ASIO. If you require support for APIs not included, you will need to compile PortAudio and PyAudio.\n\n### macOS\n\nUse [Homebrew](https://brew.sh) to install the prerequisite [portaudio](http://portaudio.com) library, then install PyAudio using `pip`:\n\n```sh\nbrew install portaudio\npip install pyaudio\n```\n\n### GNU/Linux\n\nUse the package manager to install PyAudio. For example, on Debian-based systems:\n\n```sh\nsudo apt install python3-pyaudio\n```\n\nAlternatively, if the latest version of PyAudio is not available, install it using `pip`. Be sure to first install development libraries for `portaudio19` and `python3`.\n\n### Building from source\n\nSee the INSTALLATION file.\n\n## Documentation \u0026 Usage Examples\n\n* Read the [API Documentation](https://people.csail.mit.edu/hubert/pyaudio/docs/), or generate it from the source using [`sphinx`](https://www.sphinx-doc.org/).\n\n* Usage examples are in the `examples` directory of the source distribution, or see the [project homepage](https://people.csail.mit.edu/hubert/pyaudio/).\n\n## License\n\nPyAudio is distributed under the MIT License. See LICENSE.txt.\n","funding_links":["https://patreon.com/s0d3s"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs0d3s%2Fpyaudiowpatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs0d3s%2Fpyaudiowpatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs0d3s%2Fpyaudiowpatch/lists"}