Shop OBEX P1 Docs P2 Docs Learn Events
Piano Game — Parallax Forums

Piano Game

jmal0024jmal0024 Posts: 11
edited 2010-03-11 22:58 in Propeller 1
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

  • trodosstrodoss Posts: 577
    edited 2010-03-10 19:56
    @jmal0024,

    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
  • Spork FrogSpork Frog Posts: 212
    edited 2010-03-10 20:18
    @jmal0024,

    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
  • jmal0024jmal0024 Posts: 11
    edited 2010-03-10 20:40
    Thank you guys for these suggestions.
    @ 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.
  • Spork FrogSpork Frog Posts: 212
    edited 2010-03-10 23:23
    USB to MIDI for Hydra-PC communication should work just fine. As long as the interface to the Propeller is MIDI, you're good to go.
  • jmal0024jmal0024 Posts: 11
    edited 2010-03-11 02:40
    I'm sorry I'm still a little confused. Say Im coming midi out from a 16-note m-audio midi controller that controller need to be connected to the Pc or the hydra board?
  • jmal0024jmal0024 Posts: 11
    edited 2010-03-11 15:28
    Would I possibly be able to connect the keyboard I am using with a midi to usb cable to the mini usb port on the Hydra game console?
  • Spork FrogSpork Frog Posts: 212
    edited 2010-03-11 16:10
    The USB port on the Hydra is for programming only. It connects to the onboard USB-to-Serial converter, which is a USB slave device. Try to use it for anything else and the only thing you will do is break it. If you wanted to connect a USB-to-MIDI interface to your Hydra via the USB port, you'd need to add a USB host interface to your Hydra, which has not yet been done.

    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.
  • jmal0024jmal0024 Posts: 11
    edited 2010-03-11 16:48
    Ok, so basically lets say I use the m-audio controller and plug my midi in/midi out into the back of it and the other in of the cable which would be usb into the computer. Would the circuit designed for the hydra be connected to the same midi cables going into the keyboard or seperate cables. I also see that schematic and serial in/serial out connections are those pins assigned for that microcontroller?
  • jmal0024jmal0024 Posts: 11
    edited 2010-03-11 22:28
    Also still looking for serial in/out on this hydra board
  • Spork FrogSpork Frog Posts: 212
    edited 2010-03-11 22:58
    You'll have to build your own serial interface. Easiest way to do that would be to construct the circuit from the schematic on the other page I linked on a breadboard or perfboard, and connect the in/out on the circuit diagram to the Hydra through the expansion slot. A 2x10 female header, like this one, soldered onto the EEPROM card or blank expansion card, makes this easy.

    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.)
Sign In or Register to comment.