Skip to content

Latest commit

 

History

History
46 lines (39 loc) · 735 Bytes

README.md

File metadata and controls

46 lines (39 loc) · 735 Bytes

GoAlsa 🎵

Go bindings for ALSA

Installation 🚀

Make sure you have the development headers installed:

Debian/Ubuntu

$ sudo apt install libasound2-dev -y

Arch

$ sudo pacman -S alsa-lib -y

Fedora

$ sudo dnf install alsa-lib-devel -y

Now install the go package:

$ go get -u github.com/Binozo/GoAlsa

Quickstart 💫

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()
}