lib/music-transcription/part.rb in music-transcription-0.5.5 vs lib/music-transcription/part.rb in music-transcription-0.5.6
- old
+ new
@@ -71,9 +71,23 @@
def append! other
@dynamic_profile.append!(other.dynamic_profile,self.duration)
@notes += other.notes.map {|x| x.clone}
return self
end
+
+ def stretch ratio
+ self.clone.stretch! ratio
+ end
+
+ def stretch! ratio
+ @notes.each_index do |i|
+ n1 = @notes[i]
+ @notes[i] = Note.new(n1.duration * ratio, n1.pitches, links: n1.links, accent: n1.accent)
+ end
+
+ @dynamic_profile.stretch! ratio
+ return self
+ end
end
end
end