spotify-connect-web icon indicating copy to clipboard operation
spotify-connect-web copied to clipboard

Redirect Sound to FIFO

Open bjwelker opened this issue 8 years ago • 6 comments

Is it possible to redirect the Sound output to a fifo so spotify-connect-web could be used with https://github.com/badaix/snapcast for multiroom audio ?

bjwelker avatar Mar 29 '16 10:03 bjwelker

I'll see about adding a FIFO output option, but in the meantime you can try adding something like this to /etc/asound.conf

pcm.!default {
    type file               # File PCM
    slave.pcm "hw:0,0"      # This should match the playback device at /proc/asound/devices
    file /tmp/audio         # Output filename
    format raw              # File format ("raw" or "wav")
    perm 0666               # Output file permission (octal, def. 0600)
}

(From http://ninetimes.cat-v.org/tips/2008/07/11/1_Redirecting_audio_output_over_a_network_with_Inferno/)

Fornoth avatar Mar 29 '16 23:03 Fornoth

I came up with the same solution in the night :) Thanks. A FiFo output would be nice cause snapcast doing a great job on sync audio

bjwelker avatar Mar 30 '16 05:03 bjwelker

Hello everyone.

I just want to mention, that I had a problem if I define pcm.!default like stated above, because default seems already beeing taken by the standard configuration in raspbian on a raspberry 2.

My solution for snapcast is pcm.!snapcast like in my post https://github.com/badaix/snapcast/issues/45.

Have a nice day with multi-room spotify!

B.

lakeconstance78 avatar Jul 28 '16 08:07 lakeconstance78

Hi,

i used the asound.conf posted above. I get really distorted sound in snapcast. I "debugged" as written here: https://github.com/badaix/snapcast/issues/59 When I used aplay and asound sample rate 44100, the sound was like I hear the output from spotify-connect. So I resetted to default 48000, but sound played from spotify is still distorted. Any ideas? I would appreciate some guesses, how to proceed.

thanks

twenta avatar Sep 19 '16 22:09 twenta

Does anybody know how to make it work with the chroot version? It seems snapserver is writing to my system's /tmp/snapfifo, but when I start the chroot version, it starts writing to my new chroot /etc/snapfifo, that is not a FIFO, just a regular file.

Thanks in advance!

c0da avatar Sep 30 '16 10:09 c0da

@coda4k just put the fifo inside the chroot For example, if your chroot is at ~/spotify-connect-web-chroot/, then put it at ~/spotify-connect-web-chroot/etc/snapfifo on the host, and /etc/snapfifo in the chroot

Fornoth avatar Oct 02 '16 05:10 Fornoth