We continued our Small Basic lesson, focusing on composition of music. The sub-language for writing music in SB is simple in its construction, asking that you supply an octave, CDEFGAB notes, and the length of each individual note.
Small Basic offers a simple syntax for programming music.
This syntax includes an octave (optional; if one is not
supplied, octave 4 will be assumed), followed by a series
of CDEFGAB notes with a number signifying the length of the
note, such as the sequence in the example below, which is
the sequence for a snippet of Twinkle Twinkle Little
Star
.
In Small Basic, this sequence is interpreted in the format of a string, which would be enclosed in double-quotation marks.
Copy and paste the following code into a Small Basic text editor and press F5 to run the program.