PDA

View Full Version : midi file player



StevenR
12-27-2009, 09:00 AM
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.

James Long
12-27-2009, 02:38 PM
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 (http://www.lil-brother.com)

Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits (http://www.savagecircuits.com). Learn to build your own Gizmos!

StevenR
12-27-2009, 08:53 PM
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.

Ariba
12-28-2009, 01:01 AM
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 Long
12-28-2009, 02:58 AM
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 (http://www.lil-brother.com)

Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits (http://www.savagecircuits.com). Learn to build your own Gizmos!