-
-
Save PRosenb/2ce5159a334af203fca7ef06501775f0 to your computer and use it in GitHub Desktop.
#!/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() |
Good luck mate. Please let us know if you get it to run.
OK, couldn't get that to run, but was able to use GarageBand to get the BlackHole --> MacBook Pro Speakers working and that's enough for my needs at this time. Thank you!
THANK YOU FOR THIS @PRosenb
@seabass9 and others trying to get it running - couple of things to check:
- Need to have numpy installed, run the command
python3 -m pip install numpy
. Numpy is kind of a power tool we might not strictly need here, would be cool if somebody changed the code so it could run without numpy. Seems to be supported by sounddevice but I already had numpy so I didn't try it. - Make sure you are using the same python 3 install both to install packages and run the script. You can be sure by running it like,
python3 -m pip install numpy sounddevice --user python3 ./forwardSound.py```
Also, I needed a little lower latency as I was using this to monitor myself playing keys while I stream online (ableton -> blackhole 1/2 for OBS, 3/4 for monitor) so I tweaked a few things that helped in my case: https://github.com/karlthorssen/monitor.py
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.
I've been playing with this a bit, also testing the wire.py example script. I'm sending audio from Tidal/DjayPro into the BH device. My goal would be to get that audio from BH output to the speakers. But still getting no audio at all so far.