Manipulate Patterns with Ndefs?

Hello everybody.

I am curious of how I could adresse some arguments of a Synth, which is created by a pattern, which is embedded in an Ndef. By using the arguments, ‘.set’ or ‘.gui’ of the Ndef. Maybe I’m also looking for a more favorable way of writing this kind of things, such as using the Pattern to trigger a Ndef of a Synth. But I’m yet not sure how to archieve this properly.

However here is my example code, and basically I’m looking for a way to change the \amp or \freq, since its not addressed in the pattern, this should be possible with an Ndef.

//simple Synth and Pdef
//starting the Ndef of a pattern
//how to address the amp or the frequency?

Thank you very much.

I’m not 100% sure what you’re trying to do, but it seems like Node Proxy Roles might be helpful.

You can use a pattern to set arguments of an Ndef like so:

Ndef(\a, {
|freq = 440| + [0,1]) * -10.dbamp;

Ndef(\a)[1] = \set -> Pbind(\dur, 3, \freq, Pwhite(100, 800))

Hope this helps. @madskjeldgaard has a nice tutorial about this too.

If you’re only worried about setting unaddressed arguments to fixed values, you can use:

Ndef(\fdsa).set(\amp, 1.0);

The same set method also works on Pdef. Note that these will only work as “default” values - if e.g. your pattern contains an \amp key, the one you’re .set will not be used.