faiface / beep

A little package that brings sound to any Go application. Suitable for playback and audio-processing.
MIT License
2.08k stars 152 forks source link

fatal error: all goroutines are asleep - deadlock! #13

Closed Doug-AWS closed 6 years ago

Doug-AWS commented 6 years ago

I must have done something wrong in the order of operations. Here's my code to listen to myfile.mp3:

f, _ := os.Open("myfile.mp3)
s, format, _ := mp3.Decode(f)

speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))

done := make(chan struct{})

speaker.Play(beep.Seq(s, beep.Callback(func() {
    close(done)
})))

<-done
faiface commented 6 years ago

Your code works perfectly fine on my machine when I copied it inside a stock main function. There must be something else wrong. Providing full source and a full deadlock message would be helpful.

Doug-AWS commented 6 years ago

Hmm, seems to be working now, although it only supports MPEG1, dang!

DWiechert commented 4 years ago

Just writing this in case anyone else has this error.

I too was struggling with the error mentioned above and it turned out that my speakers were disabled. Not sure why this deadlock message popped up for this scenario, however once I re-enabled my speakers the above worked fine.