Skip to main content

PyAudioWasapiLoopbackPatch

PyAudioWPatch

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

Last Commit Wheels Py Version Latest release



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 available for Windows, Python 3.{7,8,9,10,11}.
All wheels support APIs: WMME, WASAPI, DirectX(DSound).

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
  • Ability to record audio from WASAPI loopback devices (see example)

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.

Also you can build wheels:

  • pip install cibuildwheel
  • Run in Cygwin:
    ./cygwin_cibuildwheel_build.sh
    
  • Get your wheels in the ./wheelhouse folder

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

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.5
File Actions
PyAudioWPatch-0.2.12.5-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for PyAudioWPatch-0.2.12.5-cp311-cp311-win_amd64.whl
PyAudioWPatch-0.2.12.5-cp311-cp311-win32.whl CPython 3.11 CPython 3.11 Windows x86-32 Details for PyAudioWPatch-0.2.12.5-cp311-cp311-win32.whl
PyAudioWPatch-0.2.12.5-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for PyAudioWPatch-0.2.12.5-cp310-cp310-win_amd64.whl
PyAudioWPatch-0.2.12.5-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details for PyAudioWPatch-0.2.12.5-cp310-cp310-win32.whl
PyAudioWPatch-0.2.12.5-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for PyAudioWPatch-0.2.12.5-cp39-cp39-win_amd64.whl
PyAudioWPatch-0.2.12.5-cp39-cp39-win32.whl CPython 3.9 CPython 3.9 Windows x86-32 Details for PyAudioWPatch-0.2.12.5-cp39-cp39-win32.whl
PyAudioWPatch-0.2.12.5-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for PyAudioWPatch-0.2.12.5-cp38-cp38-win_amd64.whl
PyAudioWPatch-0.2.12.5-cp38-cp38-win32.whl CPython 3.8 CPython 3.8 Windows x86-32 Details for PyAudioWPatch-0.2.12.5-cp38-cp38-win32.whl
PyAudioWPatch-0.2.12.5-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for PyAudioWPatch-0.2.12.5-cp37-cp37m-win_amd64.whl
PyAudioWPatch-0.2.12.5-cp37-cp37m-win32.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-32 Details for PyAudioWPatch-0.2.12.5-cp37-cp37m-win32.whl

Total release size: 847.5 kB

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

Download URL PyAudioWPatch-0.2.12.5-cp311-cp311-win_amd64.whl
Size 85.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
cea403d7f19726e53004a6da38986733f63a050634b216ca3ec59677cd1bdf11
BLAKE2b-256 checksum
How to use checksums
f304fe30ca579601fb5add95facca2dbe7ff7394e12ced9e450bf585d643064c
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.5-cp311-cp311-win32.whl

Download URL PyAudioWPatch-0.2.12.5-cp311-cp311-win32.whl
Size 83.6 kB
Tags CPython 3.11 Windows x86-32
SHA-256 checksum
How to use checksums
6c496013a73d770571e4fa9a3d238c6fb347e2595da28be1eb7aba3beca7a12f
BLAKE2b-256 checksum
How to use checksums
66f674588087a0990f778c533f44c317b298a3e4a43e94de24c62e1d3bd9465c
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.5-cp310-cp310-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.5-cp310-cp310-win_amd64.whl
Size 85.9 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
d62d537b14d65f93c614ec3b30b6830e0b0bc797acab9e791a8db211cb17baba
BLAKE2b-256 checksum
How to use checksums
460c76cacede7a33ce4313b1c0d84f7209cb7c840d0405de0f7e9f314e8e59cf
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.5-cp310-cp310-win32.whl

Download URL PyAudioWPatch-0.2.12.5-cp310-cp310-win32.whl
Size 83.6 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
3229e1fa7b687dcf8f1dcb50b429c2e70afaa72f3f1281833f1bfe293ada3e7a
BLAKE2b-256 checksum
How to use checksums
309f59da3ed76859b6fb172bed0a5cbcf0205091b479ac619e1e3cc897b2afee
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.5-cp39-cp39-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.5-cp39-cp39-win_amd64.whl
Size 85.9 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
02d04eb3cdad52cef42e77a313b53c700fbc5f268f498e9f74cda41269a82547
BLAKE2b-256 checksum
How to use checksums
bb6ce428ed1b6e8e6c2623a261678d22bf236530631280df38fa4bd5fdf8d833
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.5-cp39-cp39-win32.whl

Download URL PyAudioWPatch-0.2.12.5-cp39-cp39-win32.whl
Size 83.6 kB
Tags CPython 3.9 Windows x86-32
SHA-256 checksum
How to use checksums
2db78fe4f439a3332ce6b0e6da396b1adc750f953f2d58df10d2ad6704769357
BLAKE2b-256 checksum
How to use checksums
36fdce6228b16bae94b6f2f5c0ba48398700c171fcf1a741f69c9314fe6330e9
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.5-cp38-cp38-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.5-cp38-cp38-win_amd64.whl
Size 85.9 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
e6eec63fc514b02f4aab661bf16322f27287f378a0fdf9ad6202d5d1385cd30a
BLAKE2b-256 checksum
How to use checksums
b0cd119dce331470bfd3309a0ef187f843208d2e0169b5554f6a8294baeeb35c
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.5-cp38-cp38-win32.whl

Download URL PyAudioWPatch-0.2.12.5-cp38-cp38-win32.whl
Size 83.6 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
6a08af6d88c2e252316a7423fc1882ef9b2c6663bf59568831124e29904d8638
BLAKE2b-256 checksum
How to use checksums
d3cbe723eefc429d2ef0434fa0b87c80d276db8da7ebc0ddf4b4bf5b0778386e
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.5-cp37-cp37m-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.5-cp37-cp37m-win_amd64.whl
Size 85.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
5ee7343c39b17bbd0c29ef18154a7048e9b05fff48fa1c1240057ff3b92cc077
BLAKE2b-256 checksum
How to use checksums
a3eddd31d49dac6b486ee816b31c58a945727d71e0749f7e8cc00387e00ee349
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.5-cp37-cp37m-win32.whl

Download URL PyAudioWPatch-0.2.12.5-cp37-cp37m-win32.whl
Size 83.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
e7cc58f7c9d2666048341bff9227aa74a00a613c944955f899898ffe72bd6d5f
BLAKE2b-256 checksum
How to use checksums
3bf0d3c8bd8bd7534a06a2c530a8bd8c89dcb1976190b26192bf5fb42f477a64
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.5

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