Re: midi re-tempoizer
[email protected] (Jean-Pierre Vidal) Fri, 10 Dec 2004 17:10:00 +0000
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <[email protected]> |
Le vendredi 10 D=E9cembre 2004 10:42, zentara a =E9crit=A0: > On Thu, 9 Dec 2004 22:00:41 +0000, [email protected] (Jean-Pierre > Vidal) wrote: >=20 > >Le jeudi 9 D=E9cembre 2004 11:08, zentara a =E9crit=A0: >=20 > >> Your script runs without error for me, and on some midi > >> files gives the correct time.=20 > >>=20 > >> But I often get > >> 0 mn 0.0 s > >> as output. > >>=20 > >> 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"} > >>=20 > >> and if it had no set_tempo, I get 0 0 output. > >>=20 > >> So maybe set a default tempo? > > > >You are the winner! > >Obviously :-(, according to MIDI specs, "If there are no tempo events in= a=20 > >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 =3D .5; instead of $tempo =3D 0; (line 3= 0) and=20 all=20 > >will work right. > > > >RTFM: read the specs, read the specs, read the specs, :-) > >Jean-Pierre >=20 > That's great! By the way, are you are perlmonk? > http://perlmonks.org no, I am not. >=20 > If not, would you mind if I post it there, with your name > on it of course. > It is a sought after utility. :-) Of course, this utility is distributed "as is", and under the terms of perl= =20 itself. So, you can post it, with or without my name. Jean-Pierre >=20 > zentara >=20 >=20 > --=20 > I'm not really a human, but I play one on earth. > http://zentara.net/japh.html >=20 >=20