Skip to content
mpg123 bindings for golang
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
LICENSE
README.md
mpg123.go

README.md

Go bindings for the mpg123 mp3 decoding library

These bingings were heavily influenced by weberc2's work

Usage:

First init the library

mpg123.Initialize()

Open a file and check the error

mp3, err := mpg123.Open("example.mp3")
if err != nil {
	panic(err)
}

errors are passed verbatim from mpg123

Get the format

rate, channels, encoding, format := mp3.Format()
fmt.Printf("Rate: %i Channels: %i Encoding: %i Format: %s\n", rate, channels, encoding, format)

format is compatible with audio.Format consts

Read 100 bytes of mp3 data into a buffer

data := make([]byte, 100)
err := mp3.Read(data)

mp3 conforms to the io.Reader, io.Seeker, io.Closer interfaces, though seeking is not yet implemented.

This means it can be used quite handily with the go audio library.

You can’t perform that action at this time.