From df591b87c9052ac4ddf067a2cddfeac2c049c4c1 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Mon, 3 Sep 2007 14:13:13 +0000 Subject: [PATCH] Fix handling of pickup notes --- Filters/VLMusicXMLType.reader | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Filters/VLMusicXMLType.reader b/Filters/VLMusicXMLType.reader index 16d95e5..faaef8c 100755 --- a/Filters/VLMusicXMLType.reader +++ b/Filters/VLMusicXMLType.reader @@ -397,6 +397,21 @@ class MusicXMLListener unless @harm.empty? @meas['chords'] = makeHarmChords(@harm) end + if @measNo == 0 + # + # If first measure is pickup, duration is shorter than time + # + denom = @prop['divisions']*4 + timeLen = denom*@prop['timeNum'] / @prop['timeDenom'] + if @at < timeLen + @meas['melody'].unshift( + { 'pitch' => VL::NoPitch, + 'durNum' => timeLen-@at, 'durDenom' => denom }) + @meas['chords'].unshift( + { 'pitch' => VL::NoPitch, 'root' => VL::NoPitch, 'steps' => 0, + 'durNum' => timeLen-@at, 'durDenom' => denom }) unless @harm.empty? + end + end end when 'part' then OUTPUT['properties'] = @props unless @part == 'HARM'