Pages

Monday, 21 March 2022

A spec for transcribing Unicode to MusicXML

 How easy can I make this?

I will work from output back to input. Here's the required output for the first four notes of Genesis.

This is two transcriptions in one, because we have to get the syllable with the right note(s) - so we have to transcribe the rtl Hebrew to ltr Latin and interpret the vowels as we go. Yes there are melismas, but they are simple - never more than three notes relative to the current reciting note. The original spec for the deciphering key is here (translated from the original French). It is important to have this for examples of her resolution of ornaments when there is some ambiguity as to whether to return to the reciting note or not. (Her spec is unclear and her actual practice is varied). Performers also take liberty with the ornaments and modes since they are 'unspecified', i.e. subject to musical judgment based on the text and the melody - itself determined by the signs under the text. 

[Actually there are multiple transcriptions going on: Hebrew to pronounceable Latin characters that can be read by a singer (not a linguist), words broken up by syllable, and cantilation transcribed to MusicXML.]

Here's the output for the first few measures of Genesis 1:1 given this input:

בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים

The music is e g# B ^A. The opening e is defaulted since it is not specified. The default applies for each verse if and only if there is no accent above or below the text on the first syllable.
The tifha ֭  always sets the reciting note to the third note of the mode, in this case, g#.
The munah ֣ to the fifth, B. The atnah  ֑ to the fourth, A.

The accents under the text define the current reciting note. This is the missing clue in every other interpretation of the accents - also called te-amim, marks of taste, or cantilation marks, or hand-signals.

First the file definition :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1"><identification><encoding><supports element="accidental" type="no"/></encoding></identification> <defaults> -- see the full file at the link below for the hard coded defaults
- defining the paper size etc.

<credit
page="1"><credit-words default-x="595.238" default-y="1626.98" font-size="16" justify="center" valign="top">Genesis 1</credit-words> -- title is input
</credit><credit page="1">
<credit-words default-x="56.6893" default-y="1559.98" font-size="10" justify="left" valign="top">[Mode 1] -- mode is input
based on the work of Suzanne Haik-Vantoura </credit-words>
</credit>
<credit page="1"> <credit-words default-x="1133.79" default-y="1559.98" font-size="10" justify="right" valign="top">Transcription automated
http://meafar.blogspot.com</credit-words> </credit><credit page="1"><credit-words default-x="595.238" default-y="113.379" justify="center" valign="bottom">
source data www.tanach.us/Tanach.xml. Transcription software (v3.3) by Bob MacDonald via GX-LEAF (www.gx.ca). Victoria BC 2016.01.25
Range: C4 -E5 verses 31 measures 257 words 434 syllables 1025 max recitation 34 </credit-words>
</credit>

<part-list><score-part id="P1"><part-name/><score-instrument id="P1-I3"><instrument-name/></score-instrument></score-part></part-list>

<part id="P1">

The part is defined by measure. For every reciting-note there is a measure - The program must limit the size and extend the measure to two if the recitation is very long. I have found that a maximum of 24 beats in a bar works for all the Bible and in my music program (Musescore). There are only a few recitations of such length.

<measure number="1"> -- calculate measure number as the text is read
<attributes> <divisions>6</divisions> -- hard coded to allow for triplets & duplets
see (e.g.) https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/divisions/
<key><fifths>0</fifths> -- number of flats or sharps - this is calculated as follows: 
case when l_poetry = '1' and pl_mode = '2' then '4' 
     when pl_mode = '8' then '2' -- locrian - experimental
     when pl_mode = '3' then '4' 
     when l_poetry = '1' then '1' 
     when pl_mode = '5' or pl_mode = '6' then '0' 
     when pl_mode <> '1' then '1' 
     else '0' end 
l_poetry is '1' if the chapter is poetry (Psalms, Proverbs and most of the book of Job except chapters 1, 2, 42, and the narrator's verses), 
pl_mode is the input parameter stating the mode for the chapter. See this post for the mode scales.

<mode>major</mode></key> -- hard coded - irrelevant but probably needed for the XML
<clef><sign>G</sign><line>2</line></clef></attributes> -- all generated music is single line treble clef suitable for voice(s). The pitch is arbitrary and may be transposed for alto or bass. Generally speaking though, the range is limited e to E and the high D and E are rare.

Text - word by word - Hebrew
<direction placement="above">
<direction-type>
<words font-size="12">
1.1 &#1489;&#1468;&#1456;&#1512;&#1461;&#1488;&#1513;&#1473;&#1460;&#1430;&#1497;&#1514; 
</words></direction-type></direction>

Notes - syllable by syllable - for lyric 1 - split by syllabic begin-middle-end (determines hyphenation)
<note><pitch><step>E</step><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type> <lyric number="1"><syllabic>begin</syllabic><text>be</text></lyric>
</note>
<note><pitch><step>E</step><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type> <lyric
number="1"><syllabic>middle</syllabic><text>rei</text></lyric>
</note>
<barline
location="right">
<bar-style>dotted</bar-style>
</barline>
</measure>
<measure number="2">
<note><pitch><step>G</step><alter>1</alter><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type>
<lyric number="1"><syllabic>end</syllabic><text>shit</text></lyric>
</note>
<direction
placement="above"><direction-type>
<words font-size="12"> &#1489;&#1468;&#1464;&#1512;&#1464;&#1443;&#1488; </words></direction-type></direction>
<note><pitch><step>G</step><alter>1</alter><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type>
<lyric
number="1"><syllabic>begin</syllabic><text>ba</text></lyric>
</note>
<barline
location="right">
<bar-style>dotted</bar-style>
</barline>
</measure>
<measure number="3">
<note><pitch><step>B</step><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type>
<lyric
number="1"><syllabic>end</syllabic><text>ra</text></lyric>
</note>
<direction
placement="above"><direction-type>
<words font-size="12"> &#1488;&#1457;&#1500;&#1465;&#1492;&#1460;&#1425;&#1497;&#1501; </words></direction-type></direction>
<note><pitch><step>B</step><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type>
<lyric
number="1"><syllabic>begin</syllabic><text>e</text></lyric>
</note>
<note><pitch><step>B</step><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type>
<lyric
number="1"><syllabic>middle</syllabic><text>lo</text></lyric>
</note>
<barline
location="right">
<bar-style>dotted</bar-style>
</barline>
</measure>
<measure number="4">
<note><pitch><step>A</step><octave>4</octave>
</pitch><duration>6</duration><voice>1</voice><type>quarter</type> <notations><articulations><caesura
default-x="31" default-y="-10"/></articulations></notations>
<lyric number="1"><syllabic>end</syllabic><text>him</text></lyric>
</note>
<barline location="right">
<bar-style>dotted</bar-style>
</barline>
</measure>

Then keep going till the end of the section you are producing (verse or group of verses, or chapter etc).
Full score for Genesis 1 is here in MusicXML. (Indentation varies - whim of the programmer!)

This is the overall shape, though we have stopped in the middle of a verse at the cadence on the atnah.  And there are no ornaments in this verse. The measure may continue after the caesura and a rest <note><rest/><duration>6</duration><voice>1</voice>
<type>quarter</type>
</note>
 if there is no change in the reciting note.

After every verse is done:
<!--C4 -E5 verse 31 measures 257 words 434 syllables 1025 max recit 34-->
</part></score-partwise>
ends the score

And the result is this:
The music for the XML above


No comments:

Post a Comment