Skip to content

Instantly share code, notes, and snippets.

@stjohnjohnson
Last active December 9, 2019 04:20
Show Gist options
  • Save stjohnjohnson/e84bb52805e83b170fe6bc989ad9d8eb to your computer and use it in GitHub Desktop.
Save stjohnjohnson/e84bb52805e83b170fe6bc989ad9d8eb to your computer and use it in GitHub Desktop.
Reproducing a potential bug in faiface/beep
module github.com/stjohnjohnson/reproduce-bug
go 1.13
require github.com/faiface/beep v1.0.2
package main
import (
"log"
"os"
"time"
"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
)
func main() {
f, err := os.Open("../Lame_Drivers_-_01_-_Frozen_Egg.mp3")
if err != nil {
log.Fatal(err)
}
streamer, format, err := mp3.Decode(f)
if err != nil {
log.Fatal(err)
}
defer streamer.Close()
speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))
done := make(chan bool)
speaker.Play(beep.Seq(streamer, beep.Callback(func() {
done <- true
})))
<-done
}
default:
-@make local
-@make docker
local:
@echo Running locally
GOOS=linux GOARCH=amd64 go build
docker:
@echo Running in Docker
docker run --rm -v`pwd`:/src -w /src -e CGO_ENABLED=0 golang:1.13 go build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment