Humdrum lab 4

From CCARH Wiki
Jump to: navigation, search

First check out Humdrum lab 3

This lab introduces the digital scores of the Josquin Research Project.

Note in particular that the tindex/themax/theloc search engine is implemented with a front-end on the JRP website: http://josquin.stanford.edu/search

In other words, you can search entire works, although the search features are limited to 3: pitch, interval and rhythm.


1 Download the data

First download the data by genre:

    cd ~/Desktop
    mkdir jrp
    cd jrp
    mkdir masses
    (cd masses; humsplit h://jrp/Zma)
    mkdir motets
    (cd motets; humsplit h://jrp/Zmo)
    mkdir songs
    (cd songs; humsplit h://jrp/Zso)

There are three basic genres: secular songs, religious songs (motets), and music for the mass ordinary.

You can also download works by composer, such as Jean Mouton:

    humsplit h://jrp/Mou

Ockeghem:

    humsplit h://jrp/Ock

Josquin securely attributed works:

   humsplit h://jrp/Joa

Josquin not securely attributed works:

   humsplit h://jrp/Job

All of Josquin works:

   humsplit h://jrp/Jos


Alternatively, the JRP database is available on github at https://github.com/josquin-research-project/jrp-scores

2 How much data is there?

How many files:

    cd ~/Desktop/jrp
    ls masses motets songs | grep krn | wc -l

(Github is more recent).


How many notes:

    cat */*.krn | extractx -i **kern | census -k

There are 803,046 notes

By genre:

   for i in masses motets songs
   do 
      echo "$i:"
      cat $i/*.krn | extractx -i **kern | census -k | grep "Number of notes"
   done
Masses 472,034
Motets 258,323
Songs 72,689

Longest songs:


  $ scordur songs/*.krn | sort -k 2 -nr | head -n 10


songs/Jos2918-Nymphes_des_bois__Requiem.krn:	1240
songs/Jos2720-La_belle_se_siet.krn:	1192
songs/Jos2713-Helas_madame.krn:	1144
songs/Jos2723-Lheure_est_venue__Circumdederunt_me.krn:	1048
songs/Jos3009-Regretz_sans_fin.krn:	1040
songs/Jos3011-Se_congie_prens.krn:	792
songs/Jos2905-Du_mien_amant.krn:	736
songs/Ort3006-La_mi_la_sol.krn:	728
songs/Ock3012-Ma_maistresse.krn:	680
songs/Jos2811-Dulces_exuviae.krn:	680

(units of quarter notes)

Shortest masses:

$ scordur masses/*.krn | sort -k 2 -nr | tail -n 10
masses/Ock1004.3a-Missa_Cuiusvis_toni-Kyrie-on_F.krn:	316 
masses/Ock1004.2a-Missa_Cuiusvis_toni-Kyrie-on_E.krn:	316
masses/Ock1004.1a-Missa_Cuiusvis_toni-Kyrie-on_D.krn:	316
masses/Ock1002a-Missa_Au_travail_suis-Kyrie.krn:	304
masses/Jos0904e-Missa_Rosina-Agnus.krn:	296
masses/Rue1005f-Missa_Ave_sanctissima_Maria-Loco_Deo_Gratias.krn:	288
masses/Jos0904d-Missa_Rosina-Sanctus.krn:	276
masses/Rue1020e-Missa_Nunca_fue_pena_mayor-Agnus.krn:	264
masses/Jos1312-Crucifixus.krn:	200
masses/Ock1001a-Kyrie_Gloria_Credo_Sine_nomine-Kyrie.krn:	144

Longest Sanctus sections of masses:


 $ scordur masses/*-Sanctus.krn | sort -k 2 -nr | head -n 10
masses/Ock1003d-Missa_Caput-Sanctus.krn:	2160
masses/Ock1005d-Missa_De_plus_en_plus-Sanctus.krn:	2052
masses/Agr1004d-Missa_Malheur_me_bat-Sanctus.krn:	1968
masses/Mou1020d-Missa_Da_pacem-Sanctus.krn:	1960
masses/Jos0302d-Missa_Da_pacem-Sanctus.krn:	1960
masses/Jos0902d-Missa_Mon_seul_plaisir-Sanctus.krn:	1832
masses/Rue1031d-Missa_Tous_les_regretz-Sanctus.krn:	1808
masses/Jos1102d-Missa_La_sol_fa_re_mi-Sanctus.krn:	1728
masses/Jos0901d-Missa_Malheur_me_bat-Sanctus.krn:	1728
masses/Jos0403d-Missa_Pange_lingua-Sanctus.krn:	1708


Online census:

    http://josquin.stanford.edu/census

3 Final tone

 $ finalis songs/*.krn | sortcount
58	G 
36	D
27	A
13	F
10	C
7 	E
1	B-

One song with a final on B-flat.

4 Scale degrees

The music is not in major/minor modes as modern tonal music is conceived, so there is no key designations in the files. There is a script in Humdrum Extras which will add a key designation based on the final tone of the music so that scale degree information can be extracted from the scores:

$ finalis-tonic songs/Jos2724-Madame_helas.krn | less

Calculate scale degrees patterns of length 5 in the B-flat song:

$ finalis-tonic songs/Jos2724-Madame_helas.krn | deg -at | serialize | context -n 5 | ridx -H | sortcount
6	5 4 3 2 1
4	1 7 6 5 6
4	2 3 r 2 3
4	4 3 2 1 4
3	1 7 6 7 1
3	6 5 4 3 4
3	6 5 6 5 1
3	1 7 1 7 1
3	7 6 5 6 5
3	6 2 1 7 6

Calculate scale degrees for all songs:

$ finalis-tonic songs/Jos2724-Madame_helas.krn | deg -at | serialize \
         | grep -v = | context -n 5 | ridx -H | sortcount | head -n 10
6	5 4 3 2 1 
4	2 3 r 2 3
4	1 7 6 5 6
4	4 3 2 1 4
3	4 3 2 1 2
3	6 5 4 3 2
3	2 1 7 6 5
3	1 7 1 7 1
3	3 4 3 2 1
3	5 6 5 4 3

Length-5 scale degree patterns in songs:

$  finalis-tonic songs/* | extractx -i **kern | deg -at | serialize -L \
          | egrep -v '=|r' | context -n 5 | ridx -H | sortcount | head -n 10
427	5 4 3- 2 1
302	3- 2 1 7- 1
297	4 3- 2 1 7-
236	2 1 7- 6 5
219	2 3- 2 1 7-
219	1 2 3- 4 5
198	7- 6 5 4 5
196	1 2 3- 2 1
193	7- 1 2 3- 2
185	1 7- 6 5 4

Exercise: How do the most common scale-degree patterns compare to masses and motets?


5 Keyscape

The B-flat song has an interesting harmonic structure:

$ mkeyscape -ln Jos2724-Madame_helas.krn | convert - out.png; open out.png
Jos2724-Madame helas.png

Stronger focus on E-flat major triads in the first part, then more B-flat major chords in the second part.


You can browse keyscapes on kernscores: http://kern.humdrum.org/cgi-bin/browse?l=/jrp

(go to analysis section of individual works and then click on the entry for keyscape)

6 Sonority

The Humdrum Extras tool sonority can be used for basic triadic analysis of sonorities.

$ sonority Jos2724-Madame_helas.krn | ridx -H | sortcount | head -n 10
26	X
16	incmaj:0:B-
13	incmajx3:0:B-
12	incmaj:0:E-
11	maj:0:F
10	incmin:0:D 
9	maj:0:B-
8	maj:0:E-
8	note::B-
7 	incmin:0:G

Only roots:

  sonority -ra Jos2724-Madame_helas.krn | sed 's/qual/cdata/' | pbcopy
Jos2724-Madame helas-roots.png


The "roots" of the first half of the piece:

$ myank -m 1-37 Jos2724-Madame_helas.krn | sonority | ridx -H | sortcount | head -n 10
12	X
7	maj:0:E- 
6	incmajx3:0:B-
6 	incmin:0:D
6	incmaj:0:E-
5	note::B-
5	maj:0:F
4	incmaj:0:B-
4	incmin:0:G
4	min:0:C


The "roots" of the second half of the piece:

$ myank -m 38-$ Jos2724-Madame_helas.krn | sonority | ridx -H | sortcount | head -n 10
14	X
12	incmaj:0:B-
7	maj:0:B-
7	incmajx3:0:B- 
6	maj:0:F
6	incmaj:0:E-
6	incmaj:1:E-
5	maj:1:F
4	incmin:0:D
4	note::F


7 Generalized sonorities

The Humdrum Extras tntype tool gives a generalized description of the sonorities.


First look at the notes that are present at each time position in the score:

   tntype -da Jos2724-Madame_helas.krn  | less

Then look at the sonorities in compact pitch class form:

   tntype -tna Jos2724-Madame_helas.krn  | tntype -da

Then look at the sonorities as a Forte enumeration:

    tntype -a Jos2724-Madame_helas.krn | tntype -tna  | tntype -da
=1-	=1-	=1-	=1-	=1-	=1-
0r	0F	0f	1-1	[5]	F
=2	=2	=2	=2	=2	=2
0BB-	1F	0f	2-5	[5A]	B- f
.	1F	.	2-5	[5A]	(B-) f
=3	=3	=3	=3	=3	=3
0BB-	[0B-	1f	2-5	[5A]	B- f
.	.	1f	2-5	[5A]	(B-) f
=4	=4	=4	=4	=4	=4
1BB-	0B-]	1.b-	1-1	[A]	B-
1BB-	.	.	1-1	[A]	B-
.	.	2a/	2-1	[9A]	a (B-)
=5	=5	=5	=5	=5	=5

Forte number 3-11A is a minor chord, and 3-11B is a major chord.

There are 351 chord "prototypes" (uniq transposable sets of 1 to 12 notes): https://www.scribd.com/document/237597049/Table-of-Pitch-Class-Sets


What are the generalized sonorities of the Motet genre:


$ tntype  * | ridx -H | sortcount -p | head -n 10
18.31	3-11B
17.68	3-11A
13.01	2-3
11.05	2-5
9.92	2-4
6.23	1-1
3.92	3-9
2.47	2-2
2.01	3-7A
1.93	3-10


18.31% of the sonorities are major triads, and 17.68% are minor triads. The next most common 3-note chord type is 3-9 which is a chord such as "C F G", 3-7A is a sonority such as "C D F", and 3-19 is a diminished triad such as "C E-flat G-flat".

Compare to Bach chorale sonorities:


$ tntype  ~/Desktop/chorales/*.krn | ridx -H | sortcount -p | head -n 10
35.09	3-11B
17.26	3-11A
9.07	4-27B
4.96	4-26
4.36	3-10 
4.26	3-9
2.8	4-20
2.52	4-27A
1.99	4-22A
1.95	3-7A

Major triads are twice as more likely in Bach chorales than minor triads (particularly because there are more chorales in major keys -- try analyzing major an minor separately).

7.1 Contextual analysis of sonorities

What chord types follow a 3-9 sonority in JRP Motets?

$ tntype *.krn | grep -v = | context -n 2 | grep ^3-9 | sortcount -p | head -n 10
47.44	3-9 3-11B
18.25	3-9 3-11A
14.31	3-9 2-5
4.41	3-9 2-3
3.8	3-9 2-4
2.81	3-9 3-10
1.95	3-9 3-9
1.61	3-9 4-23
1.08	3-9 3-7A 
0.81	3-9 1-1

Mostly 3-9 is going to 3-11B (major triad), then secondly to minor triad at 18.25%.

Compare to Bach chorales:

$ tntype ~/Desktop/chorales/*.krn | grep -v = | context -n 2 | grep ^3-9 | sortcount -p | head -n 10
57.36	3-9 3-11B
11.01	3-9 3-11A
6.36	3-9 3-9
5.89	3-9 4-27B
4.65	3-9 2-5
3.95	3-9 4-23
1.94	3-9 4-26
1.86	3-9 3-8A 
0.85	3-9 4-27A
0.85	3-9 2-4

Still mostly going to major sonorities.

What sonorities precede a 3-9 sonority:

$ tntype ~/Desktop/chorales/*.krn | grep -v = | context -n 2 | grep 3-9$ | sortcount -p | head -n 10
34.73	3-11B 3-9
21.01	3-11A 3-9
6.36	3-9 3-9
5.35	4-14B 3-9
4.65	4-22B 3-9
3.49	4-27B 3-9
2.64	4-26 3-9
2.33	4-20 3-9
2.17	4-27A 3-9
1.94	2-5 3-9

Usually a major sonority precedes a 3-9 sonority.

What about both before and after at the same time:


$ tntype ~/Desktop/chorales/*.krn | grep -v = | context -n 3 | grep " 3-9 " | sortcount -p | head -n 10
23.1	3-11B 3-9 3-11B
7.05	3-11A 3-9 3-11B
5.5	3-11A 3-9 3-11A
4.57	3-9 3-9 3-11B
3.02	4-14B 3-9 3-11B
2.71	3-11B 3-9 3-9
2.4	4-22B 3-9 3-11B
2.25	4-27B 3-9 3-11B
1.86	3-11B 3-9 4-27B
1.86	4-20 3-9 3-11B

Most often a 3-11B goes to 3-9 goes to 3-11B. Second most common is minor to 3-9 to major, then minor to 3-9 to minor.

8 dissonant

The dissonant humlib tool was developed by Alex Morgan last year. This tool does two things: (1) identifies dissonances in the music (easy), and (2) labels the function of the dissonance (hard).

Try loading some JRP scores into the VHV editor, and type a line somewhere in the editor:

  !!!filter: dissonant --color

You should see some text labels and colored notes that are dissonant:

Rue2030-dissonant.png

What are the most common dissonance types in the JRP songs:

$ dissonant *.krn | extractx -i **cdata | serialize | ridx -H \
    | sortcount -p | head -n 10
25.07	g
18.36	p
17.15	P
13.91	s
6.3	q
5.68	n
1.37	v
1.28	e
1.27	a
1.25	k
1.21	h 
0.95	c
0.79	Z

In the masses:


$ dissonant ../masses/*.krn | extractx -i **cdata | serialize | ridx -H \
    | sortcount -p | head -n 10
22.19	g
17.68	p
17.55	P
13.78	s
6.63	q
4.64	n
2.02	v
1.97	k
1.69	c
1.51	a


Lab 1 (intro) Lab 2 (Essen) Lab 3 (searching) Lab 4 (JRP) Lab 5 (Wikifonia) Lab 6 (bar chart) Lab 7 (regular expressions) Lab 8 (chorck & cint)