◆ SD MIDI ][+

Using MIDI card on BASIC (2)

이안김 2022. 8. 3. 12:52

 

Before explaining the new MIDI command,

I asked last time you to learn about Note ON and Program Change.

Have you learned it?

You need to learn this 'Note ON' and 'Program Change'

 

As you tested it, It plays one single voice.

Now You can learn how to Play more voices at the same time.

For Example, to play Do Mi Sol at the same time,

In Piano, You have to push Do, Mi, Sol at the same time.

It could achieve just Keep push Do, Mi,Sol  note at the same time.

Pressing Keyboard is the 'Note ON'.

So, you just send this MIDI data.

And if you want OFF the sound,

Just send 'Note OFF' to the channel.

 

To play Notes, You have to Know the MIDI keyboard numbers as attached.

 

Find the Do, Mi, Sol and It is 60,64,67 

So add code as under..

10 AC = 49320 

20 AD = 49321 

100 POKE AC,19: POKE AC,17 

200 POKE AD,144: POKE AD,60: POKE AD,127

210 POKE AD,144: POKE AD,64: POKE AD,127

220 POKE AD,144: POKE AD,67: POKE AD,127

 

* This 144 is 'NoteON' MIDI  command

 

And Run it

 

]RUN

 

If you want a small delay between NOTE ON

 

205 GOSUB 300

215 GOSUB 300

299 END

 

300 FOR D=1 TO 100:NEXT D

399 RETURN

 

Now, You could have step Playing notes.

 

And now, you will learn about 'Note OFF'

Note off is release your keyboard.

Note ON is pressing the keyboard now release the keyboard is Note OFF.

 

You can do it as 80h+Channel

So if you want '1st channel Note OFF'

POKE AD,128: POKE AD,64: POKE AD,127

 

Then The sound would off the keyboard.

 

Now, you learned 

Note ON

Program Change

Note OFF

and simple delay.

 

It is a very simple guide and would like this MIDI approach by BASIC code.

For more tricks, You need to learn some more about MIDI commands.

Hope you enjoy it.

 

Thanks

Ian Kim