Thursday, January 23, 2014

Towards automating a draft of the music of the te'amim

Introduction to the concept, including the music for the section of Psalm 18 below, is here. The main problem is the association of note with syllable. [First test result is here]

'By the testimony of Mosheh Ben Asher himself, the Masoretes received the te’amim from the second-century BCE Elders of Bathyra'*. The Masoretes and the Elders of Bathyra were encoders and the code they have written is a linear largely unambiguous sequence of codes that requires only a small amount of look-ahead logic to convert into a musical score with libretto.

The base symbols are consonants, vowels, and hand-signals. Some of the 'consonants' behave differently from others, but only a few. Yod and vav are the trickiest and they come up in two different ways in the short example that follows. Some of the 'vowels' likewise have multiple functions, particularly the schwa, which may act like a vowel or silently close a syllable. The musical signs have two overall functions, establishing the 'current note', default is the tonic (for which we assume E), and ornamentation.

Here is the raw data. This is really quite useful. We will take it as read except that the meteg (aka silluq) is not a vowel but a note (the tonic).

So how does one derive an algorithm for conversion to music.  Read the Unicode in sequence from left to right, character by character,syllable by syllable.

Rules
  • A syllable always begins with a consonant.
  • A syllable always has one vowel.
  • A syllable ends when a consonant:schwa is found (closed syllable), or when a consonant:vowel is found that begins a new syllable.
  • There are exceptions - when a consonant masquerading as a vowel is found, it together with the vowel it accompanies acts as a vowel.
  • A schwa cannot close a syllable that only contains a schwa as its vowel.
  • Treat dashes (1470) as spaces.
Examples: The following is verse 20 of Psalm 18, Letteris edition
20 וַיּֽוֹצִ֘יאֵ֥נִי לַמֶּרְחָ֑ב
 יְ֝חַלְּצֵ֗נִי כִּ֘י חָ֥פֵֽץ בִּֽי
Right away we have an open syllable. We know this by looking ahead to the next syllable.
וַ is the first syllable followed by יּֽוֹ.  In the first syllable, the vav is acting as a consonant. In the second the vav is acting as a vowel. In the second syllable, the yod is a consonant. In the next syllable, צִ֘י the yod acts as a vowel. 
That first word has 5 syllables (and of course 5 vowels). The last two are אֵ֥ and נִי. The whole is pronounced va-yo-tsi-'ei-ni. Each obeys the rules. The one that looks like vowels only ('ei) begins with the alef, a glottal stop ('). That alef is the 'consonant'. Alef can also be effectively silent.

The music for this first word: va, is on the tonic. yo is on the tonic E (and marked by the silluq). tsi has an ornament of three notes relative to the tonic. 'ei has moved the current note to a F# (key signature is E minor). And ni stays on the F#.

Summary:
  • Verse = {words}, words delimited by space (regular or 1470) or dash (1475)
  • Word = {syllables}, syllables delimited by consonants and contain only one vowel
  • Consonant:schwa closes an open syllable if the vowel in the syllable is not a schwa
  • Consonant:vowel always opens a new syllable
  • Syllable has transcription (libretto / pronunciation) and notes
  • Notes may establish a new current note, or notes may be an ornament returning to the current note either on the current syllable or the next if it is on the current note.
The sequence of codes in decimal notation for the first word is (bold is music)
1493;1463; va
1497;1468;1469;1493;1465; yo
1510;1460;1432;1497; tsi
1488;1461;1445; 'ei
1504;1460;1497; ni
the remaining words of verse 20
1500;1463;1502;1468;1462;1512;1456;1495;1464;1425;1489; la-mer-xav (bet without dagesh is v)
note how the normal consonant with a schwa closes a syllable. The syllable xav is on the subdominant (atnah), a resting point in most verses.
1497;1456;1437;1495;1463;1500;1468;1456;1510;1461;1431;1504;1460;1497; ye-xal-tsei-ni
1499;1468;1460;1432;1497; ki
1495;1464;1445;1508;1461;1469;1509; xa-phets
1489;1468;1460;1469;1497;1475; bi (bet with dagesh and silluq)
and here is the music with English libretto. Even in a close translation, the Hebrew and English will not correspond. A draft will be in Hebrew with one note per syllable except for ornaments which are melismatic. Likely in this case the English underlay moves back to the tonic too soon. The tonic should be on the 'me' and not on the delighted.
The remainder of Psalm 18:21-25 is below, work in process data for the analysis of syllables and notes using Unicode to create an algorithm to output Music XML. Dashes show the syllables in the number sequences. Red 1456 is the schwa that closes a syllable - ask why. No example here of final guttural for reversal of noun for transcription.
Note: for transliteration, this site may be useful - has open-source code. No music of course.

Recall - codes from 1488 to 1506 are consonants (except yod and vav, alef and heh where noted)
codes from 1456 to 1468 are vowels - transcription is not yet smart - could use phonetic standards.
codes from 1420 to 1453 are musical notes - ornaments and fundamentals are noted here.
21 יִגְמְלֵ֥נִי

1497;1460;1490;1456;-1502;1456;-1500;1461;1445;-1504;1460;1497;
new word, must begin with consonant
if first vowel is schwa, then next consonant begins new syllable
else If next consonant is followed by schwa then it closes prior syllable
else it starts new syllable and prior is open
yig-me-lei-ni

E-E-F-F
יְהוָ֣ה
1497;1456;1492;1493;1464;1443;1492;

special case Divine Name - YHWH
a-don-ai
F-F-B
כְּצִדְקִ֑י
1499;1468;1456;-1510;1460;1491;1456;-1511;1460;1425;1497;
Here first syllable has schwa, 
so next syllable with hiriq (1460) opens new syllable – closed by dalet and schwa

ke-tsid-qi - note how the note is between the hiriq and the final yod - one i vowel, two symbols
B-B-A (atnah 1425 resting point)
כְּבֹ֥ר
1499;1468;1456;-1489;1465;1445;1512;

ke-vor (bet with no dagesh 1468) = v sound
A-F
יָ֝דַ֗י
1497;1464;1437;-1491;1463;1431;1497;
ya (ornament slurred over 2 eighth notes)-dai (dipthong - two eighth notes with ornament)
AF-EF
יָ֘שִׁ֥יב
1497;1464;1432;-1513;1473;1460;1445;1497;1489;

ya (triplet ornament)-shiv
EG#F-F
לִֽי
1500;1460;1469;1497;1475;
li 1475 is the Unicode : showing end of verse.
E
22  כִּֽי
1499;1468;1460;1469;1497;-

ki - open syllable with dash (ignore)
E
שָׁ֭מַרְתִּי
1513;1473;1464;1453;-1502;1463;1512;1456;-1514;1468;1460;1497;

sha - open syllable-mar - closed syllable-ti
G-G-G
דַּרְכֵ֣י
1470;
1491;1468;1463;1512;1456;-1499;1461;1443;1497;
dar (closed)-kei (open + silent yod)
G-B
יְהוָ֑ה
1497;1456;1492;1493;1464;1425;1492;   special case
a-do-nai
B-B-A
וְלֹֽא
1493;1456;-1500;1465;1469;1488;1470;
ve-lo
A-E
רָ֝שַׁ֗עְתִּי
1512;1464;1437;-1513;1473;1463;1431;1506;1456;-1514;1468;1460;1497;

ra-sha` (closed)-ti
GE D#E
מֵֽאֱלֹהָֽי
1502;1461;1469;-1488;1457;-1500;1465;-1492;1464;1469;1497;1475;
mei-'e-lo-hai
E-E-E-E
23 כִּ֣י
1499;1468;1460;1443;1497;
ki
B
כָל
1499;1464;1500;1470;
kol (note o in accented closed syllable - not always possible to wonder about)
B
־מִשְׁפָּטָ֣יו
1502;1460;1513;1473;1456;-1508;1468;1464;1496;1464;1443;1497;1493;
mish-pa-tav (silent yod)
B-B-B
לְנֶגְדִּ֑י
1500;1456;-1504;1462;1490;1456;-1491;1468;1460;1425;1497;
le-neg-di
B-B-A
וְ֝חֻקֹּתָ֗יו
1493;1456;1437;-1495;1467;-1511;1468;1465;-1514;1464;1431;1497;1493;
va-xu-qo-tav
CA-A-A-G#A
לֹֽא
1500;1465;1469;1488;1470;
lo
E
־אָ֘סִ֥יר
1488;1464;1432;-1505;1460;1445;1497;1512;
a-sir
D#FE-F#
מֶֽנִּי
1502;1462;1469;-1504;1468;1460;1497;1475;
me-ni
E-E
24 וָֽאֱהִ֣י
1493;1464;1469;-1488;1457;-1492;1460;1443;1497;
va-'e-hi
E-E-B
תָמִ֣ים
1514;1464;-1502;1460;1443;1497;1501;
ta-mim
B-B
עִמּ֑וֹ
1506;1460;-1502;1468;1425;1493;1465;
`i-mi
B-A
וָֽ֝אֶשְׁתַּמֵּ֗ר
1493;1464;1469;1437;-1488;1462;1513;1473;1456;
-1514;1468;1463;-1502;1468;1461;1431;1512;
va-two notes - ornament + tonic-esh-ta-mar
CE-E-E-D#E
 מֵֽעֲו‍ֹנִֽי
1502;1461;1469;-1506;1458;-1493;1465;-1504;1460;1469;1497;1475;
me-`a-vo-ni note that the vav is a consonant here
E-E-E-E
25 וַיָּֽשֶׁב
1493;1463;-1497;1468;1464;1469;-1513;1473;1462;1489;1470;
note yod with dagesh is consonant
va-ya-shev
E-E-E
־יְהוָ֣ה
1497;1456;1492;1493;1464;1443;1492;
special case YHWH
Adonai E-E-B
לִ֣י
1500;1460;1443;1497;
li
B
כְצִדְקִ֑י
1499;1456;-1510;1460;1491;1456;-1511;1460;1425;1497;
ke-tsid-qi
B-B-A
כְּבֹ֥ר
1499;1468;1456;-1489;1465;1445;1512;
ke-vor
A-F
יָ֝דַ֗י
1497;1464;1437;-1491;1463;1431;1497;
ya-dai
AF-EF
לְנֶ֣גֶד
1500;1456;-1504;1462;1443;-1490;1462;1491;
le-ne-ged
F-B-B
עֵינָֽיו
1506;1461;-1497;1504;1464;1469;1497;1493;1475;
`ei-nav
both yods silent here
B-E
* quote above from David Mitchell in http://home.scarlet.be/~tsf07148/theo/Resinging.pdf