First time here? Check out the FAQ!

How to constrain-to-scale the MIDI output of a StepSequencer (or any real-time stream of MIDI values)?

+1 vote

I tried putting a Script after the StepSequencer, but I'm not sure if this is the right approach. At this point, I can't tell if the issue is just with the Capytalk expression, or with the approach itself.


asked Oct 27, 2016 in Capytalk & Smalltalk by thom-jordan (Practitioner) (690 points)
edited Oct 27, 2016 by thom-jordan

1 Answer

+1 vote

I would do the transposition or constraining of the pitch either in the Frequency field of the synthesis module or in the KeyPitches array of the StepSequencer.  To quantize to or transpose by a scale step, you might be able to use the Capytalk expression:

!aPitch transposeBySteps: !TrspScaleSteps0 scaleIndex: !ScaleIndex012 tonic: !aNoteNumber

For more details on how that expression works, you can open the Capytalk Reference and search for 'transpos'.

Alternatively, for other kinds of scales, you could search in the Capytalk Reference for:

!Step ofEuclideanScaleSteps: !StepsInScale octaves: !Octaves mode: !Mode stepsPerOctave: !StepsPerOctave

You might also find some useful expressions in the Tools menu > Design Alternate Tunings.

answered Oct 27, 2016 by ssc (Savant) (114,570 points)
I will try this.. Thanks for the detailed information, this is very helpful.  
As an alternate approach, is there a way to put a constrain-to-scale expression in a separate module, even if it's not that efficient processing-wise?

The reason is that I want to create graphs of such modules each of which only might constrain part of the scale (or alternately transpose, change mode or key, etc) but when used together can create some mild emergent behavior.. and then turn certain modules on and off according to logic expressions moving through these 'geometric-music-spaces' established by different graphs of modules.  It could all be done in code, but I'd like to try to approach it visually with different interacting modules that each do something simple, and then use those as building blocks to construct more complex graphs of modules which can then be explored interactively using various approaches ( something akin to a evolution of Sonata form expressed in a multidimensional geometric/logical space.. which can then be explored interactively in performance instead of just linearly as in a traditional composition. )

Within a mildy-complex graph of such modules, the on/off state of some member modules might then be associated with other musical aspects such as rhythm or density, or visual media such as color-changes for lights, etc.