MIDI Computer Blues - V2.0
midi computer blues rs232 arduino 850
After hearing Computer Blues through a MIDI synthesizer, I can understand how some parents feel while hearing their child's first recital. Its not so much listening to the music as it is hearing the potential.
It is in this spirit that I post these zipped sound files.
Atari computer blues 8.m4a - the original sound from the A8 with 8 as the speed
Midicb piano.m4a - recorded the Casio CKT-481 synth at speed 1
Midich organ.m3q - Organ sound
Midich organ and drum - Organ with drum pattern.
computer blues.zip (11.17MB)
Download this for the .ATR of the A8 files and the Arduino sketch.
MIDI CB - program .zip (11.41KB)
The technical side:
I wanted to make as few changes to the original program as possible. Follow along with a listing of the program CBMIDI2.BAS.
1000-1050 Data statements were converted from Atari pitch values to MIDI Note numbers.
9 consolidate lines 1-6 and move 8 to 15. Free up some line numbers at beginning of program.
1 REM program title information.
2 GOSUB 3000 sets up RS232 port for output to Arduino.
3000 Open R2: at 9600 baud - no translation
2500 Send MIDI command data subroutine
Replace SOUND command with data setup and call to 2500 subroutine
260 CMD=144:MIDINOTE=JAM(CHORD,NT),VELOCITY=NT*10+65:GOSUB 2500
535 CMD=144:MIDINOTE=LOW(CHORD):VELOCITY=60:GOSUB 2500
540 CMD=144:MIDINOTE=BASE(CHORD,THNOT):VELOCITY=60:GOSUB 2500
700 CMD=128:MIDINOTE=LOW(CHORD):VELOCITY=0:GOSUB 2500
710 CMD=128:MIDINOTE=BASE(CHORD,THNOT):VELOCITY=0:GOSUB 2500
At this point the Computer Blues music was recognizable, although slow. The synth is able to play up to 16 notes at a time. This allowed 14 melody notes (+2 for the base) to be playing at the same time. When the 15 note was added the first note would tuned off. The following line was added to turn off the melody note before playing the next. Once in a while you'll notice that a note duration seems to be shortened. When the LASTNOTE = MIDINOTE, line 265 will turn off the melody note that was just started in line 260. This little quirk didn't degrade the song quality and may perhaps improved it.
265 CMD=144:MIDINOTE=LASTNOTE:VELOSITY:0:GOSUB 2500:LASTNOTE=JAM(CHORD,NT)
The original goal of this project has been reached. It is possible to write Atari BASIC programs that can output MIDI data to a MIDI device, if you have an 850 and an Arduino with RS232 in/MIDI out. The speed of BASIC and the 850 interface will definitely impact most results. Trying to optimize the Atari BASIC code should increase its functionality. Then you also have to ask what happens when you let the Arduino do some of the work?
Of course you could port Computer Blues directly into the Arduino, but where's the fun in that?
Links to the two proceeding blogs
Testing the Hardware.