Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » midi_out() data format

Credits go to Johan Halmén for helping out!
This thread is locked; no one can reply to it. rss feed Print
midi_out() data format
Kikaru
Member #7,616
August 2006
avatar

I am going to try using midi_out() to make some sounds, and I was wondering, how does the data value affect the sound? (Meaning: what part tells instrument, what part tells tone, etc...)

Whenever I use it with plain numbers, it just crashes. :-/

Please help.

Thanks in advance! :)

Johan Halmén
Member #1,550
September 2001

I guess you won't come far if you don't study midi in general. Allegro's midi routines are more or less totally based on the midi standard. So google for some midi basics. Or buy a good book about midi.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Kikaru
Member #7,616
August 2006
avatar

Well, I guess that helps a little... Could someone direct me to a specific site that explains it? I couldn't find much that was useful...

Johan Halmén
Member #1,550
September 2001

This page
Look at the tables 1 - 4 (the links). They show the meaning of the numbers that you are supposed to output. I haven't tested midi and allegro on that level, but if I would, I know those pages would help a lot.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Thomas Fjellstrom
Member #476
June 2000
avatar

All midi_out does is directly send midi commands. So its as "standard" as your midi device is.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kikaru
Member #7,616
August 2006
avatar

Thanks Johan! That site is exactly what I was looking for!

Now, I was testing some midi stuff and I created the following variable:
unsigned char mid[3] = {144, 120, 1};
to use as data, then called it like this:
midi_out(mid, 1);
However, this makes no sound. It doesn't crash, just silence. I already called load_midi_patches(), so that isn't the problem. Any idea what's wrong?
Nevermind, found the problem. ;D

One final question: How do I change the instrument used by a channel?

Johan Halmén
Member #1,550
September 2001

If you don't find that in the pages I told you, you could search for a program that lists midi data as numbers. Anvil Studio is a midi sequencer program for Win that I use a lot. It's free. I think it can show the midi data contents of a midi file. I guess every midi file starts with the bank select and program/sound/instrument/patch select message for each of the channels that are used. I believe every channel that doesn't have these messages in the beginning, will just play the #0 instrument, which is a piano.

On my old Mac I use Micrologic Fun, which is absolutely great. If you don't find the codes for instrument change, I might find it when I next time use my equipment, but I can't promise it will be soon.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Go to: