Last active
November 25, 2020 21:15
-
-
Save PRosenb/2ce5159a334af203fca7ef06501775f0 to your computer and use it in GitHub Desktop.
Forward audio from BlackHole to the output device.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sounddevice as sd | |
import sys | |
# Download the pkg file of BlackHole | |
# https://github.com/ExistentialAudio/BlackHole/releases | |
# Install BlackHole | |
# | |
# Install sounddevice | |
# pip install sounddevice --user | |
# | |
# Make file executable | |
# chmod +x ./forwardSound.py | |
# | |
# Click on Mac volume control (on top) and choose 'Output Device': 'BlackHole 16ch' | |
# | |
# Check with the following command what name the Built-in Output device has | |
# python -m sounddevice | |
sd.default.device = 'BlackHole 16ch', 'Built-in Output' | |
def callback(indata, outdata, frames, time, status): | |
if status: | |
print(status) | |
outdata[:] = indata | |
with sd.Stream(channels=2, callback=callback): | |
print('#' * 80) | |
print('press Return to quit') | |
print('#' * 80) | |
if sys.version_info[0] < 3: | |
raw_input() | |
else: | |
input() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the meantime, there is a nice solution available if you like to control the volume of e.g. optical audio output.
For such cases, I recommend Proxy Audio Driver.