I love SonicPi and dream of taking it on an airplane or other public place and code music.
However, listening to SonicPi through bluetooth earbuds is extremely painful. There is a constant buzzing/crackling sound when listening to it live. As other people have noted on the interwebs, if I record to a file and play it back via quicktime it sounds great… even using the same bluetooth earbuds.
I even tried two different bluetooth earbuds: Apple Airpods gen 3 and Beats Fit Pro. Both have the same behavior.
SonicPi plays live just fine over my macbook’s speakers.
It seems like it just congenitally does not like bluetooth earbuds.
Is this a known problem? Is this an unfixable problem? I would be happy to pateron if it would result in a fix.
Apologies, but there does appear to be a strange compatibility issue between bluetooth headphones and SuperCollider - the synthesis engine used by Sonic Pi. I’ve taken a look but haven’t been able to figure it out, sorry. If anyone has any ideas or thoughts on what might be happening here, I’d love to learn more.
It’s also important to point out that Patreon is a vehicle for supporting my work and not for requesting features / fixes.
It might be because SuperCollider requires the bitdepth and sampling rate to be equal between input and output (by default, from what I understand of it).
If you connect bluetooth headphones and if they actually come with a microphone, then there is a good chance that the OS will pick up the bluetooth microphone as well. The audio playback will align with the maximum sampling rate and bit depth of the microphone, which is expected to be much lower than the one you need for audio playback (you don’t need a very good sampling rate to transmit voice information).
I believe that you can openly specify the sampling rate and the bit depth of both the microphone and the audio playback independently at server boot, but this is not how SuperCollider behaves by default.
Please correct me if I am wrong on this!
EDIT: the recording is not concerned because you are still recording to a file with the expect sampling rate and bit depth.
I believe that @Bubo might be right, my earbud mic sample rate is much lower, which was forcing the output to have terrible quality (quite noticeable noise as you described). The way I fixed it was to switch the input device in the system preferences to one that supports a higher sampling rate (in my case the built-in MacBook mic). No more noise.
If you don’t have that option, try setting up a virtual input device with a better sampling rate and switch to that. It might also be possible to force it from .sonic-pi/config/audio-settings.toml, not sure.
Okay… just read this three years late due to trying a new pair of airpod pros. These have built in mic also with an output at 48,000hz or 24,000hz. The mic only has one setting at 24,000. Sonic wants parity but when I tried both at 24,000 … nasty distortion. So, tried 48,000hz for audio out and 25,000 for mic/audio in. Sonic doesn’t accept the two differing Hz settings. However, I have installed Blackhole 2ch version (Macbook Pro M1) and set up aggregated audio with an option for multi-output Devices. When I select this, sonic outs audio nicely but at full volume. The volume settings on the mac are disabled, so i just slide down the volume via Sonic. This fixed the audio output with airpods but also pushed audio out to the other outputs in my multi-output setting. Easy fix… I open the settings and de-select the internal speaks. Bingo! works beautifully. No distortion… just dial down the vlm in Sonic before running the code.