sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.75k stars 918 forks source link

No output to bluetooth speakers #1471

Closed rtalwarhike closed 6 years ago

rtalwarhike commented 7 years ago

Hi, I am unable to output sonic pi(v2.10) (mac) to a connected bluetooth speaker. No sound on bluetooth speakers or headphones.

Although The sound through 3.5mm connected wire works fine.

samaaron commented 7 years ago

I don't have any bluetooth speakers to test with - so it's impossible for me to reproduce and fix this.

Do you have to select the bluetooth speakers in the system preferences first? If you do - and you select it and restart Sonic Pi - what happens?

rtalwarhike commented 7 years ago

When I restarted Sonic Pi with bluetooth headphone connected , I got this error and failed to start Sonic Pi -

Sonic Pi Boot Error Report

System Information

GUI Log

/Users/rohittalwar/.sonic-pi/log/gui.log

[GUI] - using default editor colours
[GUI] - starting UDP OSC Server on port 4558...
[GUI] - UDP OSC Server ready and listening
[GUI] - shutting down any old audio servers...
[GUI] - booting live coding server
[GUI] - waiting for server to boot...
.[GUI] - server failed to start with this error message: 
      > Server Exception:
 Unable to boot sound synthesis engine: the input and output rates of your audio card are not the same. Got in: 8000.0, out: 44100.0.
...........................................................
[GUI] - Critical error! Could not boot server.

Server Errors

/Users/rohittalwar/.sonic-pi/log/server-errors.log

Failed to start server: Unable to boot sound synthesis engine: the input and output rates of your audio card are not the same. Got in: 8000.0, out: 44100.0.
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/scsynthexternal.rb:331:in `rescue in boot_server_osx'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/scsynthexternal.rb:305:in `boot_server_osx'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/scsynthexternal.rb:183:in `boot'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/scsynthexternal.rb:29:in `initialize'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/server.rb:73:in `new'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/server.rb:73:in `initialize'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/studio.rb:102:in `new'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/studio.rb:102:in `init_studio'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/studio.rb:43:in `initialize'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/lang/sound.rb:123:in `new'
/Applications/Sonic Pi.app/app/server/sonicpi/lib/sonicpi/lang/sound.rb:123:in `block (2 levels) in included'
/Applications/Sonic Pi.app/Contents/MacOS/../../app/server/bin/sonic-pi-server.rb:99:in `new'
/Applications/Sonic Pi.app/Contents/MacOS/../../app/server/bin/sonic-pi-server.rb:99:in `<main>'

Server Output

/Users/rohittalwar/.sonic-pi/log/server-output.log

Sonic Pi server booting...
Using protocol: udp
Server is exiting.
Shutting down GUI...
Goodbye :-)

Scsynth Output

/Users/rohittalwar/.sonic-pi/log/scsynth.log

# Starting SuperCollider 2016-11-15 14:34:28
Found 0 LADSPA plugins
Number of Devices: 2
   0 : "Built-in Microph"
   1 : "Built-in Output"

"Built-in Microph" Input Device
   Streams: 1
      0  channels 2

"Built-in Output" Output Device
   Streams: 1
      0  channels 2

SC_AudioDriver: sample rate = 44100.000000, driver's block size = 512
SuperCollider 3 server ready.
samaaron commented 7 years ago

Please could you try this with the latest release for macOS - v2.11

rtalwarhike commented 7 years ago

Latest release is not getting installed on my mac , It keeps giving me error that `allow applications to run from unidentified developer' even if I go and give it permissions from System Pref -> Privacy

samaaron commented 7 years ago

https://support.apple.com/en-gb/KM205142?cid=acs::applesearch

rtalwarhike commented 7 years ago

Thanks I was able to open latest version but that too crashed with the same error.

samaaron commented 7 years ago

Unfortunately there's nothing we can do about this, many apologies.

rtalwarhike commented 7 years ago

Thanks, btw, an exceptionally great app, thanks for bringing music to coders like me.

samaaron commented 7 years ago

Thanks for the kind words - and many apologies again that it doesn't work with your bluetooth speakers. I hate not having a positive answer!

llloret commented 7 years ago

Hi, @rtalwarhike, can you go to the folder where scsynth executable is located and try to run the following?: scsynth -S 44100 -u 57120

Then let us know what the output is. Thanks

rtalwarhike commented 7 years ago
Found 0 LADSPA plugins
*** ERROR: open directory failed '/Users/rohittalwar/Library/Application Support/SuperCollider/synthdefs'
Number of Devices: 4
   0 : "Built-in Microph"
   1 : "Built-in Output"
   2 : "SB2 Wireless"
   3 : "SB2 Wireless"

Requested sample rate 44100.000000 was not available - attempting to use sample rate of 8000.000000
"SB2 Wireless" Input Device
   Streams: 1
      0  channels 1

"SB2 Wireless" Output Device
   Streams: 1
      0  channels 1

SC_AudioDriver: sample rate = 8000.000000, driver's block size = 512
PublishPortToRendezvous 0 8415
SuperCollider 3 server ready.
btbuxton commented 6 years ago

I ran into this issue recently as well and was wondering what would be some tips to debug it? I would imagine it's a problem in the supercollider library?

Not having bluetooth is not super important, but I'm curious why this would be happening.

samaaron commented 6 years ago

@btbuxton the issue is that SuperCollider requires the input and output audio card rates to be identical. Unfortunately most bluetooth devices have microphones which are at a much lower rate (often something like 8000 rather than 44100).

In the future I hope to include an ability to select different audio cards and rates in the app and to also disable the input if the rates don't match (which should at least allow you to make sounds!).

However, for now you either need to manually ensure the rates are the same. This is possible via the app 'Audio MIDI Setup'.

Closing this for now, but please feel free to open a new issue if you're still having problems :-)

garrow commented 5 years ago

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

image

Audio Input

image

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!

fredguth commented 4 years ago

I can confirm that following @garrow suggestion it has worked with Bluetooth headphones.

samaaron commented 4 years ago

@fredguth great you got things working, but this extra work shouldn't be necessary in v3.2.2 as we made some improvements.

If you don't do these manual steps cant you get things to boot automatically?

fredguth commented 4 years ago

@samaaron No, I can't. I am using SonicPi v3.2.2 and OSX Catalina 10.15.5

1)If I am using my headphones with Bluetooth and start Sonic Pi, it detects automatically. 2)If I turn on my headphones and connect to mac Bluetooth while SonicPi is already opened, it does not detect my headphones. Even though I can hear other software (YouTube, Spotify, etc). 2.a) If I do @garrow suggestion, headphones work; or without changing audio settings 2.b) If I then quit and reopen SonicPi, it detects the Bluetooth headphone

MJP8 commented 3 years ago

@samaaron I am having the same problem but I'm using the Linux Raspberry Pi so I'm not sure if this will work. I'm using SonicPi v3.1 but when I try to update it it says I have the latest version.

ethancrawford commented 3 years ago

Hi @MJP8, your issue is entirely different to the above bluetooth problem (or at least, not entirely limited to it): Heh. Well, I'm wrong about that ^ - you're right about seeing a bluetooth problem. However, it's still strongly recommended to update Sonic Pi to the latest version if you can. Sonic Pi v3.1 that came bundled with Raspbian Buster is an build attempted by the Raspberry Pi foundation outside of our control, which is not fully functional. There's a little more detail here if you are interested: https://in-thread.sonic-pi.net/t/sonic-pi-3-1-now-on-raspbian-buster-not-fully-working/2758).

Robin Newman has kindly built an updated package for the latest version, Sonic Pi 3.3.1: Please go to https://sonic-pi.net/ for the link. (Note that I think you need the latest version of Buster to run it).

MJP8 commented 3 years ago

Thanks @ethancrawford. I updated Sonic Pi but it still wouldn't work. I don't need any urgent help because the speakers don't play any sound on my computer now.

Asethon commented 2 years ago

Same problem in linux(KDE Neon 5.23.4).

ethancrawford commented 2 years ago

@Asethon - what version of Sonic Pi are you trying to run?

Asethon commented 2 years ago

@Asethon - what version of Sonic Pi are you trying to run?

Latest version from flatpak: 3.3.1

ethancrawford commented 2 years ago

Sure. Other than knowing you have a problem with Bluetooth speakers and are using a flatpak version, it is not yet clear what the possible root cause is without possibly knowing more information. The log files are usually helpful for this - so we may be able to troubleshoot further if you are able to provide them. (From .sonic-pi in your home directory). It may be worth opening up a new issue however to avoid further distracting the folks that originally commented on this ticket.

By the way, the flatpak version is built and distributed by community folks instead of the core team. It's possible, if it is a flatpak specific issue, that @hfiguiere may be helpful 👍

hfiguiere commented 2 years ago

I don't have bluetooth speaker to test, but this should be managed by your system.

Note that since SonicPi only works with JACK and JACK from flatpak only work with PipeWire-Jack, you a recent enough pipewire in the host.

Does it work with, say, headphones?