kallaballa / MidiPatch

MidiPatch is a scriptable and modular real-time software synthesizer using the PatchScript API
GNU Affero General Public License v3.0
12 stars 2 forks source link

Fix audio glitch on restarts #100

Closed kallaballa closed 4 years ago

kallaballa commented 4 years ago

At the moment on restart we hear a glitch on restart. That is because the audio buffer is still being played, but not filled. If we fill the buffer with silence the glitch will disappear

kallaballa commented 4 years ago

Filling with silence is the wrong approach. I found out that we can close the audio stream in two ways:

so, if we detect a restart request we simply return non-zero and the stream will close cleanly without any glitches, because it seizes to use the audio buffer before there is an underun.

kallaballa commented 4 years ago

Fixed