Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » MIDI in Allegro 5

This thread is locked; no one can reply to it. rss feed Print
 1   2 
MIDI in Allegro 5
Mark Oates
Member #1,146
March 2001
avatar

There has been discussion, but I'm wondering what the current sentiment is to include MIDI routines in Allegro 5. I think that playing MIDI files (with the systems soundboards) is not all that compelling, but using MIDI information, and commands possibly with controllers and such would be very useful.

Ideas? :)

My simple proposal would be to port the MIDI cross-platform API in Allegro 4 into Allegro 5.

beoran
Member #12,636
March 2011

Hmm, I think even playing midi files would be useful, if the sound bank used for rendering can be set somehow. It could allow mosic that is composed algoorithmically. Maybe some library like this one could be useful? http://portmedia.sourceforge.net/

Chris Katko
Member #1,881
January 2002
avatar

I wouldn't personally bother with Allegro + MIDI since MIDI doesn't even touch anything related to audio streams like ALSA / PulseAudio / etc.

What would you want to use MIDI for? And if not for games, I think it would be better suited to a "controller library" or at the very least an extension / addon library to Allegro 5.

Having MIDI support in 2014 is like having ScreamTracker support but even less need.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

beoran
Member #12,636
March 2011

Actually, with Dumb, we do already support ScreamTracker module music files. That's why I don't see any harm in also supporting MIDI, if the support is properly programmed and well documented. But yes, this would probably best work as an add-on.

Mark Oates
Member #1,146
March 2001
avatar

MIDI is still widely used to communicate between other devices for input/playback. It's a protocol that I use(d?) on a regular basis and if I were ever to develop music educational games, I would most definitely use MIDI to interface with controllers.

If I wanted to, I could probably use Allegro's MIDI interface to control FLStudio. Software samplers in stand-alone mode use MIDI, and it would be neat to use Allegro as a library to host a software sampler. 8-)

Also, These could be some pretty cool controllers for games. :)

Chris Katko
Member #1,881
January 2002
avatar

Quote:

Also, These [www.google.com] could be some pretty cool controllers for games. :)

Okay, that makes a lot more sense. I wasn't sure what you were trying to accomplish. Custom / exotic controllers have always been one of my favorite things.

I always wanted one of these as a kid:

http://daviddemar.files.wordpress.com/2012/06/76817-noscale-23214-steelbattalioncontroller.jpg

If I end up doing any custom controller "drivers", I'll add them to Allegro myself while I'm at it and submit a patch. I'm a big fan of using Arduinos as human-interface devices.

One HID I always wish they had was a (PC) keyboard with pressure sensitive keys, if only a few. Like even if it were expensive to do all the keys, then just pressure sensitive WASD keys so you can keep a keyboard layout but still have fine control over your strafing/movement.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Gideon Weems
Member #3,925
October 2003

Quote:

Also, These [www.google.com] could be some pretty cool controllers for games. :)

Ahh... Suddenly, I want MIDI support, too.

At the same time, why open a can of worms on Allegro? It's not Allegro's fault somebody out there makes game controllers with esoteric interfaces.

Chris Katko
Member #1,881
January 2002
avatar

It's not Allegro's fault somebody out there makes game controllers with esoteric interfaces.

Why... not? If someone wants to put the work in, at the very worst, it'd be an Allegro addon.

I also want multiple mice/keyboard support for Allegro, and if I wasn't stretched so thin between my RTS game, my submarine, work, and a thousand family problems, I'd have written the driver already.

It hurts my brain that nobody has bothered to create an RTS interface that combines a mouse/keyboard with a touchscreen monitor (that's NOT used simply as a touch "mouse").

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Thomas Fjellstrom
Member #476
June 2000
avatar

I also want multiple mice/keyboard support for Allegro, and if I wasn't stretched so thin between my RTS game, my submarine, work, and a thousand family problems, I'd have written the driver already.

A couple people have been thinking about a genericified input api, that supports multiple types of input devices, as well as multiple instances of each type. keyboards, mice, controllers, etc. No real work has gone into it... I haven't even put in any real thought into what the event structure for that would look like :(

--
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

Chris Katko
Member #1,881
January 2002
avatar


I haven't even put in any real thought into what the event structure for that would look like :(

It shouldn't be that hard. With the exception of PC keyboards, everything reports a combination of buttons, a relative axes, and absolute axes. Keyboards could be mapped to serial character output from a "104-button joystick," but that's kind of overkill.

Velocity sensitive musical keyboards are a bit of an issue. But then again, if you allow a button to have a value tagged with it (in addition to pressed), then that covers velocity/pressure/etc.

I'm not aware of any input device that needs more than one value attached per button press (pressure + velocity), but that could either be explicitly handled or reserved for macro DEFINEs for the few people who would actually use them.

Mouse gestures complicate things. I'm not sure how those work, whether they're a layer on top of the mouse x/y, or they get sent separately. Personally, I hate them.

Mouse button presses can include a pressure value as well to cover drawing tablets. I've long wanted to use those for an RTS game (I've got one, again, no time at the moment.)

What would be fun would be to have Lua (or whatever) script support to define generic "controllers" and the data they need so we can literally just plug an Arduino in, write HID_ARDUINO in the script type, and start defining "if(axis0 == 100)send_event(KEYBOARD_CHAR_A);".

What I mean is, an Allegro game expresses "things to be controlled" and their type. Then we use Lua to bind our input from our joystick/etc to event calls to those exposed functions. That way, people could literally add their own controllers to a new game without having to recompile it or have access to the code. They could also technically "abuse it" to write key pressing AI if we expose data outputs from the game.

Lastly, of course we'd have to define outputs as well for force feedback, audio to Wii controller speakers, LED flashing, and so on.

I'd be willing to work on such a library extension if other people are interested. Haptic Feedback / User Interfaces have always been a strong interest of mine.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Thomas Fjellstrom
Member #476
June 2000
avatar

Don't forget touch screens, and multi touch.

Theres also a haptic api in the works. Might want to coordinate with Beoran on that?

--
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

Chris Katko
Member #1,881
January 2002
avatar

Don't forget touch screens, and multi touch.

I think I mentioned touch screens. It's just a mouse as long as you track movement while a button is pressed (or always with a "mouse_history_length * sampling_interval").

Multi-touch is interesting. I guess each mouse could have multiple relative/absolute "points" it returns. So point_0.xy is normal mousing, but another finger and point_1.xy is updated now.

We could add a gesture recognition layer on top of that, and again, technically we could have scripts so people can add their own "this gesture=KEY_T"

That way, technically, we could even have gestures that span non-traditional interfaces like wiggling a rotary knob on your MIDI keyboard.

Since this "library" could have many many applications, it might not be wise to rigidly combine it with Allegro. Allegro is more for gaming, and this could be for anything and people might not want the graphical overhead of Allegro, or perhaps use a different graphics library. Obviously, we would use Allegro, but someone might want something lighter-weight as say, a Many HID->TCP bridge Raspberry Pi--I don't know. I'm just trying to think ahead.

You guys have got me interested. I'm going to start thinking about some data structures. This is rather timely, I've even written a document a week or two ago about controllers. I've long wanted to make a steering wheel complete with turn signals, as well as a realistic shifter knob from one of my old cars, and 3-pedal (gas, brake, clutch) board for a game that involved realistic clutch use (Sierra's Drivers Education 99 meets GTA)

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

beoran
Member #12,636
March 2011

Oh, it's about using MIDI for input? That's a different story. A generic input API would could be nice, and integrate better with the haptic API I'm developing.

Chris, you want to make your own steering wheel, perhaps with force feedback? If you implement it according to he USB standards for joysticks and force feedback devices, (google to find them) your home brew device will work immediately under Linux without needing a new driver.

Dizzy Egg
Member #10,824
March 2009
avatar

I could probably use Allegro's MIDI interface to control FLStudio

....huh?

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Chris Katko
Member #1,881
January 2002
avatar

I don't understand what you're confused about. ???

MIDI is first, and foremost a music device control format. If Allegro outputs MIDI messages, FL Studio can pick them up and control instruments.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Dizzy Egg
Member #10,824
March 2009
avatar

Yeah....I was thinking a bit more technical than that Chris...how are you going to 'control FLStudio'...using midi...you may be able to get your midi into one of the scores, but how you're going to get midi via an IL_Bridge into FL to control it...

...I repeat, huh?

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Thomas Fjellstrom
Member #476
June 2000
avatar

MIDI can be transferred over midi cables, or usb. Many physical midi devices can connect to a computer, and then programs can connect to those devices.

--
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

MiquelFire
Member #3,110
January 2003
avatar

So, a USB loop back device?

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
Windows 8 is a toned, stylish, polished professional athlete. But it’s wearing clown makeup, and that creates a serious image problem. ~PCWorld Article

Thomas Fjellstrom
Member #476
June 2000
avatar

I imagine FL Studio can create a virtual midi device that allegro can open and write to. timidity on linux can.

--
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

Dizzy Egg
Member #10,824
March 2009
avatar

...yeah...I'm not really making my question clear here...I know what midi is, I have several midi instruments (also, not sure if you knew but I've been making music for a while....)

My question is more specifically regarding FL Studio, which uses IL_Bridge's to overcome the 4Gb RAM limit it has...I'd like to know (from a programming perspective) how in the name of our lord Yevon you would "control FL studio" by using a midi device...

...just forget it. I'm annoyed now. >:(

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Thomas Fjellstrom
Member #476
June 2000
avatar

Dizzy Egg said:

My question is more specifically regarding FL Studio, which uses IL_Bridge's to overcome the 4Gb RAM limit it has...I'd like to know (from a programming perspective) how in the name of our lord Yevon you would "control FL studio" by using a midi device...

Hm, well I've not used it much at all. But I'm assuming it supports the midi command set in some way, and allows you to connect to a midi device, or export a virtual midi device for other programs to talk to it.

I could be wrong, but it'd be a little weird if it didn't support that.

--
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

beoran
Member #12,636
March 2011

This library looks like it could be useful or relevant:

http://midishare.sourceforge.net/

Trent Gamblin
Member #261
April 2000
avatar

I would like to use MIDI for music if I could use SF2 soundfonts. Right now I use BASS which supports all platforms I need but if Allegro supported it I would be more likely to use it.

With MIDI, we have an entire action RPG (Zelda style) that's around 10MB to download.

beoran
Member #12,636
March 2011

Yeah, midi files are very compact and can sound nice with good sound fonts. I assume you mean this BASS: http://www.un4seen.com/? Interesting, but commercial software. Might be quite a challenge to replace all that functionality with some open source library.

Trent Gamblin
Member #261
April 2000
avatar

That's the BASS I use. I doubt Allegro will ever compete unless someone (would probably have to be me) wants to do a ton of work without much gain (over paying for BASS/fmod licenses).

 1   2 


Go to: