Fix relative pitch

This commit is contained in:
Matthias Neeracher 2007-10-21 21:25:41 +00:00
parent 9a9ca22d9a
commit 2ac1ed067c

View File

@ -62,6 +62,12 @@ def lyPitch(pitch, base=-1)
p += base p += base
elsif $RELPITCH > 0 elsif $RELPITCH > 0
while $RELPITCH-p > 5 while $RELPITCH-p > 5
if $RELPITCH-p == 6
#
# f -> b choose upward interval, b -> f choose downward
#
break if p%12 == PITCH[?f]
end
p += 12 p += 12
end end
else else
@ -69,6 +75,7 @@ def lyPitch(pitch, base=-1)
end end
pitch.scan(/'/) {|c| p += 12} pitch.scan(/'/) {|c| p += 12}
pitch.scan(/,/) {|c| p -= 12} pitch.scan(/,/) {|c| p -= 12}
puts "#{pitch}<>#{$RELPITCH} -> #{p}" if $DEBUG
if base == -1 && $RELPITCH > 0 if base == -1 && $RELPITCH > 0
$RELPITCH = p $RELPITCH = p
end end