User Tools

Site Tools


logo:commands:music

Multimedia Commands

Multimedia commands.

PLAY

Plays sound files and lists of notes.

Syntax

PLAY filename
(PLAY filename TRUE)
(PLAY)
PLAY [list]

Description

PLAY causes the given sound file to be played. If PLAY is used with a word as input, Logo assumes a file name for a waveform file, with an extension of “.WAV”. Logo plays this file in the background, returning immediately. If the second input to PLAY is TRUE, Logo plays the file repeatedly. Stop playing a sound file by using (PLAY) with no inputs.

If the input is a list, Logo causes the computer's synthesizer to play musical notes as specified by its input list. PLAY will accept lists as input that contain special musical commands, such as the note and octave to play, and the length of time to sound the note. The following elements can be included in a list that is input to PLAY.

Musical Notes: A B C D E F G P (for pause)

Note prefixes: An integer immediately preceding a note determines its duration. 1 is a whole note, 2 is a half note, 4 is a quarter note, 8 is an eighth note, etc.

Note suffixes: # following a note indicates it is a sharp note, b following a note indicates it is a flat note; . following a note extends its duration to 3/2 time when appended to the note. An integer between 0 and 6 sets the octave for the note.

Octaves: O followed by an integer between 0 and 6 sets the octave which is preset to 4. O# raises one octave, Ob lowers one octave.

Logo treats words that start with a number, followed by “E”, and end with a number, as numbers in scientific notation! Logo reads the value “8E5”, therefore, as 8 * 105. If you run into this problem, you will see error messages like “Invalid note: 80000”. In this case, you must use the “O” command to change the octave and omit the octave following the letter “E”. So, instead of using “8E5”, use “O# 8E Ob”, assuming that you are in octave 4.

Tempo: T followed by an integer sets the tempo in units of quarter notes per minute. T is preset to 120.

Note length: L followed by an integer sets the default note length if no duration is specified with the individual note. L is preset to 4 (for quarter notes).

Reset: R resets note length, octave, tempo, and staccato to their preset values. Changes in these values are preserved during multiple calls to PLAY unless they are changed again or reset to their preset values. Also, all playing of music is stopped.

MIDI Output channel: M followed by a value from 1 to 16 selects a MIDI output channel. Each channel is capable of playing chords using a specific instrument. Channel 10 is reserved for drums sounds, where every note is a specific drum sound.

Instruments: I followed by an instrument number selects a specific instrument for a channel.

Volume: V followed by a number between 0 and 127 sets the volume for the following notes or chords.

Staccato: S followed by a number between 0 and 99 sets the staccato effect for the following notes or chords. The higher the value is, the shorter the note is played. S0 is perfect legato. The value is preset to 10.

Chords: A list within the PLAY list is treated as a chord. The highest values for intervals and length specifiers are used. PLAY [C [C E G O# C] Ob E] will play a C, a chord ending with a high C and an E.

The plus (+) sign: Causes all following notes to be played as long as possible until a pause is found or the list ends.

Standard MIDI Instrument Assignments

The standard MIDI instrument assignments are based on the MIDI Manufacturers Association (MMA) General MIDI Mode specification. Following are the standard MIDI assignments.

Piano, Chromatic Percussion, Organ
0 Acoustic grand piano 8 Celesta 16 Hammond organ
1 Bright acoustic piano 9 Glockenspiel 17 Percussive organ
2 Electric grand piano 10 Music box 18 Rock organ
3 Honky-tonk piano 11 Vibraphone 19 Church organ
4 Rhodes piano 12 Marimba 20 Reed organ
5 Chorused piano 13 Xylophone 21 Accordion
6 Harpsichord 14 Tubular bells 22 Harmonica
7 Clavinet 15 Dulcimer 23 Tango accordion
Guitar, Bass, Strings
24 Acoustic guitar (nylon) 32 Acoustic bass 40 Violin
25 Acoustic guitar (steel) 33 Electric bass (finger) 41 Viola
26 Electric guitar (jazz) 34 Electric bass (pick) 42 Cello
27 Electric guitar (clean) 35 Fretless bass 43 Contrabass
28 Electric guitar (muted) 36 Slap bass 1 44 Tremolo strings
29 Overdriven guitar 37 Slap bass 2 45 Pizzicato strings
30 Distortion guitar 38 Synth bass 1 46 Orchestral harp
31 Guitar harmonics 39 Synth bass 2 47 Timpani
Ensemble, Brass, Reed
48 String ensemble 1 56 Trumpet 64 Soprano sax
49 String ensemble 2 57 Trombone 65 Alto sax
50 Synth. strings 1 58 Tuba 66 Tenor sax
51 Synth. strings 2 59 Muted trumpet 67 Baritone sax
52 Choir Aahs 60 French horn 68 Oboe
53 Voice Oohs 61 Brass section 69 English horn
54 Synth voice 62 Synth. brass 1 70 Bassoon
55 Orchestra hit 63 Synth. brass 2 71 Clarinet
Pipe, Synth Lead, Synth Pad
72 Piccolo 80 Lead 1 (square) 88 Pad 1 (new age)
73 Flute 81 Lead 2 (sawtooth) 89 Pad 2 (warm)
74 Recorder 82 Lead 3 (calliope lead) 90 Pad 3 (polysynth)
75 Pan flute 83 Lead 4 (chiff lead) 91 Pad 4 (choir)
76 Bottle blow 84 Lead 5 (charang) 92 Pad 5 (bowed)
77 Shakuhachi 85 Lead 6 (voice) 93 Pad 6 (metallic)
78 Whistle 86 Lead 7 (fifths) 94 Pad 7 (halo)
79 Ocarina 87 Lead 8 (brass + lead) 95 Pad 8 (sweep)
Sound Effects
120 Guitar fret noise
121 Breath noise
122 Seashore
123 Bird tweet
124 Telephone ring
125 Helicopter
126 Applause
127 Gunshot
General MIDI Percussion Key Map

The standard MIDI drum effect assignments are based on the MIDI Manufacturers Association (MMA) General MIDI Mode specification. Following are the standard MIDI assignments. They can be used as note values on channel 10. The command PLAY [M10 N55] would cause the Splash Cymbal to sound.

35 Acoustic Bass Drum 36 Bass Drum 1 37 Side Stick
38 Acoustic Snare 39 Hand Clap 40 Electric Snare
41 Low Floor Tom 42 Closed Hi-Hat 43 High Floor Tom
44 Pedal Hi-Hat 45 Low Tom 46 Open Hi-Hat
47 Low-Mid Tom 48 Hi-Mid Tom 49 Crash Cymbal 1
50 High Tom 51 Ride Cymbal 1 52 Chinese Cymbal
53 Ride Bell 54 Tambourine 55 Splash Cymbal
56 Cowbell 57 Crash Cymbal 2 58 Vibraslap
59 Ride Cymbal 2 60 Hi Bongo 61 Low Bongo
62 Mute Hi Conga 63 Open Hi Conga 64 Low Conga
65 High Timbale 66 Low Timbale 67 High Agogo
68 Low Agogo 69 Cabasa 70 Maracas
71 Short Whistle 72 Long Whistle 73 Short Guiro
74 Long Guiro 75 Claves 76 Hi Wood Block
77 Low Wood Block 78 Mute Cuica 79 Open Cuica
80 Mute Triangle 81 Open Triangle

Example

PLAY [O4 C E G O5 [C E G O6 C]]
PLAY "BIRD1
logo/commands/music.txt · Last modified: 2019/01/22 06:09 (external edit)