Skip to content

Instantly share code, notes, and snippets.

@novadeviator
Created August 25, 2013 19:15
Show Gist options
  • Save novadeviator/6335676 to your computer and use it in GitHub Desktop.
Save novadeviator/6335676 to your computer and use it in GitHub Desktop.
not sure why trigger does't work here (see Latch)
~grain_reveal = NodeDef {
arg buf, interval = 0.02, dur = 0.1,
threshold = 0.002, grow = 0.7, attack = 3, decay = 15,
in, trigger;
var energy, sound;
energy = (in - threshold).max(0) * grow;
energy = Decay2.kr(energy, attack, decay).min(1.0);
sound = GrainBuf.ar (
2,
TDuty.ar(Dwhite(interval * 0.3, interval * 1.8)),
dur,
buf,
BufRateScale.ir(buf),
// LFNoise1.kr(0.01) * 0.5 + 0.5;
LFSaw.kr(LFPulse.ar(0.25,0,0.01) + 0.001 * 0.9 );
// Latch.kr( WhiteNoise.kr(), trigger) // ??????????
/// why this doesn't work as with grain_trigger_env???
);
sound = LPF.ar( sound, energy.pow(4) * 20000 + 200 ) * ((energy * 4).min(1) + 0.01) * 0.8;
// Reverse filter and amp:
/*
x = (
LPF.ar( x, (1 - movement).pow(4) * 20000 + 200 )
* ( (1 - (movement * 1)).max(0) + 0.01)
* 0.5;
)
*/
};
@jleben
Copy link

jleben commented Sep 22, 2013

"trigger" is here an argument to the NodeDef function -> it becomes a input to the node.
It has to be mapped to the preprocessing node that produces the trigger, equivalently to:

~grain_trigger_env.map(\trigger, [~trigger, 0]);

where:

  • "\trigger" refers to the argument of the "~grain_trigger_env" NodeDef
  • "~trigger" refers to the trigger-producing (preprocessing) NodeDef.
  • "0" refers to the first output of the trigger-producing NodeDef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment