Music and Sounds
PLAY SAY
This section shows you how to use commands to create music and sounds.
PLAY list
PLAY filename
(PLAY list-or-filename TRUE)
(PLAY)
Use PLAY
to play notes and sound effects. You can set different instruments to play your music.
Note that iOS devices, such as iPhones and iPads, have problems playing Logo music or sounds, and the PLAY
command does nothing.
Here is a sample tune. Can you play it and identify it?
TO SONG
PLAY [R] ; resets the music
PLAY [F F G A F A 2G F F G A 2F 2E]
PLAY [F F G A Bb A G F E C D E 2F 2F]
END
To set an instrument to play it, put an instruction at the beginning with the instrument number (the letter I
is for Instrument). This instruction sets the instrument to be a guitar.
PLAY [I24]
Here are a few instrument numbers to try. You can find all the possible instruments here: resources.terrapinlogo.com/weblogo/manual/music
0 – piano | 10 – music box | 13 - xylophone | 14 – bells |
19 – organ | 21 – accordion | 24 – guitar | 40 – violin |
47 – timpani | 55 – orchestra | 71 – clarinet | 76 – bottle blow |
105 – banjo | 109 – bagpipe | 114 – steel drums | 115 - woodblock |
Do you know the standard note names C, D, E, F, G, A and B? European musicians also know that the letter H is the same as the letter B, so Logo knows that letter as well. Logo knows sharp and flat notes, too. Simply add the letter “b” for flat or the hash “#” for sharp to your note so that it plays the note flat or sharp.
Playing a simple melody is as easy as feeding PLAY with a list of notes:
PLAY [G E C E G C]
Do you want to play chords, or more than one note at the same time? Just use a list instead of a single note. Replace the C with a C major chord.
PLAY [G E [C E G] E G [C E G]]
Logo offers a variety of sounds in its ~HOME folder. Use the following command to list available sounds:
(DIR "~HOME/SOUNDS)
Result: [ahha.mp3 beebotmotor.mp3 bigdog.mp3 bird1.mp3 bird2.mp3 bird3.mp3 blubb.mp3 bullfrog.mp3 buzz.mp3 camera.mp3 carhorn.mp3 carmotor.mp3 chicken.mp3 chimp.mp3 cough.mp3 cow.mp3 coyote.mp3 cricket.mp3 crows.mp3 dog.mp3 donkey.mp3 doorbell.mp3 doorclose.mp3 drip.mp3 elephant.mp3 goat.mp3 gunshot.mp3 harp.mp3 hey.mp3 horse.mp3 horse2.mp3 jackhammer.mp3 jet.mp3 lion.mp3 meow.mp3 ohoh.mp3 okay.mp3 pig.mp3 probot1.mp3 probot2.mp3 probot3.mp3 probot4.mp3 probot5.mp3 probot6.mp3 probot7.mp3 shatterdish.mp3 shatterglass.mp3 sheep.mp3 shriek.mp3 splash.mp3 tarzan.mp3 telephone.mp3 thunder.mp3 tiger1.mp3 tiger2.mp3 toad.mp3 toiletflush.mp3 typekey.mp3 uh.mp3 wasp.mp3 yuk.mp3]
To play the sound, use an instruction like this:
PLAY "sheep
To hear the sheep makes its sound over and over, add TRUE as a third input, like this:
(PLAY "sheep TRUE)
To stop it, use PLAY
with no inputs, like this:
(PLAY)
» Things to Try
Try making a horse sound alternate with a cow sound.
Or try the three different bird songs, one after the other.
To play different sounds in a row, use WAIT
followed by a number, which is the number of milliseconds.
WAIT 1000
waits for one second.
When you play musical notes, each note finishes before the next one starts, but that isn’t true for sounds.
For all the details about making music with Logo, refer to the Making Music section of the Logo manual.
SAY word-or-list
Use SAY
to speak text. For example,
SAY "HI
or
SAY [BYE FOR NOW]
You can choose a voice from the Settings / Select Voice… menu option, or use the SELECT.VOICE
command, which opens a dialog where you can choose the voice.
» Things to Try
Choose different voices and give them interesting things to say!
There is no command to pre-select a voice because the available voices differ from computer to computer.