[GH-ISSUE #63] cmd/streamer websocket server #49

Closed
opened 2026-02-28 14:24:57 +03:00 by kerem · 1 comment
Owner

Originally created by @dannyherrmann on GitHub (Aug 16, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/63

I understand this is a newer project since librespot-java is no longer in active development. But for the fun of it I’d like to propose a very low priority (potentially large sized?) enhancement:

  • a new module, cmd/streamer, that outputs PCM data to a WebSocket instead of the system's audio output. The server would announce itself on the local network, similar to the existing daemon. When a user selects the go-librespot device from any Spotify client and plays a track, the streamer module would decode the audio and stream the raw PCM data in real-time via the WebSocket connection.

Use Case:
This could enable Spotify streaming on older devices that cannot run librespot. I’m particularly interested in implementing this to create a Spotify client for older PowerPC Macs. While go-librespot cannot run on these older machines, the proposed streamer module would allow a client on such devices to connect and retrieve the raw PCM audio data via the websocket connection, which could then be output via an appropriate audio library.

This type of functionality may not belong in go-librespot and could very well be a separate application. I'm open to feedback here, but I believe it could potentially complement the existing project and broaden its use case.

The initial prototype / POC would involve the WebSocket server receiving a Spotify track ID and beginning to stream the raw PCM data.

Librespot-python did something similar

I'll be working on this on my own fork.

Originally created by @dannyherrmann on GitHub (Aug 16, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/63 I understand this is a newer project since librespot-java is no longer in active development. But for the fun of it I’d like to propose a very low priority (potentially large sized?) enhancement: - a new module, cmd/streamer, that outputs PCM data to a WebSocket instead of the system's audio output. The server would announce itself on the local network, similar to the existing daemon. When a user selects the go-librespot device from any Spotify client and plays a track, the streamer module would decode the audio and stream the raw PCM data in real-time via the WebSocket connection. **Use Case:** This could enable Spotify streaming on older devices that cannot run librespot. I’m particularly interested in implementing this to create a Spotify client for older PowerPC Macs. While go-librespot cannot run on these older machines, the proposed streamer module would allow a client on such devices to connect and retrieve the raw PCM audio data via the websocket connection, which could then be output via an appropriate audio library. This type of functionality may not belong in go-librespot and could very well be a separate application. I'm open to feedback here, but I believe it could potentially complement the existing project and broaden its use case. The initial prototype / POC would involve the WebSocket server receiving a Spotify track ID and beginning to stream the raw PCM data. Librespot-python did something [similar](https://github.com/kokarare1212/librespot-python/blob/main/examples/server/main.py) I'll be working on this on my own fork.
kerem 2026-02-28 14:24:57 +03:00
Author
Owner

@dannyherrmann commented on GitHub (Feb 9, 2026):

@devgianlu I wanted to follow up on my previous enhancement request regarding WebSocket PCM streaming. I don't think it's needed and I will go ahead and close this as not planned. After working through the problem, I've found that go-librespot's existing pipe output (--output-pipe) combined with a simple Python TCP server completely solves my use case for streaming to vintage PowerPC Macs.

  • go-librespot writes raw PCM to a Unix pipe
  • A lightweight Python script reads from the pipe and broadcasts over TCP
  • Clients (like my PowerPC Mac running Tiger) connect via TCP and receive the audio stream
  • The separation of concerns keeps go-librespot focused on Spotify decoding, while networking is handled externally

This approach has worked flawlessly and is actually more flexible than my original WebSocket proposal-any client that can handle TCP can connect, and the pipe output is already a stable feature of go-librespot.

<!-- gh-comment-id:3873153801 --> @dannyherrmann commented on GitHub (Feb 9, 2026): @devgianlu I wanted to follow up on my previous enhancement request regarding WebSocket PCM streaming. I don't think it's needed and I will go ahead and close this as not planned. After working through the problem, I've found that go-librespot's existing pipe output (--output-pipe) combined with a simple Python TCP server completely solves my use case for streaming to vintage PowerPC Macs. - go-librespot writes raw PCM to a Unix pipe - A lightweight Python script reads from the pipe and broadcasts over TCP - Clients (like my PowerPC Mac running Tiger) connect via TCP and receive the audio stream - The separation of concerns keeps go-librespot focused on Spotify decoding, while networking is handled externally This approach has worked flawlessly and is actually more flexible than my original WebSocket proposal-any client that can handle TCP can connect, and the pipe output is already a stable feature of go-librespot.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#49
No description provided.