Author Topic: Same Reverb for many streams  (Read 299 times)

rv

  • Posts: 188
Same Reverb for many streams
« on: 15 Oct '16 - 21:10 »
Hello, I am using a vst reverb on bassmidi synth and tune the reverb of each midi channel
I am also using some vst instruments that are mixed together with a bassmixer

I would like to use the same vst reverb used by the bassmidi synth for the vst synths.

Is it possible to send an amount of the vst audio stream out to the bassmidi reverb?


I am using high quality reverb with high CPU need, and I like to have only ONE reverb for all the instruments, and only send more or less to the reverb

Maybe with some splitters , mixers and be able to mix some sound with the actual bassmidi reverb handle... ???

Ian @ un4seen

  • Administrator
  • Posts: 20286
Re: Same Reverb for many streams
« Reply #1 on: 17 Oct '16 - 17:20 »
It sounds like you're using BASS_MIDI_StreamGetChannel with BASS_MIDI_CHAN_REVERB and applying a VST effect to the returned channel, and now you want to apply the same effect instance to some VST instruments? I haven't tried it myself, but that may be possible by using a DSP function to mix the VST instruments with the data from BASSMIDI before applying the VST effect, ie. the DSP would have a higher "priority" setting than the VST effect. You could use a "push" stream and a BASSmix mixer to do the mixing, something like this:

Code: [Select]
reverbchan=BASS_MIDI_StreamGetChannel(midi, BASS_MIDI_CHAN_REVERB); // get MIDI stream's reverb channel
reverbmixer=BASS_Mixer_StreamCreate(freq, chans, BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE); // create mixer with same format as reverb channel (always floating-point)
pushstream=BASS_StreamCreate(freq, chans, BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE, STREAMPROC_PUSH, NULL); // create push stream with same format
BASS_Mixer_StreamAddChannel(reverbmixer, pushstream, 0); // plug it into the mixer
// plug VST instruments into the mixer here

BASS_ChannelSetDSP(reverbchan, MixDSP, NULL, 2); // set DSP on reverb handle
// set VST effect on reverbchan with lower "priority" value here

...

void CALLBACK MixDSP(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user)
{
BASS_StreamPutData(pushstream, buffer, length); // pass data to push stream
BASS_ChannelGetData(reverbmixer, buffer, length); // get data back from mixer
}

Note that the VST instrument's level will be affected by the MIDI_EVENT_REVERB_LEVEL setting then, as it's going through the MIDI's reverb channel.

rv

  • Posts: 188
Re: Same Reverb for many streams
« Reply #2 on: 5 Sep '17 - 01:04 »
Hello Ian...
Thank you for this code...  I finally tried it.  It works, but some crakles ... Need to understand more

What I need is that I can decide the amount of the VSTi sound to go to the reverb
So I think I need to add a splitter on the VSTi stream that goes to the reverb mixer, with a volume parameter

Not sure if I need 2 splitters. One for DRY and one for WET, or if I can use the source as DRY (as before) and the splitter as WET
Also I don't know why I have crackles. Is it possible that the splitter is adding some latency, and that VSTi can't be played in realtime anymore

Or maybe the bassmidi reverb DSP is asking data to the VSTi through the reverbmixer, but the VSTi is always a bit late after the bassmidi stream ?

Ian @ un4seen

  • Administrator
  • Posts: 20286
Re: Same Reverb for many streams
« Reply #3 on: 5 Sep '17 - 15:59 »
What I need is that I can decide the amount of the VSTi sound to go to the reverb
So I think I need to add a splitter on the VSTi stream that goes to the reverb mixer, with a volume parameter

Not sure if I need 2 splitters. One for DRY and one for WET, or if I can use the source as DRY (as before) and the splitter as WET

You would need 2 splitters in that case. When using splitters, all access to the source data should be through a splitter, ie. you shouldn't get data from the source directly. Any data that is taken directly from the source won't be available to the splitter(s).

Also I don't know why I have crackles. Is it possible that the splitter is adding some latency, and that VSTi can't be played in realtime anymore

A splitter won't add any latency unless you have multiple splitters on the same source and they are drifting apart; those left behind will need to get the buffered data before they get fresh data. You can use BASS_Split_StreamGetAvailable to check how much buffered data there is.

What output buffer size are you using and does increasing that help?

rv

  • Posts: 188
Re: Same Reverb for many streams
« Reply #4 on: 5 Sep '17 - 16:25 »
Yes they drift appart.
I am using a buffer of 256 samples with WASAPI Exclusive Event
Is it possible for the splitter to not buffer anything.
It just copy what is ACTUALLY inside the source buffer for the 2 splits

Maybe I need to reset the splitter every time I can't provide enough data, so the splitter will not always be late as it is always trying to run after the bass midi synth

Do I need to set the SLAVE flag on the 2nd split?

Any other ideas?

Ian @ un4seen

  • Administrator
  • Posts: 20286
Re: Same Reverb for many streams
« Reply #5 on: 5 Sep '17 - 18:02 »
When multiple splitters have the same source, buffering is needed to allow all of the splitters to receive the data. The buffering doesn't add any latency so long as none of the splitters drift behind. You probably don't want to reset a splitter during playback, as that will result in data being skipped, resulting in an audible glitch.

rv

  • Posts: 188
Re: Same Reverb for many streams
« Reply #6 on: 5 Sep '17 - 18:08 »
And how to avoid the first DRY stream and the second WET stream to drift appart?
Maybe one glitch is better than infinite drifting?

Ian @ un4seen

  • Administrator
  • Posts: 20286
Re: Same Reverb for many streams
« Reply #7 on: 5 Sep '17 - 18:14 »
You can avoid drifting by making sure that both splitters take data at exactly the same rate.

If there is drifting and you decide to use resetting to cancel it, you would presumably need to do that repeatedly; if they drift once, they will probably drift again. Which means there would be multiple audible glitches, not just one. A better way to correct drifting is to adjust the playback rate, eg. slightly speed up a splitter that is getting left behind.