Pre-delay and reverb (how to do ?)


#1

Hello,

I’m trying to set up a reverb with pre-delay. I can not really manage it.
That’s where I am:

(
SynthDef(\rev, {|predelay=0.05, room=0.8, damp=0.5|
var rev, predel;
predel = DelayN.ar(In.ar(e), maxdelaytime:0.1, delaytime:predelay); // e is a bus
rev = FreeVerb.ar(predel, mix:0.5, room:room, damp:damp);
rev = Pan2.ar(rev, pos:0);
Out.ar(0, rev);
}).add;
)

But it does not work: both the sound and the reverb are in the delay.
How to do?

Thanks for help !


#2

The correct way to use a Bus in a SynthDef is to provide the bus number as an argument.

(
SynthDef(\test { |out = 0, in|
    var input = In.ar(in);
    Out.ar(out, input)
}).add;
)

x = Synth(\test, [\in, e]);    // e is your Bus

Try fixing this and see if it helps. Everything else looks fine at a quick glance.


#3

I realise I didn’t really answer your question @elode . Here’s one way to accomplish this (untested):

(
SynthDef(\rev, { |out=0, in, predelay=0.05, room=0.8, damp=0.5, wet=0.33|
var input, rev;
	input = In.ar(in, 1);
	rev = DelayN.ar(input, maxdelaytime:0.1, delaytime:predelay);
	rev = FreeVerb.ar(rev, mix:1, room:room, damp:damp);
	rev = (input*wet) + (rev*(1-wet));
	rev = Pan2.ar(rev, pos:0);
	Out.ar(out, rev);
}).add;
)

#4

Thank you for the reply :slight_smile: , it’s a little simpler than the solution I ended up finding:

(
e = Bus.audio(s, 1);
(SynthDef(\rev, {|in=\e, predelay=0.1, room=0.8, damp=0.5|
var rev;
rev = DelayN.ar(In.ar(in), maxdelaytime:0.3, delaytime:predelay);
rev = FreeVerb.ar(rev, mix:1, room:room, damp:damp);
Out.ar(1, rev); // the reverb goes out on bus 1 (right)
}).add;
))
~rev = Synth(\rev, addAction: \addToTail);

(
SynthDef(\sin, {|freq=440, direct=0.5|
var env, sig;
env = EnvGen.kr(Env.perc(0.01, 0.2, curve:-4),doneAction:2);
sig = SinOsc.ar(freq)*env;
Out.ar(0, sig * direct ); // the sound without reverb goes out on bus 0 (left)
Out.ar(e, sig * (1-direct)); //… and with reverb
}).add;
)

~s = Synth(\sin, [\direct, 0.5]); // adjusting the ratio between direct sound and reverberated sound

Thanks again :slight_smile: