Automated Transcription of a Lyric’s Melody David Branner...

43
Automated Transcription of a Lyric’s Melody David Branner Hacker School, New York 20141023

Transcript of Automated Transcription of a Lyric’s Melody David Branner...

Page 1: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Automated Transcriptionof a Lyric’s Melody

David Branner

Hacker School, New York20141023

Page 2: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Automated* Transcriptionof a Lyric’s Melody

David Branner

Hacker School, New York20141023

Page 3: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Automated* Transcriptionof a Lyric’s Melody

(*if you’ve done a lot of preliminary manual work)

David Branner

Hacker School, New York20141023

Page 4: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 4

In September I reported on an experiment to transcribe the solo singing voice with automated tools.

Page 5: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 5

In September I reported on an experiment to transcribe the solo singing voice with automated tools.

I have recordings that I want to study — specifically, I want to study how the melody reflects the organization of the words that the music is set to.

Page 6: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 6

In September I reported on an experiment to transcribe the solo singing voice with automated tools.

I have recordings that I want to study — specifically, I want to study how the melody reflects the organization of the words that the music is set to.

I want the text, annotated with its melody. A normal musical transcription supplies the opposite of that: a melody annotated with words.

Page 7: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 7

My earlier transcription (audio => MIDI => Python editing) went very badly because of tremolo in the singer’s voice and reverberation in the recording.

Page 8: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 8

My earlier transcription (audio => MIDI => Python editing) went very badly because of tremolo in the singer’s voice and reverberation in the recording.

In the end I transcribed the piece by hand, using an open-source program called MuseScore.

Page 9: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 9

My earlier transcription (audio => MIDI => Python editing) went very badly because of tremolo in the singer’s voice and reverberation in the recording.

In the end I transcribed the piece by hand, using an open-source program called MuseScore. Example:

Page 10: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 10

Initially I was pleased because MuseScore can play back the melody I transcribe, speeding the work.

Page 11: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 11

Initially I was pleased because MuseScore can play back the melody I transcribe, speeding the work.

But I was in luck because it can also export the score to an open-source format called MusicXML.

Page 12: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 12

Initially I was pleased because MuseScore can play back the melody I transcribe, speeding the work.

But I was in luck because it can also export the score to an open-source format called MusicXML.

This turned out to allow me to do exactly what I had originally wanted — to study the melody of each syllable, quantitatively.

Page 13: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 13

Here is a single note of the 1100-odd note performance I transcribed (the text is Taiwanese in Church romaji):

Page 14: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 14

Here is a single note of the 1100-odd note performance I transcribed (the text is Taiwanese in Church romaji):

Page 15: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 15

Here is a single note of the 1100-odd note performance I transcribed (the text is Taiwanese in Church romaji):

and here is the XML for that note:

Page 16: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 16

Here is a single note of the 1100-odd note performance I transcribed (the text is Taiwanese in Church romaji):

and here is the XML for that note:

<measure number="17"> <attributes> <time> <beats>2</beats> <beat-type>4</beat-type> </time> </attributes> <note> <pitch> <step>D</step> <octave>4</octave> </pitch> <duration>12</duration> <voice>1</voice>

<type>quarter</type> <dot/> <stem>down</stem> <lyric number="1"> <syllabic>single</syllabic> <text font-family="Times New Roman">chuì</text> </lyric> <lyric number="2"> <syllabic>single</syllabic> <text font-family="Times New Roman">�</text> </lyric> </note>

Page 17: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 17

Here is a single note of the 1100-odd note performance I transcribed (the text is Taiwanese in Church romaji):

and here is the XML for that note:

<measure number="17"> <attributes> <time> <beats>2</beats> <beat-type>4</beat-type> </time> </attributes> <note> <pitch> <step>D</step> <octave>4</octave> </pitch> <duration>12</duration> <voice>1</voice>

<type>quarter</type> <dot/> <stem>down</stem> <lyric number="1"> <syllabic>single</syllabic> <text font-family="Times New Roman">chuì</text> </lyric> <lyric number="2"> <syllabic>single</syllabic> <text font-family="Times New Roman">�</text> </lyric> </note>

Page 18: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 18

That’s exactly what I need to turn

Page 19: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 19

That’s exactly what I need to turnwords set to music (traditional score-notation)

Page 20: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 20

That’s exactly what I need to turnwords set to music (traditional score-notation)

into

Page 21: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 21

That’s exactly what I need to turnwords set to music (traditional score-notation)

intomelody on each syllable.

Page 22: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 22

That’s exactly what I need to turnwords set to music (traditional score-notation)

intomelody on each syllable.

The point is to have a representation of the melody organized by words, rather than the other way around.

Page 23: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 23

Another example:

Page 24: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 24

Another example:

Page 25: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 25

Another example:

<note> <pitch> <step>E</step> <octave>4</octave> </pitch> <duration>6</duration> <voice>1</voice> <type>eighth</type> <dot/> <stem>down</stem> <beam number="1">begin</beam> <notations> <slur type="start" number="1"/> </notations> <lyric number="1"> <syllabic>end</syllabic> <text font-family="Times New Roman">bông</text> </lyric> <lyric number="2"> <syllabic>single</syllabic>

<text>�</text> </lyric> </note><note> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>2</duration> <voice>1</voice> <type>16th</type> <stem>down</stem> <beam number="1">continue</beam> <beam number="2">forward hook</beam> </note><note> <pitch> <step>E</step> <octave>4</octave> </pitch>

<duration>4</duration> <voice>1</voice> <type>eighth</type> <stem>down</stem> <beam number="1">continue</beam> </note><note> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>4</duration> <voice>1</voice> <type>eighth</type> <stem>down</stem> <beam number="1">end</beam> <notations> <slur type="stop" number="1"/> </notations> </note>

Page 26: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 26

Another example:

<note> <pitch> <step>E</step> <octave>4</octave> </pitch> <duration>6</duration> <voice>1</voice> <type>eighth</type> <dot/> <stem>down</stem> <beam number="1">begin</beam> <notations> <slur type="start" number="1"/> </notations> <lyric number="1"> <syllabic>end</syllabic> <text font-family="Times New Roman">bông</text> </lyric> <lyric number="2"> <syllabic>single</syllabic>

<text>�</text> </lyric> </note><note> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>2</duration> <voice>1</voice> <type>16th</type> <stem>down</stem> <beam number="1">continue</beam> <beam number="2">forward hook</beam> </note><note> <pitch> <step>E</step> <octave>4</octave> </pitch>

<duration>4</duration> <voice>1</voice> <type>eighth</type> <stem>down</stem> <beam number="1">continue</beam> </note><note> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>4</duration> <voice>1</voice> <type>eighth</type> <stem>down</stem> <beam number="1">end</beam> <notations> <slur type="stop" number="1"/> </notations> </note>

Page 27: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 27

It is easy to parse the XML using the lxml library; lxml’s root.xpath method allows me request all the note elements as a generator, and I can step through the generator’s output, identifying syllables and then retrieving the melody to assigned to those syllables.

Page 28: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 28

Important edge cases:

Page 29: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 29

Important edge cases:

1. rests — they have no pitch content; also, since they don’t correspond to syllables, consecutive rests can be collapsed into one;

Page 30: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 30

Important edge cases:

1. rests — they have no pitch content; also, since they don’t correspond to syllables, consecutive rests can be collapsed into one;

2. notes tied (but not slurred) together — since they correspond to one or part of one syllable and are all the same pitch, they can be collapsed into one;

Page 31: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 31

Important edge cases:

1. rests — they have no pitch content; also, since they don’t correspond to syllables, consecutive rests can be collapsed into one;

2. notes tied (but not slurred) together — since they correspond to one or part of one syllable and are all the same pitch, they can be collapsed into one;

3. melisma — more than one note per vowel or syllable — represented as a series of notes on one syllable.

Page 32: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 32

Output of the first note above:

Page 33: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 33

Output of the first note above:

Page 34: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 34

Output of the first note above:

...('chuì', [{'pitch_data': {'octave': '4', 'step': 'D'}, 'lyric_2': {'syllabic': 'single', 'text': '�'}, 'duration': 12}]), ...

Page 35: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 35

Output of the more melismatic second example above:

Page 36: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 36

Output of the more melismatic second example above:

Page 37: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 37

Output of the more melismatic second example above:

...('bông', [{'pitch_data': {'octave': '4', 'step': 'E'}, 'lyric_2': {'syllabic': 'single', 'text': '�'}, 'duration': 6}, {'pitch_data': {'octave': '4', 'step': 'G'}, 'duration': 2}, {'pitch_data': {'octave': '4', 'step': 'E'}, 'duration': 4}, {'pitch_data': {'octave': '4', 'step': 'G'}, 'duration': 4}]),...

Page 38: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 38

Output of the more melismatic second example above:

...('bông', [{'pitch_data': {'octave': '4', 'step': 'E'}, 'lyric_2': {'syllabic': 'single', 'text': '�'}, 'duration': 6}, {'pitch_data': {'octave': '4', 'step': 'G'}, 'duration': 2}, {'pitch_data': {'octave': '4', 'step': 'E'}, 'duration': 4}, {'pitch_data': {'octave': '4', 'step': 'G'}, 'duration': 4}]),...

Page 39: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 39

Final output is list of tuples: [(syllable, [note-dicts]), …].

Page 40: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 40

Final output is list of tuples: [(syllable, [note-dicts]), …].

Next steps:

Page 41: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 41

Final output is list of tuples: [(syllable, [note-dicts]), …].

Next steps:

1. Conversion of 'octave' and 'step' attributes of 'pitch_data' to MIDI pitch numbers.

Page 42: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

Branner, Automated* Transcription of a Lyric’s Melody p. 42

Final output is list of tuples: [(syllable, [note-dicts]), …].

Next steps:

1. Conversion of 'octave' and 'step' attributes of 'pitch_data' to MIDI pitch numbers.

2. Analysis of the melodic values of syllables and language phrases.

Page 43: Automated Transcription of a Lyric’s Melody David Branner ...brannerchinese.com/talks/Branner_Melody_of_lyric_presentation_20141023a.pdf · Branner, Automated* Transcription of

End