Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
I just converted the []float32 to []byte (see function below) and it works. But the sound produced while recognizable is very staticy and I don't know why. func floats32ToBytes(fs []float32) []byte { var buf bytes.Buffer for _, f := range fs { if err := binary.Write(, binary.LittleEndian, f);

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
I've now tried using those libraries, but there seems to be an incompatibility []float32 vs []byte. Here's the error: ./play.go:24:29: cannot use reader (variable of type *oggvorbis.Reader) as io.Reader value in argument to otoCtx.NewPlayer: *oggvorbis.Reader does not implement io.Reader

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
Thank you, I'll try them. (Well, for oto I'll try https://pkg.go.dev/github.com/hajimehoshi/oto/v2 since that seems to have more importers) On Wednesday, November 22, 2023 at 10:31:25 PM UTC Raffaele Sena wrote: > I have used github.com/jfreymuth/oggvorbis to read the ogg file (and > convert

Re: [go-nuts] a simple linux audio player pkg?

2023-11-22 Thread Raffaele Sena
I have used github.com/jfreymuth/oggvorbis to read the ogg file (and convert to PCM) and github.com/ebitengine/oto/v3 to play the PCM. I don't know of a full ogg player in Go On Wed, Nov 22, 2023 at 2:02 PM 'Mark' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Is there a simple

[go-nuts] a simple linux audio player pkg?

2023-11-22 Thread 'Mark' via golang-nuts
Is there a simple vorbis/oga audio player package for Go that works on Linux. The only API I need is something like this: player.SetFilename(string) error // string is say tune.ogg; stops playing previous if any player.Play(float32) error // plays current filename from given second e.g. 0.0