Re: midi re-tempoizer

[email protected] (zentara) Fri, 10 Dec 2004 05:42:10 -0500
Newsgroups perl.midi
Message-ID <[email protected]>
On Thu, 9 Dec 2004 22:00:41 +0000, [email protected] (Jean-Pierre
Vidal) wrote:

>Le jeudi 9 Décembre 2004 11:08, zentara a écrit :

>> Your script runs without error for me, and on some midi
>> files gives the correct time. 
>> 
>> But I often get
>> 0 mn 0.0 s
>> as output.
>> 
>> From a quick check of differences between files that work, and
>> those that give  0 0, it seems the problem is with midi files that
>> have NO 'set_tempo' in them.
>> I put a print in to test various files
>>      for my $note (@$score_r) {
>>               if($$note[0] eq 'set_tempo'){print $$note[0],"\n"}
>> 
>> and if it had no set_tempo, I get  0 0 output.
>> 
>> So maybe set a default tempo?
>
>You are the winner!
>Obviously :-(, according to MIDI specs, "If there are no tempo events in a 
>MIDI file, then the tempo is assumed to be 120 BPM".
>This is 120 quarter note per mn, or 0.5 s per quarter note.
>So we need to initialize $tempo = .5; instead of $tempo = 0; (line 30) and all 
>will work right.
>
>RTFM: read the specs, read the specs,  read the specs, :-)
>Jean-Pierre

That's great!  By the way, are you are perlmonk?
http://perlmonks.org


 If not, would you mind if I post it there, with your name
on it of course.
It is a sought after utility. :-)

zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html