mirror of
https://github.com/devgianlu/go-librespot.git
synced 2026-04-26 13:25:49 +03:00
[GH-ISSUE #155] Output to pipe? #95
Labels
No labels
bug
enhancement
pull-request
spotify-side
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-librespot#95
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @praul on GitHub (Dec 29, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/155
Hi there and thanks for your work.
I have been using librespot-java for quite a long time now. With development discontinued I would like to switch to this build.
However, I need the possibility to output audio to a pipe file, since I am using this in a stack with snapserver.
Am I missing a configuration option? Would this be possible to implement? I'd rather not go the route of configuring fake-audio-devices rather than having it implemented direct into go-librespot.
Thanks for consideration
@devgianlu commented on GitHub (Dec 29, 2024):
That was missing indeed, but should be implemented now!
I have tested it by creating a pipe with
mkfifo /tmp/spotify.fifoand using ffmpeg to play:For go-librespot use the following configuration:
Let me know if this works for you!
@joussy commented on GitHub (Dec 30, 2024):
Hi ! Pipe output works fine using ffplay, except there is a delay when pausing. Maybe the buffer isn't flushed when it's paused ?
@praul commented on GitHub (Dec 30, 2024):
That was fast. Unfortunately it is not working for me (as a drop in replacement). Sound from the pipe (over snapserver, https://github.com/badaix/snapcast) is only distortion.
I cannot test directly on server since it has no audio connected to it.
Is go-librespot somehow using other codec/samplerate than librespot-java?
The only way I can configure snapserver is like 44100:16:2 and its expecting raw pcm..
Maybe you have an idea?
@devgianlu commented on GitHub (Dec 30, 2024):
I think the delay is caused by ffmpeg having an internal buffer that cannot be flushed. go-librespot stops writing to pipe immediately after pause is pressed.
I did not remember that librespot-java used 16-bit signed int, go-librespot uses 32-bit float so that surely is a problem. Are you able to reconfigure snapserver?
@praul commented on GitHub (Dec 30, 2024):
Unfortunately I don't think so. I can set it to 32bit, but as far as I can tell, snapcast does not support float pcm audio.
Is there a way for go-librespot to output 16bit signed int pcm? I think it would be the most compatible format.
Snapcast Docs states:
The PCM samples (bit depth) must be encoded signed, little endian in 8, 16, 24, or 32 bit, where 24 is expected to be encoded in the lower three bytes of a 32 bit word.librespot-org offers format feature, but your builds were always more stable, and I am actively using the api, so if its possible, would be much appreciated
@devgianlu commented on GitHub (Dec 31, 2024):
I have added the
audio_output_pipe_formatoption. Tested withs16leandffplay -f s16le -ar 44100 -ch_layout stereo pipe: < /tmp/spotify.fifo.@praul commented on GitHub (Jan 1, 2025):
It's working great now (and it's so fast). Big thanks, really great support
@iVolt1 commented on GitHub (Jan 1, 2025):
Hi. Will metadata be output to a pipe as it is in librespot-java in a future enhancement?
@devgianlu commented on GitHub (Jan 2, 2025):
@iVolt1 Why not! Please open a separate issue to track this.
@eoware commented on GitHub (Jan 11, 2025):
@praul -- I am thinking of moving from the original librespot to this library for snapserver, could you share your snapserver cli command to start librespot-go? Are you using events? Do you have multiple instances running?
@FrancisHGR commented on GitHub (Jan 14, 2025):
Hey guys, amazing project. However with mkfifo and the configuration in the config.yml as described above, I get the following error:
WARN[0006] failed handling dealer request error="failed loading current track (transfer): failed setting stream for spotify:track:56hg2LjYQ9RFp5ffnUPetE: unknown audio backend: pipe"
Any help?
@FrancisHGR commented on GitHub (Jan 15, 2025):
Okay I think I got it, v0.1.3 hasn't included the pipe to audio backend feature...
built it now from source and is running. However unfortunately I can connect to the the go-librespot spotify connect device, but when I press play on the phone the connection disappears and go-librespot spotify connect is not reachable anymore. It seems to be unstable.
@devgianlu commented on GitHub (Jan 15, 2025):
Please open a separate issue including the logs
@jangerhard commented on GitHub (Aug 27, 2025):
https://github.com/devgianlu/go-librespot/issues/157
Any progress on this?