This article describes MML (Music Macro Language) in Sound.PlayMusic(MML) operation of Small Basic programming language.


(1) Pitch (A, B, C, D, E, F, G)

A ~ G of this command represent the pitch.  A = la, B = si, C = do, D = re, E = mi, F = fa, to G = sol.  By adding #, + (♯), - (♭) after this command can be expressed a semitone.

(2) Rest (R, P)

Both R and P commands specifie the rest.

(3) Tone length (Ln)

This command specifies the length of the tone.  N is the value of 1-64 and reciprocal of the length of the tone which 1 is the max length.  Subsequent command after this command is played in the specified same length.  When you add n after the tone or the rest, only the tone / rest is played with the length.


Do of quarter note ...... L4C or C4

Fa of sixteenth note ...... L16F#, F#16 or F+16

Sol ♭ of whole note ...... L1G- or G-1

(4) Octave (On,>,<)

This command specifies the octave.  N is an integer from 1-8.  In addition, the standard frequency 440Hz, the sound of la (A) is octave 4 (O4).  > is for octave up, < is for octave down.


MML in Small Basic doesn't have Tn command.  T is to change Tempo.  n is a number of quarter notes per one minite.  In Small Basic, n is always aproximately 150.

Sample Programs

Following samples should be run in your local Small Basic IDE (Integrated Development Environment).  Because Sound.PlayMusic() operation doesn't work in remote environment (with web browser).

Play MML


99 Bottles of Beer



Chord Wave Form

Measure Tempo of Sound.PlayMusic

Metronome for Sound.PlayMusic

See Also

Other Resources

Following blog article is the first information about MML in Small Basic.

Following blog article shows how to play musical chords in Small Basic.

Other Languages