Last active
December 9, 2019 04:20
-
-
Save stjohnjohnson/e84bb52805e83b170fe6bc989ad9d8eb to your computer and use it in GitHub Desktop.
Reproducing a potential bug in faiface/beep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module github.com/stjohnjohnson/reproduce-bug | |
go 1.13 | |
require github.com/faiface/beep v1.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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