Skip to content

Commit de5e44b

Browse files
committed
Change links to their perma-versions
1 parent 7d7233f commit de5e44b

File tree

1 file changed

+107
-2
lines changed

1 file changed

+107
-2
lines changed

README.md

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div align="center">
22

3-
![PyAudioWasapiLoopbackPatch](assets/snake-350_patch.png)
3+
<!---![PyAudioWasapiLoopbackPatch](assets/snake-350_patch.png)-->
4+
![PyAudioWasapiLoopbackPatch](https://raw.githubusercontent.com/s0d3s/PyAudioWPatch/1b52f1b01160607be2f33dea77c5f1584a6bed33/assets/snake-350_patch.png)
45

56
# PyAudioWPatch
67

@@ -10,16 +11,120 @@ This fork will allow you to use the WASAPI device as loopback using **PyAudio**.
1011

1112
</div>
1213

14+
<br /><br /><br /><br />
1315

16+
## For whom?
1417

18+
If you want to record sound from your speakers in python, then this is the fork for you.
19+
20+
> PyAudioW(*indows|ASAPI*)Patch come only with WMME, DirectX and WASAPI support
21+
> if you need more -> create an issue
22+
23+
## How
24+
25+
The 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.
26+
27+
> 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**.
28+
29+
## How to use
30+
31+
*Read -> Install -> Enjoy!*
32+
33+
### Installation
34+
35+
```bash
36+
pip install
37+
```
38+
39+
### In code
40+
41+
With new features:
42+
43+
```python
44+
import pyaudiowpatch as pyaudio
45+
46+
with pyaudio.PyAudio() as p:
47+
# Open PyA manager via context manager
48+
with p.open(...) as stream:
49+
# Open audio stream via context manager
50+
# Do some staf
51+
...
52+
```
53+
54+
Or in original PyAudio way:
55+
56+
```python
57+
import pyaudiowpatch as pyaudio
58+
59+
p = pyaudio.PyAudio()
60+
stream = p.open(...)
61+
# Do some staf
62+
63+
stream.stop_stream()
64+
stream.close()
65+
66+
# close PyAudio
67+
p.terminate()
68+
```
69+
70+
### Difference with PyAudio
71+
72+
- The behavior of all standard methods is unchanged
73+
- Added several *life-improving* methods
74+
- Fixed problem with name encoding
75+
76+
#### More detailed
77+
- new methods:
78+
- [`get_host_api_info_generator`](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/src/pyaudiowpatch/__init__.py#L1066) - Iterate over all Host APIs
79+
- [`get_device_info_generator`](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/src/pyaudiowpatch/__init__.py#L1080) - Iterate over all devices
80+
- [`get_device_info_generator_by_host_api`](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/src/pyaudiowpatch/__init__.py#L1093) - Iterate over all devices, by specific Host API(index/type)
81+
- [`get_loopback_device_info_generator`](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/src/pyaudiowpatch/__init__.py#L1117) - Iterate over all devices(with loopback mode)
82+
- [`print_detailed_system_info`](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/src/pyaudiowpatch/__init__.py#L1133) - Print some info about Host Api and devices
83+
<!---
84+
- [`get_host_api_info_generator`](src/pyaudiowpatch/__init__.py#L1066) - Iterate over all Host APIs
85+
- [`get_device_info_generator`](src/pyaudiowpatch/__init__.py#L1080) - Iterate over all devices
86+
- [`get_device_info_generator_by_host_api`](src/pyaudiowpatch/__init__.py#L1093) - Iterate over all devices, by specific Host API(index/type)
87+
- [`get_loopback_device_info_generator`](src/pyaudiowpatch/__init__.py#L1117) - Iterate over all devices(with loopback mode)
88+
- [`print_detailed_system_info`](src/pyaudiowpatch/__init__.py#L1133) - Print some info about Host Api and devices-->
89+
90+
- new features:
91+
- Context manager support, for PyAudio(manager) and Stream classes
92+
- Run `python -m pyaudiowpatch` to get list of devices(like `print_detailed_system_info` call)
93+
94+
#### Examples:
95+
- [Play sine, using \'new context manager'](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/examples/pawp_play_sine_using_context_manger.py)
96+
- [Record from audio from default speakers](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/examples/pawp_record_wasapi_loopback.py)
97+
- [Cross-platform concept (Not example)](https://github.com/s0d3s/PyAudioWPatch/blob/964afaed7dc03b6dd097f0c22d8a286663516544/examples/pawp_crossplatform_concept.py)
98+
<!---
99+
- [Play sine, using \'new context manager'](examples/pawp_play_sine_using_context_manger.py)
100+
- [Record from audio from default speakers](examples/pawp_record_wasapi_loopback.py)
101+
- [Cross-platform concept (Not example)](examples/pawp_crossplatform_concept.py)-->
102+
103+
## Sources
104+
105+
The following were taken as a basis:
106+
107+
- PortAudio v19 \[[8b6d16f26ad660e68a97743842ac29b939f3c0c1](https://github.com/PortAudio/portaudio/commit/8b6d16f26ad660e68a97743842ac29b939f3c0c1)]
108+
- PyAudio v0.2.12
109+
110+
## How to build manually
111+
112+
- Build PortAudio (using the instructions in the [README](portaudio_v19/README.md))
113+
- ~~Install [~~python~~](https://www.python.org/downloads/)~~
114+
- run in the PyAudioWPatch directory:
115+
```bush
116+
python setup.py install
117+
```
118+
- ???
119+
- Profit.
15120

16121
---
17122

18123
<div align="center">
19124

20125
## Origin README
21126

22-
<div>
127+
</div>
23128

24129

25130
<img align="right" width="200" style="margin-left: 3px" src="https://people.csail.mit.edu/hubert/pyaudio/images/snake-300.png">

0 commit comments

Comments
 (0)