Go bindings for ALSA
Make sure you have the development headers installed:
$ sudo apt install libasound2-dev -y
$ sudo pacman -S alsa-lib -y
$ sudo dnf install alsa-lib-devel -y
$ go get -u github.com/Binozo/GoAlsa
package main
import (
"github.com/Binozo/GoAlsa/pkg/alsa"
)
func main() {
//hw:<CARD_NR>,<DEVICE_NR>
device, err := alsa.NewPlaybackDevice("hw:0,0", alsa.Config{
Channels: 2,
Format: alsa.FormatS16LE,
SampleRate: 48000,
})
if err != nil {
panic(err)
}
defer device.Close()
}