Monday, January 30, 2012

Maximite Sound Example

The Maximite can make sound using the 'SOUND' command. The SOUND command accepts a frequency to play for the sound and a duration to play that sound.

MMIDE has an Applet that plays Ode to Joy.

On the CGMMSTICK1 the audio connection is NOT on J1 along with all of the port lines. Instead it is at the top of the board on an unpopulated header named J5.

On J5 the top connection is ground, the bottom (square) hole is the audio line.

If you have a small amplifier, you can connect the amp to these two lines and run the Ode to Joy Applet that is in MMIDE.

CGMMSTICK1 audio connection.
Using the Ode to Joy Applet in MMIDE to play a tune.


The Ode to Joy Applet downloads a MMBasic program to the CGMMSTICK1 and then runs that program. Below is the program that is sent. You might notice that there is a test for data where the frequency could be 0. If the frequency is 0 no note is played, just a delay.

I asked my 15 year old son to write this program. He used a frequency/note chart to get the frequencies right, but the notes for Ode to Joy were in his head – he didn't have to look them up.

His frequency table was a little bit different than the table that I reproduced after the program below.

10 FOR a=1 TO 65
20 READ fr,du
30 IF fr=0 THEN
40 PAUSE du
50 ELSE
60 SOUND fr,du
70 ENDIF
80 PAUSE du
90 PAUSE 30
100 NEXT a
110 DATA 493.88,300,493.88,300
120 DATA 523.25,300,587.33,300
130 DATA 587.33,300,523.25,300
140 DATA 493.88,300,440.00,300
150 DATA 392.00,300,392.00,300
160 DATA 440.00,300,493.88,300
170 DATA 493.88,450,440.00,200
180 DATA 440.00,300
190 DATA 0,200
200 DATA 493.88,300,493.88,300
210 DATA 523.25,300,587.33,300
220 DATA 587.33,300,523.25,300
230 DATA 493.88,300,440.00,300
240 DATA 392.00,300,392.00,300
250 DATA 440.00,300,493.88,300
260 DATA 440.00,450,392.00,200
270 DATA 392.00,300
280 DATA 0,200
290 DATA 440.00,300,440.00,300
300 DATA 493.88,300,392.00,300
310 DATA 440.00,300,493.88,150
320 DATA 523.25,150,493.88,300
330 DATA 392.00,300,440.00,300
340 DATA 493.88,150,523.25,150
350 DATA 493.88,300,440.00,300
360 DATA 392.00,300,440.00,300
370 DATA 293.66,550
380 DATA 0,200
390 DATA 493.88,300,493.88,300
400 DATA 523.25,300,587.33,300
410 DATA 587.33,300,523.25,300
420 DATA 493.88,300,440.00,300
430 DATA 392.00,300,392.00,300
440 DATA 440.00,300,493.88,300
450 DATA 440.00,450,392.00,200
460 DATA 392.00,300



Note/Frequency Table for SOUND command
Note Frequency
C 16.4
C sharp / D flat 17.3
D 18.4
D sharp / E flat 19.5
E 20.6
F 21.8
F sharp / G flat 23.1
G 24.5
G sharp / A flat 26
A 27.5
A sharp / B flat 29.1
B 30.9
C 32.7
C sharp / D flat 34.7
D 36.7
D sharp / E flat 38.9
E 41.2
F 43.7
F sharp / G flat 46.3
G 49
G sharp / A flat 51.9
A 55
A sharp / B flat 58.3
B 61.7
C 65.4
C sharp / D flat 69.3
D 73.4
D sharp / E flat 77.8
E 82.4
F 87.3
F sharp / G flat 92.5
G 98
G sharp / A flat 104
A 110
A sharp / B flat 117
B 123
C 131
C sharp / D flat 139
D 147
D sharp / E flat 156
E 165
F 175
F sharp / G flat 185
G 196
G sharp / A flat 208
A 220
A sharp / B flat 233
B 247
C 262
C sharp / D flat 277
D 294
D sharp / E flat 311
E 330
F 349
F sharp / G flat 370
G 392
G sharp / A flat 415
A 440
A sharp / B flat 466
B 494
C 523
C sharp / D flat 554
D 587
D sharp / E flat 622
E 659
F 698
F sharp / G flat 740
G 784
G sharp / A flat 831
A 880
A sharp / B flat 932
B 988
C 1047
C sharp / D flat 1109
D 1175
D sharp / E flat 1245
E 1319
F 1397
F sharp / G flat 1480
G 1568
G sharp / A flat 1661
A 1760
A sharp / B flat 1865
B 1976
C 2093
C sharp / D flat 2217
D 2349
D sharp / E flat 2489
E 2637
F 2794
F sharp / G flat 2960
G 3136
G sharp / A flat 3322
A 3520
A sharp / B flat 3729
B 3951





Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

No comments:

Post a Comment