Quantcast
Channel: Small Basic
Viewing all articles
Browse latest Browse all 669

Small Basic – Chord Sounds

$
0
0

This blog is by Small Basic user Yvan Leduc and is based on this Forum Post.  It shows how to play musical chords in Small Basic just using the standard Sound.PlayMusic method.

Objective

How to play a complete music chord, for example a C major chord, instead of playing the separate notes.

Solution

A full sample program is provided with the publish code, NNP250.  It plays the first staves of a piece for classical guitar written by Matteo Carcassi: Study No.6 Op60.

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

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.

Thanks Yvan for sharing this.


Viewing all articles
Browse latest Browse all 669

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>