What I’m finding is that I hear the external synth, but without the reverb. So it seems like Ndef(\mv_in) is routing its audio directly to the soundcard, and not via Ndef(\mv_reverb). Can anyone give me a hand?
Thanks for your reply, but I don’t think that’s it.
If I don’t play Ndef(\mv_in), I don’t hear anything at all. What I want to happen is that its output is routed to Ndef(\mv_reverb), which outputs the sound to the soundcard.
I think my mental model of Ndefs is not right, because I don’t seem to be getting this at all.
Okay, so if I don’t play Ndef(\mv_in), I can still call .scope on it and that shows me it’s processing audio. So the problem is that it’s not routing that audio to Ndef(\mv_reverb) for some reason.
Thank you, I gave it a try but that did not help. [Later edit: I obviously did it wrong because it does work.] I have tried using Ndef.map() to do the mapping also:
(
Ndef(\src, {
var trig = Impulse.kr(4);
var eg = EnvGen.kr(Env.perc(0.01, 0.1), trig);
var freq = TExpRand.kr(200, 800, trig);
(LFTri.ar(freq) * 0.1).dup
});
Ndef(\rvb, {
var in = NamedControl.ar(\in, 0!2);
FreeVerb2.ar(in[0], in[1], 0.4, 0.95, 0.2)
}).play;
Ndef(\rvb).set(\in, Ndef(\src));
)
Using your code, both of these work:
(
Ndef(\mv_in, {
SoundIn.ar([2,3]);
});
Ndef(\mv_reverb, {
var audio = NamedControl.ar(\audio, 0!2);
NHHall.ar(audio, 5) * 0.25 + audio;
});
)
(
Ndef(\mv_reverb).set(\audio, Ndef(\mv_in));
Ndef(\mv_reverb).play;
)
// OR:
(
Ndef(\mv_in, {
SoundIn.ar([2,3]);
});
Ndef(\mv_reverb, { |busin|
// note that In.ar should not be used with JITLib, use InFeedback instead
var audio = InFeedback.ar(busin, 2);
NHHall.ar(audio, 5) * 0.25 + audio;
});
)
(
// and, don't map to a bus-number input
// set it to the bus number directly
Ndef(\mv_reverb).set(\busin, Ndef(\mv_in).bus);
Ndef(\mv_reverb).play;
)
EDIT: Reverted to your SoundIn indices (I had needed to change them for my own testing.)
In JITLib, you don’t have control over the order of execution, so InFeedback is certainly preferable over In.
But that wasn’t the only problem.
Your reverb synth declared a control-rate input, and used it in In(Feedback). This means that the input’s value should be a bus number (and it’s completely OK to pass the bus number at control rate, but use it to read an audio bus, no problem).
But your first try, Ndef(\mv_reverb) <<>.in Ndef(\mv_in);, means that in should be an audio-rate input that receives the actual signal, not a bus number.
in was declared as control-rate, but you patched an audio bus to it.
But then, in was used as a bus number, but its value will actually be -1.0 to +1.0 (as an audio signal).
The NamedControl suggestion addresses this by declaring the input at audio rate, and patching it to an audio bus – OK. IMO this is the better way, though it’s largely a matter of taste.
My InFeedback suggestion addresses it by explicitly setting the bus number (Ndef(\mv_in).bus) rather than the Ndef itself (which, in JITLib, always patches the signal).