Timebasing to the shortest duration in each piece

Skip to first unread message

Joe Plazak

Jan 9, 2021, 10:06:34 PM1/9/21
to starstarhug
Hi all,

I'm looking for a timebase command option that can automatically "base" a file to the shortest duration in the piece, so that the user doesn't need to explicitly pass this info as an argument.  Does this option/command already exist?  If not, is the timebase source code available for modification?  

Currently, I end up calling census -k and then grep/filter the Shortest Note: line, but it sure would be nice to just invoke this behaviour directly as a timebase option. 


Craig Sapp

Jan 9, 2021, 10:27:09 PM1/9/21
to stars...@googlegroups.com
Hi Joe,

I have a tool in Humdrum Extras called "minrhy" (meaning "minimum rhythm") used for such a purpose.  You can give either a single file as the argument, or a list of files, which will list the minimum  time unit in each file, and then a line at the end of the list which is the minimum for all files (and this is the value to give to timebase).

Here is an example doing it on all of the Beethoven piano sonatas (https://github.com/craigsapp/beethoven-piano-sonatas):

$ minrhy *.krn

sonata01-1.krn: 32

sonata01-2.krn: 96

sonata01-3.krn: 16

sonata02-1.krn: 96

sonata02-2.krn: 32

sonata02-3.krn: 16

sonata03-1.krn: 192

sonata03-2.krn: 96

sonata03-3.krn: 48

sonata04-1.krn: 96

sonata04-2.krn: 96

sonata04-3.krn: 16

sonata05-1.krn: 48

sonata05-2.krn: 32

sonata05-3.krn: 16

sonata06-1.krn: 32

sonata06-2.krn: 192

sonata06-3a.krn: 8

sonata06-3b.krn: 24

sonata06-3c.krn: 48

sonata06-3d.krn: 16

sonata06-3e.krn: 16

sonata06-3f.krn: 16

sonata06-3g.krn: 16

sonata06-3h.krn: 16

sonata06-3i.krn: 8

sonata06-3j.krn: 8

sonata06-3k.krn: 16

sonata06-3l.krn: 384

sonata06-3m.krn: 32

sonata07-1.krn: 32

sonata07-2.krn: 192

sonata07-3.krn: 96

sonata08-1.krn: 32

sonata08-2.krn: 192

sonata08-3.krn: 8

sonata09-1.krn: 48

sonata09-2.krn: 192

sonata09-3.krn: 96

sonata10-1.krn: 192

sonata10-2.krn: 64

sonata10-3.krn: 96

sonata11-1a.krn: 32

sonata11-1b.krn: 32

sonata11-1c.krn: 96

sonata11-1d.krn: 16

sonata11-1e.krn: 32

sonata11-1f.krn: 192

sonata11-1g.krn: 16

sonata11-2.krn: 32

sonata11-3.krn: 32

sonata12-1.krn: 96

sonata12-2.krn: 1344

sonata12-3.krn: 32

sonata13-1.krn: 32

sonata13-2.krn: 96

sonata13-3.krn: 192

sonata14-1.krn: 96

sonata14-2.krn: 384

sonata14-3.krn: 48

sonata15-1.krn: 32

sonata15-2.krn: 32

sonata15-3.krn: 16

sonata16-1.krn: 32

sonata16-2.krn: 96

sonata16-3.krn: 32

sonata17-1.krn: 32

sonata17-2.krn: 64

sonata17-3.krn: 96

all: 2688

So the minimum time unit for all of the sonatas is a 2688h note...

The prime factors are: 2 x 2 x 2 x 2 x 2 x 2 x 2 x 3 x 7, so there are septuplets in the sonatas, but no quintuplets.

There is an associated PERL script in Humdrum Extras called partjoin that uses minrhy to automate joining parts into a full score:
"partjoin" also allows merging parts that contain grace notes (grace notes are put into comments, and then the comments are removed after merging into a score with the Humdrum Toolkit "assemble" command. (Note that the timebase command will eat the grace notes).



This is a message is from the **HUG newgroup.
To post to this group, send email to stars...@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups "starstarhug" group.
To unsubscribe from this group and stop receiving emails from it, send an email to starstarhug...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/starstarhug/f380a65d-98e7-47de-9fd1-a6b615427da5n%40googlegroups.com.
Reply all
Reply to author
0 new messages