Event patterns and array args:
Filter:
miSCellaneous_lib/Tutorials (extension) | Libraries > miSCellaneous > General Tutorials | Streams-Patterns-Events

Event patterns and array args
ExtensionExtension

setting and passing arrays and envelopes via patterns

Description

This tutorial covers some use cases of array args, especially passing arrays to synths with patterns.

 

Ex.1: Alternative writing of arrayed args in SynthDefs

2. Setting array args and array fields of a running synth

 

Ex.2a: Setting array args of a running synth

 

Ex.2b: Setting array args of a running synth with Pbind of event type \set

For many use cases Pmono (see Ex.2c) is the most practical solution as it doesn't require explicit starting of a synth. However sometimes it is necessary to access the running synth itself, then a Pbind with event type \set is a good choice.

 

Ex.2c: Setting array args of a running synth with Pmono

Rewriting second example of 2b, shorter with Pmono. Instead of doubly bracketed arrays you can choose Refs of Arrays also. Note that this alternative is not valid for a single nested Array as in the first example of Ex.2b .

 

Ex.2d: Setting i-th fields of a running synth

 

Ex.2e: Setting i-th fields of a running synth with patterns

For SC versions before invention of method seti use helper functions from Ex.2d in Pbind.

 

Ex.2f: Alternatives with demand ugens

Besides from passing arrays, array sequencing can be done within synths by demand ugens. This is saving OSC bandwidth, especially with large arrays and short durations, for more complicated sequencing tasks coding might be harder than with patterns.

3. Sequencing synths with array args by Pbind

 

Ex.3a: Sequencing synths of same definition with array args by Pbind

 

Ex.3b: Sequencing synths with different array arg sizes by Pbind

By using the Array o in the last examples we did a kind of zeropadding: setting unused elements to zero. When altering one running synth (as with event type \set or Pmono) one can only save OSC messages if less than all fields are changed, see Ex. 2e . When continuously generating new synths – as with 'normal' Pbind of type \note – there is another alternative: using SynthDefs of dedicated array arg sizes per event. This is the use case of a "SynthDef factory" as described in Ex.1 .

 

Ex.4 Sequencing synths with envelope array args by Pbind

Env objects have a representation in a special Array format – which you can get with anEnv.asArray – the task of passing Env data to synths can thus be reduced to the task of passing Arrays in this special format. Nevertheless direct passing of Envs is possible also.