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

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.4
File Actions
PyAudioWPatch-0.2.12.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for PyAudioWPatch-0.2.12.4-cp311-cp311-win_amd64.whl
PyAudioWPatch-0.2.12.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for PyAudioWPatch-0.2.12.4-cp310-cp310-win_amd64.whl
PyAudioWPatch-0.2.12.4-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for PyAudioWPatch-0.2.12.4-cp39-cp39-win_amd64.whl
PyAudioWPatch-0.2.12.4-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for PyAudioWPatch-0.2.12.4-cp38-cp38-win_amd64.whl
PyAudioWPatch-0.2.12.4-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for PyAudioWPatch-0.2.12.4-cp37-cp37m-win_amd64.whl
PyAudioWPatch-0.2.12.4-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for PyAudioWPatch-0.2.12.4-cp36-cp36m-win_amd64.whl

Total release size: 512.0 kB

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

Download URL PyAudioWPatch-0.2.12.4-cp311-cp311-win_amd64.whl
Size 85.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
c7f2750e39db93597e6006a5996814a179f58d2ba811a51212194c7aa64bad42
BLAKE2b-256 checksum
How to use checksums
9ae26dd18711b03ce5c2a0924b865bf7dfadc475cc509dcd358bb0ba139a147f
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.4-cp310-cp310-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.4-cp310-cp310-win_amd64.whl
Size 85.4 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
79cdc10ea64f2031850e9be92eeb048b209e9e0ca236a84d27b37fbff10ea537
BLAKE2b-256 checksum
How to use checksums
dab2a727f6990bfab5d55c6b224c37813963c88426cb8fb8e9892c749850de68
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.4-cp39-cp39-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.4-cp39-cp39-win_amd64.whl
Size 85.4 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
e94210713fded8fb0978b20a67c2200e9d642e28926208da95802b0944c5c4d1
BLAKE2b-256 checksum
How to use checksums
f4fe536e6b93e6a68268fa2ef335e0a1cb68279f3e1ef0b1f6703e530b32b45c
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.4-cp38-cp38-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.4-cp38-cp38-win_amd64.whl
Size 85.5 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
7bcb5c57364d801d695aa7b999383f9b3d9e34a0a5434f6e1888152dc74d69b9
BLAKE2b-256 checksum
How to use checksums
70e602526306de923103f0cc5ae5e3321cf82d5a9eabd8b55c87e47b84396f33
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.4-cp37-cp37m-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.4-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
82dcf3ea9974bb275e7b23300c53256e3865a94e0b74406183abd3ecb5a9c0a1
BLAKE2b-256 checksum
How to use checksums
b2027f95ce9ecfebd5f061256592abc1d4760b0d2dae2603099037eb6d19a89a
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.4-cp36-cp36m-win_amd64.whl

Download URL PyAudioWPatch-0.2.12.4-cp36-cp36m-win_amd64.whl
Size 84.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
04390837700ee6ab02aabeec95bc2c115724c2781e16614298dd53a8e6040ce3
BLAKE2b-256 checksum
How to use checksums
d2490a53aa12c30f1aa4e2f18648f0e61887eef13a8b3563ac423c86e9a5d683
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.4

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