Wherein we present the Shredder Node
Right-click to copy examples to your workspace
The Shredder node allows you to "perform" your ChucK programs. Similar
to the SoundBufBank node, the idea is that you
assign one more more ChucK programs to one or more notes.
Now, when a note is delivered, Shredder sporks
its associated program and the result is a new shred
, visible in the
ChucK VM Panel. When the note completes,
Shredder causes the new shred to terminate.
Here is a simple graph. If you don't have a MIDI device you can substitute this node with either SessionGrid note or any another NoteStream node.
Here is the Shredder Node:
ScriptFiles
is the place to enter your program files.
Add
opens up new slots in the ScriptFiles array.
↑↓
allow you to quickly change the assignments.
view
button causes Fiddle to open the associated program for editing.
x
button causes the deletion of an entry.
In this example we have 8 "slots", each containing the same program. This is a reasonable configuration since the associated program can be parameterized by its MIDI note. Equally reasonable is to enter a different ChucK program in each slot.
MidiNote
indicates which MIDI note range we're responsible for.
C3 is middle C, note 60. Typically a 16 voice drum bank comprises
values between C1 -> D#2. This value is ignored when Note requests are
received from SessionGrid where you "paint" program numbers
(0-N) directly.
Sync
requests "respectful" shreds to synchronize at this TimeKeeper
interval. Options are:
A ChucK program is said to be "respectful" of Shredder's intent when it implements behavior for:
GetOutlet()
method.Synchronize()
methodGetCC()
method. Note that Shredder has no way of enforcing this behavior and so you really can run any ChucK program. Your mileage may vary.
Here's the preamble of modalDemo.ck that implements these requirements.
if(me.args() == 0)
{
<<<"This is intended for use by Shredder. Bailing...", me.id()>>>;
1::second => now;
me.exit();
}
// The first standard argument represents our Shredder's Id
me.arg(0).toInt() => int shredderId;
Shredder.Shredders[shredderId] @=> Shredder shredder;
// The two remaining arguments are note and velocity.
me.arg(1).toFloat() => float midiNote;
me.arg(2).toFloat() => float velocity;
<<<"modalDemo.ck note", midiNote, "velocity", velocity>>>;
// Wire our output into Shredder's outlet. Note that our effects chain
// is optional since the downstream Channel's effects will also be in play.
shredder.GetOutlet() @=> UGen outlet;
ModalBar modey => JCRev rev => Echo echo => outlet;
// we can also get our hands on recent "CC" values via
// shredder.GetCC("CC7") => float channelVolume;
// shredder.GetCC("CC10") => float channelPan;
// We optionally synchronize to a beat or measure before we do our thing.
shredder.Synchronize();
// Now we proceed with our sound generation.