Hello Claire,
Here is a more generalized solution which should be able to also handle music with subspines (such as piano music). Chords are treated as a single unit, and different tie states in chord notes are ignored (only the first note in the chord will be considered). And there are some corner cases for ties that are not yet handled properly (at spine splits, the open tie will only be searched for a tie closing in the left-hand of a spine split).
This is implemented in humlib, so to download and install:
cd humlib
make
sudo make install
Or if you already have humlib on your computer, cd to the humlib directory and run these commands:
make update
make
sudo make install
Here is an example usage on 370 Bach chorales:
humcat -s h://chorales | durations | sortcount
Output (count on left, duration in quarter notes on right):
43648 1
29395 0.5
5385 2
2170 0.25
1253 3
1000 1.5
740 1R
655 1.5T
372 1T
250 2T
243 4
111 0.75
53 2.5T
38 3T
22 2R
16 1.75T
15 0.5R
10 0.125
9 6T
9 1.25T
8 8
8 6
8 5T
6 4T
5 3R
5 3.5T
3 0.75T
2 8T
2 2.75T
1 4R
1 2.25T
1 16T
1 4.5T
1 3.75T
1 7T
1 9T
1 14T
The most common duration is a quarter note, then eighth-note, etc. A "T" at the end of the duration means that it was composed of a set of tied notes, "R" means the duration is from a rest, and "G" (not found in Chorales) means a grace note (but those are always having a 0 duration, so redundant). You can use the T/R/G markers to adjust what you want to count. For example, here is a list of only the tied notes:
humcat -s h://chorales | durations | grep T | sortcount -p
The -p option for sortcount converts the absolute counts into percentages:
45.64 1.5T
25.92 1T
17.42 2T
3.69 2.5T
2.65 3T
1.11 1.75T
0.63 6T
0.63 1.25T
0.56 5T
0.42 4T
0.35 3.5T
0.21 0.75T
0.14 2.75T
0.14 8T
0.07 3.75T
0.07 14T
0.07 7T
0.07 16T
0.07 2.25T
0.07 9T
0.07 4.5T
The most common tied note group has the duration of a dotted quarter note (45.64% of all tie cases).
If you do not want to differentiate between tied and untied durations, but ignore rests:
humcat -s h://chorales | durations | sed s/T// | grep -v R | sortcount
44020 1
29395 0.5
5635 2
2170 0.25
1655 1.5
1291 3
249 4
114 0.75
53 2.5
17 6
16 1.75
10 0.125
10 8
9 1.25
8 5
5 3.5
2 2.75
1 16
1 3.75
1 7
1 2.25
1 14
1 9
1 4.5
You can compare using the durations tool with other methods. In theory the analyses should match, and if not, one (or both) of the methods has a bug that should be fixed.
---------------------------
There is also the tie tool available in the humlib repository. The -m option will merge tied notes into a single attack (designed for cases like yours). It can be installed via the humlib installation method described above, and you can view the results of the merge in VHV:
Note whole note in Tenor measure 4 which has a quarter note merger from the following measure where there is now a black spot.
humcat -s h://chorales | tie -m | durations | sortcount
44020 1
29395 0.5
5635 2
2170 0.25
1655 1.5
1291 3
740 1R
249 4
114 0.75
53 2.5
22 2R
17 6
16 1.75
15 0.5R
10 0.125
10 8
9 1.25
8 5
5 3R
5 3.5
2 2.75
1 14
1 9
1 2.25
1 4R
1 16
1 4.5
1 3.75
1 7
Mozart piano sonata duration histogram:
humcat -s h://mozart/sonatas | durations | sed 's/[TG]//' | grep -v R | sortcount -p
The most common is a 16th note at 39% of note rhythms:
39.11 0.25
28.58 0.5
10.13 1
7.16 0.125
4.61 0.166667
3.02 0.333333
1.81 0
1.47 1.5
1.29 2
1.08 0.75
0.39 0.0625
0.35 3
0.31 0.375
0.12 1.25
0.12 0.0833333
0.12 4
0.05 0.625
0.05 2.5
0.03 0.03125
0.03 1.75
0.02 6
0.02 0.666667
0.02 0.875
0.02 3.5
0.02 2.25
0.01 1.33333
0.01 0.1875
0.01 0.0714286
0.01 5
0.01 1.125
0 0.6875
0 1.375
0 0.3125
0 0.5625
0 4.5
0 3.25
0 1.6875
0 2.75
0 0.571429
0 7
0 1.16667
0 16
0 5.25
0 4.75
0 0.0416667
0 0.583333
0 1.0625
-=+Craig