Sonic pi not working with external speaker
I am running sonic pi version 3.1 It works fine but when I connect the speaker via aux cable it does not play. The speaker works fine and so I am wondering whether it is something within sonic pi. I am new to ruby and sonic pi Thanks!
The same problem with MacOs X and Airpods connected
Sonic Pi Boot Error Report
System Information
- Sonic Pi version: 3.1.0
- OS: macOS 10.14
GUI Log
$HOME/.sonic-pi/log/gui.log
[GUI] - Detecting port numbers...
[GUI] - GUI OSC listen port 4558
[GUI] - port: 4558 [OK]
[GUI] - Server OSC listen port 4557
[GUI] - port: 4557 [OK]
[GUI] - Server incoming OSC cues port 4559
[GUI] - port: 4559 [OK]
[GUI] - Scsynth port 4556
[GUI] - port: 4556 [OK]
[GUI] - Server OSC out port 4558
[GUI] - GUI OSC out port 4557
[GUI] - Scsynth send port 4556
[GUI] - Erlang router port 4560
[GUI] - port: 4560 [OK]
[GUI] - OSC MIDI out port 4561
[GUI] - port: 4561 [OK]
[GUI] - OSC MIDI in port 4562
[GUI] - port: 4562 [OK]
[GUI] - Init script completed
[GUI] - using default editor colours
[GUI] - launching Sonic Pi Server:
[GUI] - starting UDP OSC Server on port 4558...
[GUI] - UDP OSC Server ready and listening
[GUI] - Ruby server pid registered: 1147
[GUI] - waiting for Sonic Pi Server to boot...
............................................................
[GUI] - Critical error! Could not boot Sonic Pi Server.
[GUI] - stopping UDP OSC Server...
[GUI] - UDP OSC Server no longer listening
Server Errors
$HOME/.sonic-pi/log/server-errors.log
libc++abi.dylib: terminating
/Applications/Sonic Pi.app/app/server/ruby/vendor/sys-proctable-1.1.3/lib/darwin/sys/proctable.rb:163: warning: constant ::Fixnum is deprecated
Server Output
$HOME/.sonic-pi/log/server-output.log
Sonic Pi server booting...
Using protocol: udp
Detecting port numbers...
Send port: 4558
Listen port: 4557
- OK
Scsynth port: 4556
- OK
Scsynth send port: 4556
- OK
OSC cues port: 4559
- OK
Erlang port: 4560
- OK
OSC MIDI out port: 4561
- OK
OSC MIDI in port: 4562
- OK
Booting server...
Booting Sonic Pi
----------------
Boot - Booting on OS X
Boot - Checkout audio rates on OSX:
Boot - Input audio rate: 16000.0
Boot - Output audio rate: 48000.0
Boot - Audio input and output rates do not match.
Boot - Attempting to set the input rates to match output rate of 48000.0...
Boot - Starting the SuperCollider server...
Boot - /Applications/Sonic Pi.app/app/server/native/scsynth -u 4556 -a 1024 -m 131072 -D 0 -R 0 -l 1 -i 16 -o 16 -U /Applications/Sonic Pi.app/app/server/native/supercollider/plugins/ -b 4096 -B 127.0.0.1
Scsynth Output
$HOME/.sonic-pi/log/scsynth.log
# Starting SuperCollider 2018-11-07 13:14:43
Found 0 LADSPA plugins
Number of Devices: 5
0 : "AirPods"
1 : "AirPods"
2 : "Built-in Microph"
3 : "Built-in Output"
4 : "Crestron Audio"
ERROR: Input sample rate is 16000, but output is 48000. Mismatched sample rates are not supported. To disable input, set the number of input channels to 0.
could not initialize audio.
Process Log
$HOME/.sonic-pi/log/processes.log
Clearing pids: []
No pids to clear :-)
Started [1147] [-] /Applications/Sonic Pi.app/Contents/MacOS/../../app/server/native/ruby/bin/ruby --enable-frozen-string-literal -E utf-8 /Applications/Sonic Pi.app/Contents/MacOS/../../app/server/ruby/bin/sonic-pi-server.rb -u 4557 4558 4556 4556 4559 4560 4561 4562 [-] /var/folders/w_/m780j_2d2kb8_5p2cz1dcvpw0000gp/T/sonic-pi-pids/1147
Hi hectorinx If you look at the server output log you can see the cause of the problem. There is a disaparity between the input and output audio rates. Sonic Pi (or rather the Super Collider scsynth it uses) require the rates to be the same. This solution https://github.com/samaaron/sonic-pi/issues/1512 might work in your case.
I found a workaround, documented in #1471, included here.
I found a workaround for using Apple Airpods on a Mac laptop with SonicPi at full 48khz without using Audio Midi Setup.app. This may work for other Bluetooth headphones!
If you set the Output audio to Airpods, and the audio Input to the internal speaker, Sonic Pi will boot just fine.
See:
Audio Output

Audio Input

Logs
Boot - Booting on OS X
Boot - Checkout audio rates on OSX:
Boot - Input audio rate: 44100.0
Boot - Output audio rate: 48000.0
Boot - Audio input and output rates do not match.
Boot - Attempting to set the input rates to match output rate of 48000.0...
Boot - Input audio rate now: 48000.0
Boot - Output audio rate now: 48000.0
Boot - Starting the SuperCollider server...
Boot - /Applications/Sonic Pi.app/app/server/native/scsynth -u 4556 -a 1024 -m 131072 -D 0 -R 0 -l 1 -i 16 -o 16 -U /Applications/Sonic Pi.app/app/server/native/supercollider/plugins/ -b 4096 -B 127.0.0.1
Hope this helps someone else!
Originally posted by @garrow in https://github.com/samaaron/sonic-pi/issues/1471#issuecomment-466647165
@garrow this worked for me, thanks!
@garrow How do you set the output audio to a bluetooth speaker? (I am using a Linux Raspberry Pi.)