lib/scissor/chunk.rb in youpy-scissor-0.0.20 vs lib/scissor/chunk.rb in youpy-scissor-0.0.21
- old
+ new
@@ -148,23 +148,34 @@
@fragments.reverse.each do |fragment|
new_instance.add_fragment(Fragment.new(
fragment.filename,
fragment.start,
- fragment.duration,
- !fragment.reversed?))
+ fragment.true_duration,
+ !fragment.reversed?,
+ fragment.pitch))
end
new_instance
end
- def to_file(filename, options = {})
- writer = Writer.new
+ def pitch(pitch)
+ new_instance = self.class.new
- writer.add_track(@fragments)
- writer.to_file(filename, options)
+ @fragments.each do |fragment|
+ new_instance.add_fragment(Fragment.new(
+ fragment.filename,
+ fragment.start,
+ fragment.true_duration,
+ fragment.reversed?,
+ fragment.pitch * (pitch.to_f / 100)))
+ end
- self.class.new(filename)
+ new_instance
+ end
+
+ def to_file(filename, options = {})
+ Scissor.mix([self], filename, options)
end
alias > to_file
def >>(filename)