Piano Game
jmal0024
Posts: 11
I am new to the Hydra system and propeller game development and would like some insight on creating a game from all willing to help. What I am looking at doing is created a game that displays a piano on the gaming screen and also have a midi keyboard connected to the system that will output whats being pressed on the keyboard to screen and output the sound in real-time. Can anyone give me some insight on how difficult is with this system and advice if this can or cant be done. Thank you.
Comments
There is a MIDI object/project in the thread (Ariba's MIDI synthesizer object)·http://forums.parallax.com/showthread.php?p=797590··· OR (OBC's MIDI streaming player)·http://forums.parallax.com/showthread.php?p=802994·that might be of some use if you are wanting to work with actual MIDI emulation/streaming.
As far as building a keyboard/playing a tone, there is an example on the Hydra CD called "Piano Demo" (NS_sound_demo_052.spin) that may be what you are after already (minus the MIDI input, of course)
--trodoss
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the Propeller Powered SIG·fourm kindly hosted at Savage Circuits
Game(s) Mythic Flight
Utilities Font Editors (AIGeneric, Potato_Text, etc.)
Post Edited (trodoss) : 3/10/2010 8:07:58 PM GMT
I've actually done exactly what you are describing in the past while trying to make a MIDI event filter to use for live performance. I've attached my code to this post. Let me know if anything doesn't make sense.
MIDI is a very simple serial protocol, and once you understand the basic format of the data coming in (which is also fairy straightforward), you're good to go.
There are two excellent websites I used while making my programs:
www.srm.com/qtma/davidsmidispec.html
midistudio.com/Help/GMSpecs_Patches.htm
-Spork
@ spork frog, can I use a USB to midi to computer and then connect the Hydra board to the computer. Or would I have to make a connection between the keyboard and the system and then that one connection to the computer.
I'm pretty sure most of the M-Audio keyboards are MIDI over USB only, so if you want to connect to your Hydra, you'll need a different keyboard with a hardware MIDI interface built in. Or, as you mentioned, you can go through your computer, using a USB-to-MIDI adapter, with the USB end plugged into your PC.
To connect to the Hydra, you must use a pure MIDI interface -- that is, the end of the connector that has two 5-pin circular DIN plugs on it. You'll also need to construct a small circuit to interface the MIDI plugs to your hydra. You can find a schematic for that here.
As for pin assignments: On the Hydra, there are no hardware serial ports, so you can use pretty much whatever I/O pin you wish for your MIDI connections, provided you set up your software correctly.
For the MIDI connections, unless you explicitly need your PC to help in playing the game, I would recommend connecting your keyboard via the MIDI OUT directly to your Hydra, via a regular MIDI cable (the kind that has two 5-pin DIN connectors on each end.) If you need to use your PC, then the simplest solution would be to connect the keyboard to your PC via a USB-to-MIDI converter, then write software on the computer that communicates both with your MIDI keyboard and the Hydra. (The Hydra end is easy -- it shows up in Windows and most other operating systems as a serial port.)