Skip to content

Commit

Permalink
Merge branch '45-support-breath-marks' into 'stable'
Browse files Browse the repository at this point in the history
Resolve "Support breath marks"

Closes frescobaldi#45

See merge request bgeorge/python-ly!52
  • Loading branch information
bryantgeorge committed Dec 18, 2019
2 parents 08217e3 + 04e2f2a commit 7807398
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ly/musicxml/ly2xml_mediator.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ def end_gliss(self, note, line):
n = 1
note.set_gliss(line, endtype="stop", nr=n)

def set_breathe(self):
self.current_note.add_articulation('breath-mark')

def set_tremolo(self, trem_type='single', duration=0, repeats=0, note_count=1):
if self.current_note.tremolo[1]: # tremolo already set
self.current_note.set_tremolo(trem_type)
Expand Down
2 changes: 2 additions & 0 deletions ly/musicxml/lymus2musxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,8 @@ def Command(self, command):
self.phr_slur_types[-1] = 'dotted'
elif command.token == '\\break':
self.mediator.set_sys_break()
elif command.token == '\\breathe':
self.mediator.set_breathe()
else:
if command.token not in excls:
eprint("Unknown command:", command.token)
Expand Down
41 changes: 41 additions & 0 deletions tests/test_xml_files/breath_marks.ly
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
\version "2.18.2"

\language "english"

keyTime = {
\time 4/4
}

Soprano = \relative c'' {
\voiceOne
\keyTime
c4 c \breathe c c \breathe
c c c c
}

Alto = \relative c'' {
\voiceTwo
\keyTime
a1
a2 \breathe a
}

Tenor = \relative c {
\keyTime
\clef "bass"
a4 \breathe a <a c> \breathe a
a1 \breathe \bar "|."
}

\score
{
<<
\new Staff = "treble" \with {}
<<
\clef "treble"
\new Voice = "SopranoVoice" \Soprano
\new Voice = "AltoVoice" \Alto
>>
\new Staff \Tenor
>>
}
263 changes: 263 additions & 0 deletions tests/test_xml_files/breath_marks.musicxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN"
"http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.0">
<identification>
<encoding>
<software>python-ly 0.9.5</software>
<encoding-date>2019-12-17</encoding-date>
</encoding>
</identification>
<part-list>
<score-part id="P1">
<part-name />
</score-part>
<score-part id="P2">
<part-name />
</score-part>
</part-list>
<part id="P1">
<measure number="1">
<attributes>
<divisions>1</divisions>
<time symbol="common">
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<notations>
<articulations>
<breath-mark />
</articulations>
</notations>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<notations>
<articulations>
<breath-mark />
</articulations>
</notations>
</note>
<backup>
<duration>4</duration>
</backup>
<note>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>2</voice>
<type>whole</type>
</note>
<backup>
<duration>4</duration>
</backup>
</measure>
<measure number="2">
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<backup>
<duration>4</duration>
</backup>
<note>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>2</voice>
<type>half</type>
<notations>
<articulations>
<breath-mark />
</articulations>
</notations>
</note>
<note>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>2</voice>
<type>half</type>
</note>
<backup>
<duration>4</duration>
</backup>
<attributes />
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
<part id="P2">
<measure number="1">
<attributes>
<divisions>1</divisions>
<time symbol="common">
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>F</sign>
<line>4</line>
</clef>
</attributes>
<note>
<pitch>
<step>A</step>
<octave>2</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<notations>
<articulations>
<breath-mark />
</articulations>
</notations>
</note>
<note>
<pitch>
<step>A</step>
<octave>2</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>A</step>
<octave>2</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<notations>
<articulations>
<breath-mark />
</articulations>
</notations>
</note>
<note>
<chord />
<pitch>
<step>C</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<note>
<pitch>
<step>A</step>
<octave>2</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
</note>
<backup>
<duration>4</duration>
</backup>
</measure>
<measure number="2">
<note>
<pitch>
<step>A</step>
<octave>2</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<notations>
<articulations>
<breath-mark />
</articulations>
</notations>
</note>
<backup>
<duration>4</duration>
</backup>
<attributes />
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>

0 comments on commit 7807398

Please sign in to comment.