melodix

music

Queue-based music playback library for Go with pluggable audio sinks and track resolvers. Resolves URLs and search queries (YouTube, SoundCloud, radio), opens PCM streams via multiple parsers (yt-dlp, kkdai, ffmpeg), and plays through a sink of your choice (e.g. speaker or custom Discord voice).

Install

go get github.com/keshon/melodix/pkg/music/...

Quick start

Create a sink provider (e.g. speaker for local playback), a resolver, and a player; then enqueue and play:

provider := sink.NewSpeakerProvider()
defer provider.Close()

res := resolver.New()
p := player.New(provider, res)

// Enqueue a URL or search query, then start playback
_ = p.Enqueue("https://www.youtube.com/watch?v=...", "", "")
_ = p.PlayNext("")  // "" for local; use voice channel ID for Discord

Listen to p.PlayerStatus for status updates (Playing, Added, Stopped, Error). See examples/cli_speaker for a full runnable CLI.

Requirements

Documentation

License

music is licensed under the MIT License.