Clearing the buffer of a delay/reverb on playback?

Hi guys,

What’s the proper way for clearing the buffer of a delay/reverb on playback? I have some large buffers that need to be cleared at every playback to avoid overlapping tails. What’s the Best practice?

in your prepareToPlay() ?

prepareToPlay() is not called at every hit on the play button in the DAW. Some hosts do, some don’t.

I’ve used AudioPlayHead::CurrentPositionInfo to check for play/stop states, but I’d like to know if there’s a best practice for clearing the buffer. Right now I’m doing a simple buffer.clear() in a separate thread with same basic checks before processing audio, but I’m not sure if it’s the best approach.

1 Like

You could monitor the play state and clear your stuff when it starts/stop. But TBH I think as a DAW user I wouldn’t expect effects to suddenly cut off their tail when I start/stop playback. That’s not what’d happen with real outboard effect units.

I don’t know. Imagine you have a nice 60 second verb going on your super-drone music … now stopping on Stop seems a bit harsh,but if you jump back in the track and hit play from the beginning I think I’d expect it to STFU :slight_smile:

Yeah, the clear should only happen at every start, not stop. Many delays and reverbs do that, I’m just not sure what’s the best approach.

Using a separate thread and some basic checks seems to work ok, but I don’t want to reinvent the wheel :slight_smile:

This!!

Rail

1 Like

I love the way you two are calling them ‘real outboard effects’ as if in-the-box is some weird place where we try and emulate the past :wink:

I don’t like that either, but most users (for my experience) just doesn’t like to wait the tail to decay if they just checked a part of the song and then want to bounce. as devs we cannot take that for granted and we should, at least, offer behavioral options. my 2 cents

It’s bit cruel making them wait when feedback goes to 100% too…

When a DAW bounces/renders something, it’ll certainly call reset() on the plugin before starting, or even create a new instance.

This! :slight_smile:

Honestly, I don’t like it either, but many users requested this feature. Most of the big delays and reverbs plugins do that, it’s almost an expected feature.

Since I’ve ran into the same problem, I write here my solution in case someone else will need it in the future.

In my processBlock I have:

getPlayHead()->getCurrentPosition(info);
if (info.isPlaying && !playingState) resetFX();
playingState = info.isPlaying;

where info is the struct with playing/stop information (CurrentPositionInfo), and playingState is a simple boolean. By doing this I reset my fx (clear delay/reverb buffers) only when the playback starts (so when the state changes from stopped to playing) while the tails on stop are preserved. With the same approach it is possible also to clear the buffers also on stop, truncating the tails.

2 Likes