28825 Parallax Inc, 28825 Datasheet - Page 5

MINI SOUND PLAYER SOUNDPAL

28825

Manufacturer Part Number
28825
Description
MINI SOUND PLAYER SOUNDPAL
Manufacturer
Parallax Inc
Datasheet

Specifications of 28825

Accessory Type
Sound Player
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
For Use With
28824 - SERVOPAL SERVO PULSER TIMER
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
beats per minute is from 133 to 1064. That makes the shortest sixteenth note 14ms long and the longest
dotted half note 677ms long. Although the fastest tempo is too fast for most music, it comes in handy for
certain non-musical sound effects.
Now we know how to express individual notes, but how do we make the SoundPAL play them? This is a
two-step process. First we have to get the notes into the SoundPAL. This is done by loading them into a
48-byte RAM buffer. Next, we have to tell the SoundPAL to execute (i.e. play) what’s in the buffer. Both
tasks are performed by issuing commands to the SoundPAL. The load command is an equal sign (=). It
tells the SoundPAL to put everything that follows it, up to and including the first zero byte, into the RAM
buffer. The execute command is an exclamation point (!). Every time the SoundPAL sees one of these, it
will execute the sounds in its buffer, stopping when it encounters the zero. For example, to play a simple
C major scale ending on a half-note, we would issue the following:
SEROUT iopin, baud, ["=", C_1, D_1, E_1, F_1, G_1, A_1, B_1, h+C_2, 0, "!"]
To specify an octave or tempo other than the defaults, just prepend an octave or tempo command to the
sound sequence you want played that way. In the following example, the arpeggio C, E, G, C is played in
the highest octave at the lowest speed:
SEROUT iopin, baud, ["=", oct3, tmp0, h+C_0, h+E_0, h+G_0, h+C_1, 0, "!"]
Style
In addition to pitch and duration, notes can be played in one of four different styles. These are named
marcato, legato, staccato, and glissando. (Musical nomenclature is, by custom, in Italian.) Marcato
is the default style and simply means that the notes played are demarcated by brief silences between
them. That way, two notes in sequence having the same pitch will be heard separately. By contrast,
notes played legato follow each other without intervening gaps. Two sequential notes having the same
pitch and played legato will sound like one long note. At the other extreme, notes played staccato all
have the same, very short length, with the remaining time (defined by the note duration) being filled by
silence. And finally, notes played glissando are not only played legato, but their pitches also slide into
one another, as though they were being played by a trombone or slide whistle. Glissando style is used
mostly for sound effects, such as the siren and wolf whistle included in the SoundPAL’s canned
sequences.
To choose a playing style, all you have to do is prepend a style command to the sequence you want to
play in that style. For example, to play “Mary Had a Little Lamb” in staccato, you’d do the following:
SEROUT iopin, baud, ["=", staccato, E_0, D_0, C_0, D_0, E_0, E_0, E_0, 0, "!"]
When glissando is chosen as the playing style, you can choose from one of 15 glide rates, ranging from
gl1 (fastest) to gl15 (slowest). Selecting a glide rate by including the glide rate constant in a note
sequence automatically selects glissando as the playing style, so you don’t have to do that separately.
The following example shows how the SoundPAL defines a “wolf whistle”:
SEROUT iopin, baud, ["=",legato,S+G_0,gl2,h+G_1,ZZZ,legato,S+G_0,gl4,C_1,h+C_0,0, "!"]
On thing to note from this example is the use of the legato style. This is used ahead of the notes that
you don’t want to glide into. In other words, these notes will begin at their defined pitch but, because of
the subsequent gl2 and gl4 commands, glide into the notes that follow.
Sometimes you want to play most of a tune marcato or staccato, but occasionally there will be two or
three notes that you want to play legato. In musical parlance, this is known as a slur when the two
notes have different pitches, or a tie when they have the same pitch. To this end, the SoundPAL has a
special style command called slur which is just a legato applied to the next note only, causing it to
© Parallax, Inc. • SoundPAL (2007.10.29)
Page 5 of 12

Related parts for 28825