[LAU] Extracting the tempo track from a MIDI file

Ken Restivo ken at restivo.org
Tue Sep 25 13:08:57 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Sep 25, 2007 at 09:21:06AM +0200, Alexandre Ratchov wrote:
> On Mon, Sep 24, 2007 at 07:00:38PM -0700, Ken Restivo wrote:
> > 
> > Is there any command-line tool to extract and print the tempo of
> > a MIDI file?
> > 
> 
> hi, 
> 
> you could use midish for that: import the .mid file, and use the
> songtimeinfo function; example:
> 
> $ rmidish  
> send EOF character (control-D) to quit
> 1> songimportsmf "sample.mid"
> 2> songtimeinfo
> {
>         timesig 4 24
>         tempo 400000
> }
> 3> 
> 

Thanks! However, I haven't found any explanation of what those numbers mean. I need the tempo in BPM.

I found this formula in the Rosegarden source:
	qpm = (60.0 * beatTime) / (beatSec * quarter)

But of the three numbers that songtimeinfo spits out, I haven't been able to figure out which one is beatTime, beatSec, and quarter.

- -ken
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG+UCoe8HF+6xeOIcRAn2TAJ9JQ4LOylLFL/cWMer9oHboJSsR7QCg5yyG
cL3OT1shqsUGCgEA59BFMV4=
=4tta
-----END PGP SIGNATURE-----



More information about the Linux-audio-user mailing list