First time here? Check out the FAQ!
x

How to play an array of notes that changes at run time

0 votes
375 views

I'm going to be receiving arrays of notes over OSC and I want to step through this array and play each note at a set tempo. These array will be of varying lengths.

The sound I will be using to play the notes currently uses !KeyDown and !KeyPitch, which is nice because I can also use the sound from a midi keyboard, but not essential.

My first question is how do you set !KeyDown? I tried making a SoundToGlobalController that had 1 bpm: 60  in its value field and !Keydown in it's generated event and connected it in to a mixer in the flow after my sound but that didn't work.

Obviously the AnalogueSequencer does this somehow - but using the AnalogueSequencer seems overblown for what I'm trying to do.

If I did use the AnalogueSequencer how do I set its array of KeyPitches at run-time?

asked Jul 2, 2016 in Capytalk & Smalltalk by alan-jackson (Virtuoso) (15,840 points)

1 Answer

+1 vote
 
Best answer

One approach might be to use the StepSequencer with each of its parameter fields set to an array of EventValues that is the maximum length of any you plan to send.  Then you could send an additional EventValue to set the EndIndex of the StepSequencer, thus playing only the first n stages of the sequence (where n is the length of the array of values you just sent).

For example, assume a maximum length Array of 16.  Then you could set the StepSequencer fields to:

KeyPitches{1 to: 16 collect: [:i | !p suffix2: i]}

and similarly for any of the other fields you'd like to control.  In the EndIndex field you could put:

!Length - 1

Then for example, if you had an array of three pitches, you would send them as !P01 !P02 !P03 and you would send a value of 3 for !Length.

If you want the sequence to repeat, check the Loop box.  Otherwise, you could set the Gate field to another EventValue and sent it a value of 1 to start the sequence.

answered Jul 2, 2016 by ssc (Savant) (127,060 points)
selected Aug 23, 2016 by alan-jackson
That's great thanks!

So the maximum would be about 100. That's going to create a VCS with 100 controls on it, won't it? Is there a way of suppressing that?
At least for now, only the visible widgets can receive updates via OSC, so best not to hide them.
...