Share via


Small Basic: How to produce a complete music chord using SoundPlay.Music

Introduction

After several searches on small basic forum, it appears that people have not found a way to make complete chords of music with the small basic command Sound.PlayMusic. Here in this article is the solution.

Objective

How to play 3 notes of music simultaneously, thus playing a full chord.

3 songs example to listen:

Moonlight Sonata by L.V.Beethoven : Small Basic program no: BNG565
full complete version of Moonlight Sonata  ( 69 measures )

For Elise  or ' Für Elise ' by L.V. Beethoven : Small Basic program no: HSS622


**
**

Study No.6 Op60. by Matteo Carcassi:  program no: NNP250

How it Works

As an example of a chord in the program, we look at a C major chord which plays 3 notes together.

Here is a full C major:

a[1]="o4l64 E" +"o6l64 C" +"o8l64 G" 'C major chords, 3 notes together

n[1]="o5l6 E"

It has two variables a and n, together they build the chord,

o4 = the octave on the keyboard

l64 = the duration of the note (very short)

E = the note

n= put a little extra C note 1 octave o5  , so the final chord as 4 notes. The duration of the chord all together is 16

E+C+G= C major on a piano.

and the final instruction that plays the chord is:

Sound.PlayMusic (a[t]+n[t])

This is placed in a For EndFor loop with other chords and notes.

References