--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
+
+<score-partwise version="1.1">
+ <movement-title>Backup not to 0 in second voice</movement-title>
+ <part-list>
+ <score-part id="P1">
+ <part-name></part-name>
+ <part-abbreviation></part-abbreviation>
+ </score-part>
+ </part-list>
+ <part id="P1">
+ <measure number="1">
+ <attributes>
+ <divisions>2</divisions>
+ <key><fifths>0</fifths></key>
+ <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>4</octave>
+ </pitch>
+ <duration>2</duration>
+ <voice>1</voice>
+ <type>quarter</type>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>4</octave>
+ </pitch>
+ <duration>2</duration>
+ <voice>1</voice>
+ <type>quarter</type>
+ </note>
+ <backup>
+ <duration>2</duration>
+ </backup>
+ <note>
+ <pitch>
+ <step>A</step>
+ <octave>3</octave>
+ </pitch>
+ <duration>2</duration>
+ <voice>2</voice>
+ <type>quarter</type>
+ </note>
+ <note>
+ <pitch>
+ <step>A</step>
+ <octave>3</octave>
+ </pitch>
+ <duration>2</duration>
+ <voice>2</voice>
+ <type>quarter</type>
+ </note>
+ </measure>
+ </part>
+</score-partwise>
+
if diff > Rational (0) and not (self.ignore_skips and moment == 0):
skip = musicexp.SkipEvent()
- skip.duration.duration_log = 0
- skip.duration.factor = diff
+ duration_factor = 1
+ duration_log = {1: 0, 2: 1, 4:2, 8:3, 16:4, 32:5, 64:6, 128:7, 256:8, 512:9}.get (diff.denominator (), -1)
+ duration_dots = 0
+ if duration_log >= 0: # denominator is a power of 2...
+ if diff.numerator () == 3:
+ duration_log -= 1
+ duration_dots = 1
+ else:
+ duration_factor = Rational (diff.numerator ())
+ else:
+ duration_log = 0
+ duration_factor = diff
+ skip.duration.duration_log = duration_log
+ skip.duration.factor = duration_factor
+ skip.duration.dots = duration_dots
evc = musicexp.EventChord ()
evc.elements.append (skip)