Making music in Basic 7.0 part 4

Apart from PLAY, the commands that are available for making sounds and music are TEMPO, ENVELOPE, SOUND and FILTER.

TEMPO lets you control playback speed. The slowest is 1 and the fastest is 255.

ENVELOPE lets you modify the ten predefined instruments. You set the instruments using the T control character (0 to 9). The arguments are:

– The instrument you want to overwrite (0 to 9)
– Attack rate (0 to 15)
– Decay rate (0 to 15)
– Sustain level (0 to 15)
– Release rate (0 to 15)
– Waveform (0=triangle, 1=sawtooth, 2=square with adjustable pulse width, 3=noise, 4=ring modulation)
– Pulse width (0 to 4095) – only relevant if waveform is set to 2.

This program creates 5 similar instruments that differ in pulse width, and uses them in a simple riff.

10 ENVELOPE 0,0,5,0,0,2,100
20 ENVELOPE 1,0,5,0,0,2,300
30 ENVELOPE 2,0,5,0,0,2,500
40 ENVELOPE 3,0,5,0,0,2,700
50 ENVELOPE 4,0,5,0,0,2,900
60 TEMPO 40
70 PLAY "V1O2Q"
80 FOR I=1 TO 2
90 PLAY "T0CCT1CCT2CCT3CCT4CCT3CCT2CCT1CC"
100 NEXT

Click here to listen.

Leave a Reply

Your email address will not be published. Required fields are marked *