Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

MIDI Changes Script Output Display


Changes: oX=n

Introduction:

The Output Display commands allow you to see the values of MIDI Changes script variables, expressions, or strings as the script runs. This can be helpful during development of a script, to understand how different values affect the performance.

All Output Display commands begin with a lowercase 'o', followed by a letter or digit to designate where the value or string should be shown.

There are separate Left and Right Output Displays at the bottom of the Pitch-to-MIDI dialog dialog, which are hidden until invoked by an Output Display command. There are upper and lower displays for each side, designated with uppercase 'L' and 'R' for the upper displays, and lowercase 'l' and 'r' for the lower.

You can also designate that the output be displayed on a Custom Macro Message, a Custom Meter, or sent to a Log File. These are discussed separately below. (These features are part of Daqarta's macro system, which normally requires a Pro license but are free for this use.) They can use special formatting and string expressions, and additionally can display Song Title Generator output, which the standard Output Display can not.


Command Summary:

Output to upper Left shown, same format for others:

    oL=n value or expression
    oL=s current random seed value
    oL="String" arbitrary string
    oL="String "+U0 string plus variable
    oLO="String "+U0 string plus ON or OFF
    oLf=n fixed-point decimal
    oLh=n hexadecimal
    oLi=n instrument name
    oLn=n note name
    oLp=n percussion instrument name
    oLs=n scale pattern
    oLS=n scale name
    oLt=n seconds in H:M:S time format

Basic Operation:

oL=n sends the value of n to the upper Left display, and oR=n sends it to the upper Right. Similarly, ol=n and or=n send the value to the lower left and right displays, respectively. The examples below use the upper Left display, but the others use the same format.

n may be any variable or expression, including current MIDI control values, oscillators, random values, User variables, Buffer note values, and computer keyboard key states or mouse position.

If, instead of a numerical value for n you use the character s, the display will show the value of the current pseudo-random seed. If true random mode is active instead (the default), the displayed value will be 0.

Alternatively, you may use a quoted string in place of a numerical value, as in oL="1st Movement". The quotes are mandatory, but are not shown in the display. The display window holds about 22 characters; strings longer than the display can hold are cut off at the right end. However, the characters are still present and can be highlighted and copied.

You can show a quoted string followed by a variable by appending it with a '+' sign, as in oL="Octave "+UO. Note that this will only display integer values; if you use a fixed-point real variable like Ua it will be rounded to an integer for display. You can not use any formatting options like hexadecimal or fixed-point as discussed below.

However, you can use oLO="Octave "+UO to show "Octave ON" if the variable is above 0, or else or "Octave OFF" if not.

You can highlight the Output Display text or value and use CTRL+C to copy it to the Windows clipboard. You can then use CTRL+V to paste it into a separate text editor like Windows Notepad, or the Daqarta Notes Editor, or into a Changes script.

For example, you may have a script that uses random values to set some parameter. If you monitor the parameter value during a performance, you may discover certain values that are particularly useful. You may want to modify the script to use such a value as a constant in place of a random value.

For instance, if you are setting Note Range Max to a random value between 50 and 100 for Voice 2, you could use:

    rM2=?(50,100)
    oL=rM2

The above example is for an integer parameter. However, if you are setting an oscillator or observing its output, you may wish to use User variables with a lowercase second letter, which support fixed-point fractions. To see the full value including the decimal part, use oLf=n.

Similarly, for some integer values such as the seed for the pseudo-random generator mode, you may prefer to have the display show hexadecimal format via oLh=n.

You can interpret integers as Instrument Numbers and tell the display to show the corresponding name with oLi=n. If the integer is outside the normal 0-127 General MIDI Instrument range, the display will show "Unknown".

Similarly, you can show the integer as a Percussion Instrument Number via oLp=n. If the integer is outside the 27-87 range of General MIDI Percussion instruments, the display will show "Unknown".

oLn=n shows the integer n as a note name. For example, 60 will be shown as 'C4'. Negative values are shown as "Unknown", while positive values greater than 127 are shown as "Off".

oLs=n shows the integer n as a Scale pattern string, which uses the same CdDeEFgGaAbB format as in the Musical Scales List except that missing notes are shown as '^' instead of spaces for clarity. For example, if Voice 1 uses a Pentatonic Major scale, then oLs=S1 would display C^D^E^^G^A^^.

Alternatively, if you use oLS=S1 the display would show Pentatonic Major. If the given value is not in the Musical Scales List and is not one of the Custom Scales, the display uses the above pattern string format.

The Output Displays are re-hidden when the performance is ended by toggling Pitch-to-MIDI On/Off to Off. Since the displays may be changing during the performance, you can use Pause to momentarily halt things while you examine or copy the display values.


Custom Message Output Display:

The Output Display can be sent to a Custom Macro Message via oM=n. This supports all of the above output formats (such as oMh=n to show hexadecimal), but allows arbitrarily-long strings because it is automatically sized to fit.

Messages can be dragged to any convenient location. Left-clicking on the message text pops up a prompt allowing you to save the message to the Clipboard. CTRL+left-click saves it directly, without the prompt. SHIFT+left-click includes the message title above the text. CTRL+SHIFT+left-click includes the title and omits the prompt.

In addition, the MIDI oM command supports all the normal macro Msg format commands to control size, color, position, and font style. You just replace Msg with oM:

    oM="<<New Title" message title bar text
    oM="<B(red,grn,blu)" background color
    oM="<C(red,grn,blu)" text color
    oM="<P(x,y)" position, pixels
    oM="<D(x,y)" position, dialog units
    oM="<F(n)" font height, pixels
    oM="<W(n)" font weight (Boldness) (0-1000)
    oM="<v(n)" vertical white space (0-100)
    oM="<h(n)" horizontal white space (0-100)
    oM="<i(n)" italic mode (0 or 1)
    oM="<f(n)" font family (0-3)

Because the oM command is actually an alternate form of the Msg macro, it can also accept any string expression that would be valid with Msg, including display of macro and internal Daqarta variables that are normally not accessible from MIDI scripts. However, you must use a special oMx format designation to tell the MIDI script to pass the entire command line to the Msg handler, which will determine how to handle variables and spaces that might otherwise confound the normal script handler.

For example, a macro can use Msg=t to show the current time (see the String Variables and Expressions topic for other options), but here you must use oMx=t to get the same result. (oM=t will produce an error since 't' is not a valid MIDI variable, while oM="t" will simply display the letter 't'.)

Likewise, a macro can use Msg="Time: " +t +n +d to display a string plus the time on one line, and the date on the line below. Here you would use oMx="Time: " +t +n +d to do the same thing from a MIDI script. Note that the entire command must be on a single line.

Note that there is no way to mix MIDI-specific displays like instrument or scale names with the above macro string expressions. (There is a way to do this with Log File entries, however... see below.)

A special use of the MIDI Output Display to a Custom Message is with the Changes Script Song Title Generator, discussed separately. A typical use is oMT=s to display a performance or track title corresponding to the current random seed value.

Another special use is to show an exit message when a MIDI script detects some error condition while running and has to abort. The normal X0=0 exit toggles Pitch-to-MIDI off, but that erases any custom message that the script may have written. Using X0=20 will exit but retain the message.

For example, the _MusicData.DQM script must only be run from the Music_from_Anything macro mini-app, which prepares data used by the MIDI script. Attempts to run _MusicData.DQM as a standalone script (such as from the DaqMusiq macro) will result in it using:

    oM="Run Music_from_Anything macro." 
    X0=20                ;Shut down, keep Msg

Had the normal X0=0 shutdown been used here, the message would have vanished as soon as it appeared.


Custom Meter Output Display:

The Output Display can be sent to any of 4 Custom Meters, which would normally be accessed via Mtr0 to Mtr3 macro commands. o0=n sends the value of n to Mtr0; replace o0 with o1 for Mtr1, o2 for Mtr2, or o3 for Mtr3.

As with the above oM Message command, these commands support all of the normal MIDI Output Display formats (such as o0h=n to show hexadecimal), but allow much longer strings because they are automatically sized to fit.

Meters can be dragged to any screen location. You can also increase or decrease the font size by dragging the corner of a meter. Left-clicking on the meter text pops up a prompt allowing you to save the message to the Clipboard. CTRL+left-click saves it directly, without the prompt.

The MIDI o0 through o3 commands support all the normal macro Mtr0 through Mtr3 commands to control size, color, and position. These are explained in the Custom Meters Command Summary; here, you just replace Mtr0 with o0, for example.

    o0="<<New Mtr0 Title" meter title bar text
    o0="<B(red,grn,blu)" background color
    o0="<C(red,grn,blu)" text color
    o0="<P(x,y)" position, pixels
    o0="<D(x,y)" position, dialog units
    o0="<F(n)" font height, pixels

(Unlike Messages, Meters use a fixed font type and boldness.)

Because the o0 to o3 commands are actually alternate forms of the Mtr0 to Mtr3 macros, they can also handle any string expression that would normally be displayable with a meter, including display of macro and internal Daqarta variables that are otherwise not accessible from MIDI scripts. However, you must use a special o0x format designation to tell the MIDI script to pass the entire command line to the meter handler for parsing. See the above Message examples.

Note that there is no way to mix MIDI-specific displays like instrument or scale names with the above macro string expressions. (There is a way to do this with Log File entries, however... see below.)

You can also use meters with the Changes script Song Title Generator, discussed separately. For example, o0T=s displays a performance or track title corresponding to the current random seed value.


Log File Output:

The Output Display can be sent to a Log File instead of (or in addition to) actually showing it on-screen. You can use this, for example, to keep a record of GlossyTracks track information like seed number, song title, tempo, scale, start and/or end times, and even instruments used. There is no restriction on line length in the file, unlike on-screen displays.

The simplest form of the command is oF=n. As with the above oM Message and o0 to o3 Meter commands, it supports all of the normal MIDI Output Display formats, such as oFh=n to show hexadecimal or oFi=n to show instrument name.

Because the oF command is actually an alternative form of the LogTxt macro, it can also handle any string expression that would normally be acceptable by LogTxt, including display of macro and internal Daqarta variables that are ordinarily not accessible from MIDI scripts. However, you must use a special oFx format designation to tell the MIDI script to pass the entire command line to the Log File handler for parsing. See the previous Message examples.

Unlike LogTxt, oF always starts a new line in the file. If you want to continue the current line, use of instead. This allows Log File entries to mix MIDI-only outputs (like instrument or scale names) with the above macro string expressions. You do this by multiple of or ofx commands following the initial oF or oFx command.

For example, suppose you want to record GlossyTracks track seed number, title, and title block number, followed by start time, scale, and tempo. The seed, title, and block number can be sent together because GlossyTracks already sets the Song Title Generator to show those. (That setting applies to all Title output, both the live Message display and the Log File.) The Title setup and display commands are after ?x=0 sets pseudo-random mode, near the start of the Percussion script. Before XP=?(0,5) (where the seed is used and thus changed) you would insert the lines shown indented below:

    ?x=0                   ;Set pseudo-random mode
    oLh=s                  ;Show random seed
    oTh=1                  ;Hex seed value before track Title
    oTb=1                  ;Block number after track Title
    oM="<<Track Title"     ;Custom Message title
    oM="<F(40)"            ;Font height for Custom Message
    oM="<V(10)"            ;Vertical white space for Custom Message
    oM="<B(256,256,128)"   ;Background color for Custom Message
    oMT=s                  ;Show track Title as Custom Message
        oFT=s                  ;Send seed, title, and block to file
        ofx="  "+t+"  "        ;Append spaces, time, spaces
    XP=?(0,5)              ;Random Percussion on/off

Then near the start of the Voice 1 script:

    oRS=S1                 ;Show Scale name
        ofS=S1                 ;Append Scale name to file line
        of="  "                ;Append spaces after Scale
    ...
    TB=?2(UB,UC)           ;Triangular Tempo
        of=TB                  ;Append Tempo value
        of=" BPM"              ;Append label

Note that oF and of write to the default Log File, which is DqaLog.TXT in Documents - Daqarta - User_Data, unless a different file has been specified via the LogName macro. There is no MIDI script equivalent for LogName, so if you need to change the file and don't have a Daqarta Professional license (which allows you to create and save new macros), or are not still in the trial period (which gives full access to all Professional features) you can use an Instant Macro. You'll need to do that once each Daqarta session, since the default DqaLog.TXT is restored at the start.


See also Changes Script Overview, Changes Script Editor, MIDI Voice Setup Dialogs, Pitch-to-MIDI dialog, Pitch Track Toolbox - Overview


GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved