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

Previous audio overwritten by new audio #18

Closed FuzzyStatic closed 5 years ago

FuzzyStatic commented 6 years ago

This a question on how to implement beep so that each new audio play does not overwrite the previous one. I tried to figure it out through the documentation but my ignorance on how audio works has brought me to a roadblock.

I have a game I've been writing here, https://github.com/FuzzyStatic/shape-wars, and I've been using the example you have in the README (https://github.com/FuzzyStatic/shape-wars/blob/master/audio.go). It seems any time I play a new audio file the previous audio stops or goes silent.

Any information you can give me is greatly appreciated!

medakk commented 6 years ago

I have a similar issue. I start playing an audio stream, then after a while play a different audio stream. The playback makes weird glitchy noises and then all audio stops.

faiface commented 6 years ago

That's because you call speaker.Init every time you play something, which resets the speaker. speaker.Init should only be called once at the beginning of your program.

Sorry for the really late response.

FuzzyStatic commented 6 years ago

TY! This fixed my issue!