Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
MIDI Changes Script Field and Label Access
MIDI Changes scripts can read, write, and test main Daqarta Fields and their matching Labels. This allows a script to get user input via text, time, or number entry, and also provides additional output display options.
The basic command to write to a Field takes the form of Fn=x, where n is the Field number (1-6) and x is a number, variable, or quoted string. You can use the same formats allowed by Output Display, not including those which are specific for Messages, Meters, Log Files, or the Title Generator.
For example, using Field1:
F1=n value or expression F1=s current random seed value F1="String" arbitrary string F1="String "+U0 string plus variable F1O="String "+U0 string plus ON or OFF F1f=n fixed-point decimal F1h=n hexadecimal F1i=n instrument name F1p=n percussion instrument name F1n=n note name F1s=n scale pattern F1S=n scale name
You can read the Field string as an ordinary numeric variable. For example, if Field1 holds "12" then UA=F1 will set variable UA to 12. Similarly I3=F1 would set the Voice 1 Instrument to 12 (Marimba).
If Daqarta can't interpret the string as a standard number or time, it is converted to ASCII character values and stored as an integer holding the first 4 characters, ignoring all spaces.
You can use Fields in MIDI IF statments where the Field is interpreted as a numeric value, such as [F1=12, or you can test for a single-letter string as in [F1="A", but you can't test for longer strings as such. However, you can test for a string up to 4 characters long if you represent the ASCII characters as a hex value, as in [F1=h41424344 to test if Field1 holds "ABCD". Note, however, that since the string-to-ASCII conversion only takes the first 4 characters, this test will also pass if Field1 holds "ABCDE", etc.
One very useful test is to see if a Field is empty or not, so the script can accept user entry to change a default setting. The GlossyTracks Percussion script uses [F1!=0 to test if Field1 is not empty, in which case it uses the entered value as the seed for the initial track. Otherwise it uses a random seed by default.
You can also use a single Field to enter two separate integer values. For example, GlossyTracks uses Field3 for entry of Tempo range, with separate minimum and maximum BPM values. To specify a range of (say) 150-250 BPM you could enter 150.250. The script truncates the decimal part by ANDing (masking) with hFFFF (16 bits set) via UB=F3&hFFFF.
To extract the decimal part as an integer 250, it ANDs Field3 with 0.99999 (16 fraction bits set) to get rid of the 150 integer part, then multiplies by 1000 via UC=F3&0.99999*1000.
The commands to write and read Labels are similar to those for Fields, with the replacement of 'F' with 'FL'. The format is thus FLn=x where n is the Label number (1-6) and x is a number, variable, or quoted string.
For example, FL1="Seed" sets Label1 to "Seed". This is used in the GlossyTracks Percussion script to indicate that Field1 (immediately below Label1) can accept a user-supplied seed value, as mentioned above.
Although not normally recommended, if you need more than the 6 Fields to get user input, you can also use Labels just like Fields. The problem, of course, is that then there are no labels for these "fields"... you'll have to keep track of the usage yourself.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved