Re: [AD] midi length + midi frequency

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


To answer your MIDI timer question...

Let's take a standard song of 120 beats per minute...

That means that there are 120 beats in 60 seconds, or 120 quarter notes every 60 seconds.

So that's 2 quarter notes per second.

Therefore, there are 4 eighth notes per second, 8 sixteenth notes per second, 16 thirty second notes per second, and 32 sixty fourth notes per second. So yes, if the midi timer updates 40 times a second, it can play all 64th notes of a song with a BPM of 120. There's a point however, that the human ear stops distinguishing the time intervals between notes. =P

If Allegro buffers midi info so that in the end all notes are played even though some are crunched together if they are less than 1//40th of a second apart, there shouldn't be a problem.

I also believe that the playback of notes wouldn't be the biggest thing effected by a timer that's too slow. Many MIDIs use envelopes to increase the volume or pitch of notes, and many of those act as a curve being updated every 1/100th of a second. But like I said, I don't think the human ear can distinguish, so it's OK.
Elias Pschernig wrote:

In response to a request on [Al], attached is a patch which adds a
function get_midi_length(). While making it, I noticed that the midi
player only is called 40 times / second. I understand nothing of music
at all, but I know there are sometimes 64th notes in music (now if that
means they are 1/64th second long, I don't know) - anyway, it was easy
to do, so I added another function to change the maximum timer frequency
the midi player uses. I tried changing it to 64 with some midis I found,
but can't here any difference to 40.. so maybe this is quite unrelated
after all.





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/