hey, im using this setup to send an audio trigger from Impulse
via OffsetOut
to a bus ~bus[\trig]
.
I then use In.ar
to use it for Demand
and send the resulting sequence to ~bus[\seq]
and use .asMap
to modulate the frequency of the main SynthDef.
Is this the right way to go about this routing?
1.) what if the trigger is a multichannel signal, can i just use a bus with more channels then and use and arrayed named control for \freqMod
?
2.) is \freqMod.ar(1)
correct for this use case? I have only used .kr
with named controls until now.
(
var hanningWindow = { |phase|
(1 - (phase * 2pi).cos) / 2 * (phase < 1);
};
SynthDef(\pulsar, {
var tFreq = \tFreq.kr(5);
var trig = Impulse.ar(tFreq);
var grainFreq = \freq.kr(200) * \freqMod.ar(1);
var phase = Sweep.ar(trig, grainFreq);
var windowPhase = phase / \overlap.kr(4);
var grainWindow = hanningWindow.(windowPhase);
var sig = sin(phase * 2pi);
sig = sig * grainWindow * \amp.kr(-20.dbamp);
sig = Pan2.ar(sig, \pan.kr(0));
OffsetOut.ar(\out.kr(0), sig);
OffsetOut.ar(\trigBus.kr(0), trig);
}).add;
SynthDef(\microSeq, {
var trig = In.ar(\trigIn.kr(0), 1);
var seq = Demand.ar(trig, 0, Dwhite(1, 4));
seq.poll(trig, \seq);
OffsetOut.ar(\microSeqOut.kr(0), seq);
}).add;
)
(
~makeBusses = {
~bus = Dictionary.new;
~bus.add(\trig -> Bus.audio(s, 1) );
~bus.add(\seq -> Bus.audio(s, 1) );
};
~makeBusses.();
)
(
Routine({
s.bind {
Synth(\microSeq, [\trigIn, ~bus[\trig], \microSeqOut, ~bus[\seq]]);
};
s.bind {
Synth(\pulsar, [
\tFreq, 4,
\freq, 60.midicps,
\freqMod, ~bus[\seq].asMap,
\trigBus, ~bus[\trig],
]);
};
}).play;
)