[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Monophonic patterns



On Dec 28, 2008, at 7:43 PM, Nathaniel Virgo wrote:
All of this is more-or-less easy enough, but I want the kicks and hihats to be monophonic instruments (an open hihat should stop sounding if followed by a closed one, for example).  Pmono doesn't really work because the hihats from block1 would end up in a separate synth instance from those in block2, so an open hat at the end of block1 would not be cut off by a closed one at the beginning of block2.

This way doesn't use monophonic synths, but it's very pattern-y. The basic idea is that you know how many beats until the next event (delta) -- therefore, the event's sustain should be exactly that amount for something like an open hat that should keep sounding until cut off.

That means reading the delta value into another Pbind stream, which is easy to do with Pkey. Then you need a way to decide whether to make the sustain short or long. There are lots of ways to do that, but I thought it would be cool to base it on the synthdef name. There is a little known and underused cluster of patterns (Psym, Psym1, Pnsym, Pnsym1) that look up patterns in a dictionary. The appropriate one here is Pnsym1, which, for each event, looks up the right stream and returns exactly one item from it. Then, on the next event, it can look up from a different stream if needed.

Technically, the Pnsym1 is not really needed because the closed hi hat has a fixed length envelope (no gate) so it ignores whatever the sustain value is. But the pattern, as written, would work If the closed hat had a gated envelope as well.

Another option would be the \legato Pbind key, which is multiplied by delta to calculate sustain.

Also, I would suggest not using Ppar for this. Ppar was very important in sc2 when the one-synth only rule made it hard to run concurrent patterns independently. In sc3, it feels more idiomatic to me to play several patterns separately on the same clock. I think this gives you more control and it keeps the structure of each individual pattern simpler.

hjh

SynthDef(\c_hat, { |out, amp = 1|
var exc = PinkNoise.ar(amp) * EnvGen.kr(Env.perc(0.01, 0.02)),
sig = Klank.ar(`[ [ 6563.8559629717, 9875.9386736865 ],
  [ 0.61614058875448, 0.55046827363918 ],
  [ 0.0024096657681325, 0.0036658074303636 ] ], exc);
DetectSilence.ar(sig, doneAction: 2);
Out.ar(out, sig)
}).memStore;

SynthDef(\o_hat, { |out, amp = 1, gate = 1|
var exc = PinkNoise.ar(amp) * EnvGen.kr(Env.adsr(0.01, 0.05, 0.4, 0.07), gate),
sig = Klank.ar(`[ [ 6563.8559629717, 9875.9386736865 ],
  [ 0.61614058875448, 0.55046827363918 ],
  [ 0.0024096657681325, 0.0036658074303636 ] ], exc);
DetectSilence.ar(sig, doneAction: 2);
Out.ar(out, sig)
}).memStore;

p = m.play(Pbind(
\instrument, Pseq(#[c_hat, c_hat, o_hat], inf),
\delta, Pseq(#[0.28, 0.22, 0.5], inf),
\sustain, Pnsym1(Pkey(\instrument), (
c_hat: 0.1,
o_hat: Pkey(\delta)
)),
\amp, 3
));

p.stop;



: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman