Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
MIDI Changes Script User Variables
MIDI Changes script User Variables may be set to any valid expression, including current MIDI control values, random values, current computer keyboard states or mouse position, input or buffered notes, oscillators, and other User Variables. They behave like the variables in a conventional programming language: You can set them, test them, or use them as values in other Changes expressions.
Note that all User Variables are cleared automatically at the start of each Pitch-to-MIDI performance. Since these variables can also be used by main macros, any macro that invokes a MIDI performance must take care to preserve them. The entire set can be saved and restored by simple Macro Array commands.
Variables U0 through U9 and UA through UZ, as well as Q0-9 and QA-Z, are for signed integers, whose values may range from -2147483648 to +2147483647 (+/- 2^31).
Ua through Uz and Qa through Qz are for unsigned fixed-points. These consist of a 16-bit integer portion and a 16-bit fraction, allowing values from 0 to 65535.9999.
You can combine both User variable types in expressions, and they will be converted as needed.
You can set a User Variable to a random value, then use that same exact value in multiple places in a Changes script.
User Variables are "global", so you can set a value in the script for one voice, and use it in any other voice. (Note that all active Changes scripts run on each beat, but they are processed in order. So if you set a value in, say, Voice 4, it will also be available to Voices 5 through 8 and Percussion on that same beat, but not to Voices 1, 2, and 3 until the next beat.)
There are 10 integer variables that, unlike the above User Variables, are not cleared at the start of each performance. These "special" integers can be set by main Daqarta macros before or during a performance, and the Changes script can read or set them at any time. They are a bit more awkward to use because they have different read and write commands, which are also different between the macro version and the Changes script version.
Miscellaneous macros Posn#0 to Posn#9 write the integers, and Posn?0 to Posn?9 read them.
MIDI Changes script commands ?0 to ?9 write these same variables, and they can be read as Miscellaneous Position read-only values m0 to m9.
Similarly, there are 7 "special" fixed-point variables with 32-bit integer and 32-bit fraction resolution that are written as Posn#i to Posn#o and read as Posn?i to Posn?o in macros.
These same variables are written in MIDI Changes scripts as ?i to ?o and read as mi to mo. (Though note that the MIDI script will limit these to unsigned values with 16-bit integer and 16-bit fraction resolution when used internally.)
You can use Daqarta Macros to set and read normal Changes Script User Variables. For example, the macro UA=7 will set UA to 7 just as would the same command given in a Changes script. Macros have much richer options for expressions, including advanced math functions and access to all Daqarta control variables, plus high-precision Macro Variables.
This feature allows performances with fixed Changes scripts to behave differently when run from macros. For example, suppose the Changes script ends with an IF statment like [UA=1 X0=0]. If User Variable UA is equal to 1, Pitch-to-MIDI will be toggled off to end the performance. If UA is normally 0, then the performance will repeat at the end of the script, as usual. The macro can thus tell the script to stop at the end of the current iteration.
One use for this is as a macro-controlled "juke box", where a macro selects the "song" via LoadDQM. By means of the above method, the macro can insure that the performance ends at the proper time, without cutting it off mid-phrase.
Similarly, if the script was designed using User Variables to set Instrument Numbers, then a macro could change instruments during the performance.
Note that all normal MIDI user variables are cleared when Pitch-to-MIDI is toggled on, or when any script or control changes are made that require it to be restarted. Thus, a macro can't control a performance by setting normal variables ahead of time... it must toggle Pitch-to-MIDI on first, then set any needed variables.
However, the 10 "special" Macro-MIDI integers (see above) are available to get around this issue, should the need arise.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved