RSS Bot Posted October 13, 2016 Share Posted October 13, 2016 Playing MIDI notes has turned out to be quite easy for Atari BASIC through the RS232-Arduino-MIDI OUT (RAMO) interface (see previous posts in this blog). Most MIDI instruments have additional functions beyond receiving the note ON and note OFF commands. Each MIDI instrument should come with a MIDI Implementation Chart (MIDI-IC) that will indicate which functions are implemented. The MIDI-IC for the CASIO CTK-481 will be used to build some BASIC programs to control the CTK-481. That is to say, the A8 will be programed to be a MIDI controller for each of the functions. Later, one program to rule them all can be written. Download a copy of the CASIO CTK-481 MIDI implementation chart if you want to follow along. This text on how to read the MIDI Implementation Chart can be very handy.http://midi-tutor.proboards.com/thread/119/interpret-midi-implementation-chart And a copy of the MIDI 1.0 Specification Message Summary will have the bit by bit format for each of the functions.https://www.midi.org/specifications/item/table-1-summary-of-midi-message We will be most concerned with the Recognized column for this CASIO. The RAMO interface will only output data from the A8. The Casio will be receiving data and act upon the data that it recognizes. Basic Channel, Mode, Note Number and Velocity have been used in the MIDI Computer Blues and Wind Chimes programs. Manipulating the Pitch Bender seems to be a most logical place to start. Pitch Bender is used to change the pitch of the note. Pitch Bend uses a 14 bit number to represent its position and normally the wheel is spring loaded to return to center. The center is at 8192 and values can range from 0 to 16383 decimal. The Midi Specification Message Summary defines the command being 1110nnnn,0lllllll,0hhhhhhh (124+midi channel-1,least significant 7 bits, most significant 7 bits). The program sets a number for the pitch bend within a FOR-NEXT loop. If you've ever made changes to the SOUND command variables, you know how addictive experimentation can be. The recording is of the CASIO with the organ tone. A few keys were played and then played with the program running. (Warning: I'm no keyboardist) PB01.BAS 100 GOSUB 30000140 FOR X=1 TO 5000 STEP 1000150 PITCHBEND=2192+X160 PBH=INT(PITCHBEND/128)170 PBL=PITCHBEND-(PBH*128)180 PUT #1,224:REM PB COMMAND+CHANNEL190 PUT #1,PBL200 PUT #1,PBH215 NEXT X220 GOTO 14030000 CLOSE #1:OPEN #1,9,0,"R2:":XIO 36,#1,14,0,"R2:":XIO 38,#1,32,0,"R2:":XIO 40,#1,0,0,"R2:":RETURN Control Change Messages are a set of controls that can be set between 0 - 127. The MIDI standard defines numbers for many of the controls. A control change message consists of the control change command number and MIDI Channel, the assigned controller number, and then the value. (1011nnnn,0ccccccc,0vvvvvvv) Modulation is controller #1. It is much like pitch bend but has a reduced sensitivity. I'm not hearing a big difference in the tone when using this controller. The code follows the prescribed output parameters and I think I can hear a slight difference. MOD01.BAS 100 GOSUB 30000110 CCHANGE=176+0:REM COMMAND+CHANNEL120 MODULATION=1:REM CONTROLLER #140 FOR VALUE=1 TO 127 STEP 25180 PUT #1,CCHANGE190 PUT #1,MODULATION200 PUT #1,VALUE215 NEXT VALUE220 GOTO 14030000 CLOSE #1:OPEN #1,9,0,"R2:":XIO 36,#1,14,0,"R2:":XIO 38,#1,32,0,"R2:":XIO 40,#1,0,0,"R2:":RETURN Volume is controller #7: it changes the volume of the channel. Cool if you do it right. VOL01.BAS 100 GOSUB 30000110 CCHANGE=176+0:REM COMMAND+CHANNEL120 VOLUME=7:REM CONTROLLER #140 FOR VALUE=1 TO 127 STEP 25180 PUT #1,CCHANGE190 PUT #1,VOLUME200 PUT #1,VALUE215 NEXT VALUE220 GOTO 14030000 CLOSE #1:OPEN #1,9,0,"R2:":XIO 36,#1,14,0,"R2:":XIO 38,#1,32,0,"R2:":XIO 40,#1,0,0,"R2:":RETURN Hold1 if controller #64. Some controllers can be set with a range and some are on or off. Hold1 is on or off. OFF is 0 and ON is any other number(sometimes?). A good rule is to set ON as 127.Listening to the sound file, you should be able to tell when the Hold is on and when it is off. HOL01.BAS 100 GOSUB 30000105 DIM A$(1)110 CCHANGE=176+0:REM COMMAND+CHANNEL120 HOLD1=64:REM CONTROLLER #130 HOLDON=127:HOLDOFF=0140 IF VALUE=HOLDON THEN VALUE=HOLDOFF:GOTO 180150 IF VALUE=HOLDOFF THEN VALUE=HOLDON180 PUT #1,CCHANGE190 PUT #1,HOLD1200 PUT #1,VALUE210 IF VALUE=HOLDON THEN PRINT "HOLD ON"215 IF VALUE=HOLDOFF THEN PRINT "HOLD OFF"220 INPUT A$230 GOTO 14030000 CLOSE #1:OPEN #1,9,0,"R2:":XIO 36,#1,14,0,"R2:":XIO 38,#1,32,0,"R2:":XIO 40,#1,0,0,"R2:":RETURN Program Change is used to set the tone for the channel. The Casio has 99 tones listed for the default bank. There is a General MIDI tone map setting that can be accessed using the buttons on the unit. The GM tone can be set from 0 to 127. The computer transmits 2 bytes to accomplish a program change. The Program change number(192) + (channel # -1) and the tone #. The basic program fills an array with tone numbers and then changes the tone after the number (1-5) is inputted. The tone changes in the sound file are noticeable. PC01.BAS 100 GOSUB 30000104 DIM PATCH(5)105 PATCH(1)=89:REM CHOIR STR106 PATCH(2)=10:REM E.ORGAN 1107 PATCH(3)=16:REM REED ORG108 PATCH(4)=30:REM VIOLIN109 PATCH(5)=39:REM VOICEOOH110 PROGRAMCHANGE=192+0:REM COMMAND+CHANNEL130 ? "INPUT NUMBER 1-5"140 INPUT X180 PUT #1,PROGRAMCHANGE190 PUT #1,PATCH(X)230 GOTO 14030000 CLOSE #1:OPEN #1,9,0,"R2:":XIO 36,#1,14,0,"R2:":XIO 38,#1,32,0,"R2:":XIO 40,#1,0,0,"R2:":RETURN That covers all the "O" on the CASIO CTK-481's MIDI-IC. The only thing not covered were the channels it recognized. The Keyboard uses one channel but data can be sent to channel 1,2,3,4 and 10 using the computer. Just add the channel# -1 to the command function number. Which means the three parts of Computer Blues could be sent to three different channels. Two channels for the base and maybe the VOICEOOH for the lead (and one more for the drums). The Yamaha TG-33 has many more "O"s on its MIDI-IC. I'm going to need a rest before I start on the one program to rule them all. Sound files: ATR with basic programs: Attached File(s) CASIO CTK-481 MIDI Implementation Chart.pdf (532.46KB)Number of downloads: 0 midi control programs_atr.zip (14.19KB)Number of downloads: 0 Sound files.zip (3.99MB)Number of downloads: 0 http://atariage.com/forums/blog/572/entry-13352-implementing-the-midi-implementation-chart/ Link to comment Share on other sites More sharing options...
Recommended Posts