Shop OBEX P1 Docs P2 Docs Learn Events
midi file player — Parallax Forums

midi file player

StevenRStevenR Posts: 13
edited 2009-12-27 19:58 in Propeller 1
I've loaded a type-0 MIDI file into the prop's paged memory. The problem is I find that I cannot read bytes from paged memory fast enough to output the parsed MIDI data out the MIDI port.

Clearly I need to be loading the file into faster memory. Is there a way to use the prop chip with faster memory?

Tnx.

Comments

  • James LongJames Long Posts: 1,181
    edited 2009-12-27 07:38
    StevenR said...
    I've loaded a type-0 MIDI file into the prop's paged memory. The problem is I find that I cannot read bytes from paged memory fast enough to output the parsed MIDI data out the MIDI port.

    Clearly I need to be loading the file into faster memory. Is there a way to use the prop chip with faster memory?

    Tnx.

    Steven,

    I'm not sure what problem you are having, but it is quite easy to output Midi from the propeller. I have an output device which uses an uSD card to store the file, and output the Midi one event at a time.

    If you are using Spin the Propeller may not be fast enough to keep up with the 31250 bps rate at which midi runs.

    We would need to see your code to find the problem.

    The propeller is more than fast enough to output Midi. This is dependent upon your clock settings of course. If running without a 5MHz crystal, it may not be able to parse the data out fast enough.

    Look for Ariba's midi player on the forum. It will show you how well it works. His player will play a midi file directly from an SD card, using the demo board.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • StevenRStevenR Posts: 13
    edited 2009-12-27 13:53
    James,

    Thanks for your reply.

    Spin language is quick enough to output MIDI at 31250 and have no problem doing so.

    The problem I am having is reading bytes from the I2C eeprom quickly enough to keep up with the tempo required in the MIDI file.

    You actually answered my question by referring me to Ariba's MIDI player using the faster SD card memory.
  • AribaAriba Posts: 2,690
    edited 2009-12-27 18:01
    Steven

    An I2C EEPROM should be fast enough for MIDI, if it is read with 400 kHz SCL clock. I think you use the Spin I2C driver, and this makes it slow.

    So there are several solutions:
    1) Look at the obex for an assembly I2C driver (I don't know if this exists)
    2) Use 2 buffers in RAM and read the whole buffer from EEPROM while you play the other one.
    3) Because a MIDI File 0 is all sequential, you can send the EEPROM address only at begin, and then read all the bytes from EEPROM without STOP and START conditions in between. This makes byte read ~4 times faster.

    Andy
  • James LongJames Long Posts: 1,181
    edited 2009-12-27 19:58
    Ariba said...
    Steven

    An I2C EEPROM should be fast enough for MIDI, if it is read with 400 kHz SCL clock. I think you use the Spin I2C driver, and this makes it slow.

    So there are several solutions:
    1) Look at the obex for an assembly I2C driver (I don't know if this exists)
    2) Use 2 buffers in RAM and read the whole buffer from EEPROM while you play the other one.
    3) Because a MIDI File 0 is all sequential, you can send the EEPROM address only at begin, and then read all the bytes from EEPROM without STOP and START conditions in between. This makes byte read ~4 times faster.

    Andy

    Andy,

    There is not an I2C assembly driver yet. Mike Green has one in his Femtobasic, which is what I use.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
Sign In or Register to comment.