Could someone help me with playing MIDI?
I know that getTimeFormat() returns ticks in quarter-note. But what about seconds?
How could I play MidiMessageSequence?
I’ve read Generic information about midi devices (not about midi files).
What should I read also?
Many thanks for your attention.
Maybe the convertTimestampTicksToSeconds() method is what you’re after…?
How to play a file depends on what you’re doing - to send it to a midi output, you’ll need to have a thread running that sends each note at the right time.
Thanks for replying.
Yes, you right about midi output and thread.
I have a MIDI file which contain only one track. Its length is 32 seconds.
The getEndTime() returns 18829 (I don’t rembeber right numbers).
If I use the convertTimestampTicksToSeconds() it returns 188.
I can’t link 32 seconds and 18829 (188) .
Don’t know - probably something going wrong with the tempo information. Try playing it and see what happens.
The algoritm is
- time = 0
- take time of first event
- while time < last event’s time
- sleep for this time
- send this event to out
- get time of next event
- if time is equal current time go to 5
- else loop
As you remember I have 188.
If I use it as milleseconds I’ll play the midi less then second.
It can’t be seconds (32 sec).
Also, I have group of events with 0 time, next group has 155 time.
Try loading it into tracktion and see what it looks like. That uses the same class to load it.
What is tracktion? I need more instructions.
well googling for “tracktion”, or going to http://www.tracktion.com might be a good start!