tempo tempo notes
Instrument and notes yield
strings. Tempo yields a
play "harpsichord" "ch d e f g a b c5w"
play "music box" "c4e c dq c f eh"
play "harpsichord" "c4 a3 f c4 a3 f c4 d c c c"
play command plays the specified sequence of notes with the specified instrument using a MIDI synthesizer (in OpenXION) or sampled sounds (in HyperTalk). The tempo parameter specifies the number of quarter notes per minute; the default value is 120.
play command in OpenXION uses an extended version of the scripted music notation originally found in HyperTalk. A sequence of notes is represented as a
string with notes delimited by whitespace. Each note has the following format for a regular note:
noteName octave duration velocityeffect
or the following format for a rest:
NoteName is a letter between
G, which may or may not be followed by any number of
# symbols, each of which raises the pitch a half step, or any number of
b symbols, each of which lowers the pitch a half step. In OpenXION, noteName can also be one of the letters
P followed by the MIDI dollar value, for which 60 is middle C. NoteName is the only required part of a note string.
Octave is an integer specifying which octave the note belongs to. If the octave is not specified, the last octave specified is used. The default is 4, the octave starting with middle C.
(Middle C corresponds to the note string
B#3. The note one half step below middle C is
Cb4. 440 Hz corresponds to the note string
Duration is one of the following letters:
which may or may not be followed by any number of
. symbols, each of which multiplies the duration by 1.5 to create a dotted note, or any number of
3 symbols, each of which divides the duration by 3 to create a triplet note. (In OpenXION, you can use any digit 2 through 9 to divide the duration by that value. Also in OpenXION, duration can be the letter
d followed by the duration in MIDI ticks. OpenXION uses 64 ticks per quarter note.) If the duration is not specified, the last duration specified is used. The default is
q, the duration of a quarter note.
Velocity is an extension provided by OpenXION not found in HyperTalk. It may be any of the following strings:
||triple forte (velocity 127)|
||fortissimo (velocity 112)|
||forte (velocity 96)|
||mezzo forte (velocity 80)|
||mezzo piano (velocity 64)|
||piano (velocity 48)|
||pianissimo (velocity 32)|
||triple piano (velocity 16)|
Velocity can also be the letter
v followed by the velocity of the note from 0 to 127. If the velocity is not specified, the last velocity specified is used. The default is
fff or 127.
Effect is another extension provided by OpenXION not found in HyperTalk. It is one or more of the following characters:
||The note is stopped a few MIDI ticks before it normally would be, creating a stoccato effect.|
|| The note keeps playing after its duration has passed. This can be used to start a fermata. (This overrides the effect of any
|| Stops a note previously started by
||Starts the next note at the same time as this note, creating a chord.|
If effect is not specified, no effects are applied.
If the note string contains an
r, it is a rest and only the duration can be specified.
play command is asynchronous: it will return immediately while the sound keeps playing in the background. If there is already sound playing on the current
soundChannel, the next sound to be played will be added to a queue. The
play stop form of the
play command will stop playing any sound on the current
stop sound command will stop all currently-playing and pending sounds on all
Early versions of HyperTalk limited the length of the note string to 254 characters. OpenXION and later versions of HyperTalk do not limit the length of the note string.
In HyperTalk, the
play command accepted note strings that were left unquoted, and this was often done. For example:
play harpsichord c4 a3 f c4 a3 f c4 d c c c
OpenXION will also accept unquoted note strings, but this is highly discouraged. You cannot use any special symbols (such as
+) in an unquoted note string, and if one of the notes in an unquoted note string turns out to also be the name of a constant or variable, the value of the constant or the contents of the variable will be played instead of the intended note.