Skip to content

Instantly share code, notes, and snippets.

@marinat
Created July 25, 2019 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marinat/f1f14b61b8cdb070c0d1be14f06e93bd to your computer and use it in GitHub Desktop.
Save marinat/f1f14b61b8cdb070c0d1be14f06e93bd to your computer and use it in GitHub Desktop.
func main() {
PlayFade()
}
func PlayFade() {
sr := beep.SampleRate(44100)
speaker.Init(sr, sr.N(time.Second/10))
go pf(track1)
go pf(track2)
}
func pf(path string) {
f, err := os.Open(path)
if err != nil {
log.Fatal(err)
}
streamer, _, err := mp3.Decode(f)
if err != nil {
log.Fatal(err)
}
speaker.Play(streamer)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment