Skip to main content

PyAudioWasapiLoopbackPatch

PyAudioWPatch

PyAudioW(indows|ASAPI)Patch

This fork will allow you to use the WASAPI device as loopback using PyAudio.





For whom?

If you want to record sound from your speakers in python, then this is the fork for you.

PyAudioW(indows|ASAPI)Patch come only with WMME, DirectX and WASAPI support if you need more -> create an issue

How

The Windows Audio Session API (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.

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.

How to use

Read -> Install -> Enjoy!

Installation

pip install PyAudioWPatch

Wheels are currently only available for Windows x64 Python 3.{6,7,8,9,10,11}. I will try to add x32 before 09/11/22

In code

With new features:

import pyaudiowpatch as pyaudio

with pyaudio.PyAudio() as p:
    # Open PyA manager via context manager
    with p.open(...) as stream:
        # Open audio stream via context manager
        # Do some staf
        ...

Or in original PyAudio way:

import pyaudiowpatch as pyaudio

p = pyaudio.PyAudio()
stream = p.open(...)
# Do some staf

stream.stop_stream()
stream.close()

# close PyAudio
p.terminate()

Difference with PyAudio

  • The behavior of all standard methods is unchanged
  • Added several life-improving methods
  • Fixed problem with name encoding

More detailed

  • new features:
    • Context manager support, for PyAudio(manager) and Stream classes
    • Run python -m pyaudiowpatch to get list of devices(like print_detailed_system_info call)

Examples:

Sources

The following were taken as a basis:

How to build manually

  • Build PortAudio (using the instructions in the README)
  • Install python
  • run in the PyAudioWPatch directory:
    python setup.py install
    
  • ???
  • Profit.

Origin README

PyAudio

PyAudio 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.

PyAudio is distributed under the MIT License.

Installation

See the INSTALLATION file in the source distribution for details. In summary, install PyAudio using pip on most platforms.

Windows

python -m pip install pyaudio

This 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.

macOS

Use Homebrew to install the prerequisite portaudio library, then install PyAudio using pip:

brew install portaudio
pip install pyaudio

GNU/Linux

Use the package manager to install PyAudio. For example, on Debian-based systems:

sudo apt install python3-pyaudio

Alternatively, if the latest version of PyAudio is not available, install it using pip. Be sure to first install development libraries for portaudio19 and python3.

Building from source

See the INSTALLATION file.

Documentation & Usage Examples

License

PyAudio is distributed under the MIT License. See LICENSE.txt.

Metadata

Release files for PyAudioWPatch 0.2.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for PyAudioWPatch 0.2.12.1
File Actions
PyAudioWPatch-0.2.12.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for PyAudioWPatch-0.2.12.3-cp311-cp311-win_amd64.whl
PyAudioWPatch-0.2.12.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for PyAudioWPatch-0.2.12.3-cp310-cp310-win_amd64.whl
PyAudioWPatch-0.2.12.3-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for PyAudioWPatch-0.2.12.3-cp39-cp39-win_amd64.whl
PyAudioWPatch-0.2.12.3-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for PyAudioWPatch-0.2.12.3-cp38-cp38-win_amd64.whl
PyAudioWPatch-0.2.12.3-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for PyAudioWPatch-0.2.12.3-cp37-cp37m-win_amd64.whl
PyAudioWPatch-0.2.12.3-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for PyAudioWPatch-0.2.12.3-cp36-cp36m-win_amd64.whl

Total release size: 512.1 kB

Release files / PyAudioWPatch-0.2.12.3-cp311-cp311-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.3-cp311-cp311-win_amd64.whl
Size 85.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
30eede97d00cd61af2a0c7081387bdf0abdff83df22adcaf816d2059e2280f33
BLAKE2b-256 checksum
How to use checksums
0f5293e249897321d7006e700d6f3112046ca7bd9a771b52e85328bd49bee3ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.0

Release files / PyAudioWPatch-0.2.12.3-cp310-cp310-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.3-cp310-cp310-win_amd64.whl
Size 85.4 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
d6e0c37a701d558bf9061da67d8ace14d4d089c368da5701019c83c2fcfdce96
BLAKE2b-256 checksum
How to use checksums
ab8b99de9bfd9e41b64ab8658e642579071143daddc22595a23bd25d95944906
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.0

Release files / PyAudioWPatch-0.2.12.3-cp39-cp39-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.3-cp39-cp39-win_amd64.whl
Size 85.4 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
6127549968a9f17ffbf5748659a4dd153504cdcaa37bac693ffbe7b04974e62a
BLAKE2b-256 checksum
How to use checksums
b4fd10910c1ef23b959273166c5de58e8de278f0cc2a085eab4dcdfed9d5827d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.0

Release files / PyAudioWPatch-0.2.12.3-cp38-cp38-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.3-cp38-cp38-win_amd64.whl
Size 85.5 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
29b85c2935a2c2e87dd3fe532df54191752b7b08bdc76f4e887d5ed0a364bbbb
BLAKE2b-256 checksum
How to use checksums
f95971abe3e2beaf6326d5bd38011ae813c38d665e87072c6a26d87c77bdf7e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.0

Release files / PyAudioWPatch-0.2.12.3-cp37-cp37m-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.3-cp37-cp37m-win_amd64.whl
Size 85.4 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
0390c638a27103e759cfb754586e7d9029f5124ae15399abc38ee9f7828e721f
BLAKE2b-256 checksum
How to use checksums
35f8e2c37b9c61a3ba10d839a6626830482e2ac6ab78d39dc3f947d1ab4979f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.0

Release files / PyAudioWPatch-0.2.12.3-cp36-cp36m-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.3-cp36-cp36m-win_amd64.whl
Size 84.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
971bca1e23fb9bf854bc6838dfa9f540f5aa3e5de4848f3c28949df006214aa7
BLAKE2b-256 checksum
How to use checksums
ff828113c675de01e2039401b3f8f1215b13722e18cfec64fd2b0ede699fcf8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.0

Security for PyAudioWPatch 0.2.12.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page