Playing a variable number of musical tracks

Post Reply
User avatar
Dutchman
Posts: 870
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Playing a variable number of musical tracks

Post by Dutchman »

I am working on a musical project in which a variable number of instruments will play together.
So the number of musical tracks for the NOTES SET command will vary from 1 to 8.
In the command 'NOTES SET A$,B$,... ' the tracks 'A$,B$,...' are strings and are separated by commas.
For a variable number of tracks, these strings can be elements of an array in which only the required number of strings is present and the rest of the array is empty. An example is in the following code:

Code: Select all

' Sound tracks by Dutchman
OPTION BASE 1

PRINT "How to play tracks in parallel"
'11=vibraphone, 56=trumpet
NOTES SET "11:qcdefga","56:irhceg"
NOTES PLAY
GOSUB Play

PRINT "now 'dummy' solution for 1 to 4 tracks"
Track$(1)="11:qcdefga"
Track$(2)="56:irhceg"
NOTES SET Track$(1), Track$(2), Track$(3), Track$(4)
NOTES PLAY
GOSUB Play
END
'===== subroutines
Play:
   IF NOTES_TIME() < NOTES_LENGTH() THEN play
RETURN
It solves my problem, but is there a better solution?

Post Reply