Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
How to play a complete music chord, for example a C major chord, instead of playing the separate notes.
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.
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.
Anonymous
March 12, 2016
Good idea, Yvan. Thanks litdev.
Anonymous
March 12, 2016
This is pretty awesome! Incredibly creative!
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in