lib/scissor/chunk.rb in scissor-0.0.26 vs lib/scissor/chunk.rb in scissor-0.1.0
- old
+ new
@@ -145,30 +145,36 @@
@fragments.reverse.each do |fragment|
new_instance.add_fragment(Fragment.new(
fragment.filename,
fragment.start,
- fragment.true_duration,
+ fragment.original_duration,
!fragment.reversed?,
fragment.pitch))
end
new_instance
end
- def pitch(pitch)
+ def pitch(pitch, stretch = false)
new_instance = self.class.new
@fragments.each do |fragment|
new_instance.add_fragment(Fragment.new(
fragment.filename,
fragment.start,
- fragment.true_duration,
+ fragment.original_duration,
fragment.reversed?,
- fragment.pitch * (pitch.to_f / 100)))
+ fragment.pitch * (pitch.to_f / 100),
+ stretch))
end
new_instance
+ end
+
+ def stretch(factor)
+ factor_for_pitch = ((100 / factor.to_f) * 100).to_i
+ pitch(factor_for_pitch, true)
end
def to_file(filename, options = {})
Scissor.mix([self], filename, options)
end