Permalink
Browse files

fix Scissor::Tape#stretch

  • Loading branch information...
1 parent 7cf4b43 commit 7e961a0a0bac1117bdf968e463a2ff599bcc6a49 youpy committed Dec 19, 2011
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/scissor/tape.rb
  2. +4 −4 spec/scissor_spec.rb
View
@@ -193,7 +193,7 @@ def pitch(pitch, stretch = false)
end
def stretch(factor)
- factor_for_pitch = ((100 / factor.to_f) * 100).to_i
+ factor_for_pitch = 1 / (factor.to_f / 100) * 100
pitch(factor_for_pitch, true)
end
View
@@ -182,11 +182,11 @@
end
it "should stretch" do
- scissor = @mp3.slice(0, 10) + @mp3.slice(0, 5)
+ scissor = @mp3.slice(0, 0.1)
- scissor.duration.should eql(15.0)
- scissor.pitch(50, true).duration.should eql(30.0)
- scissor.stretch(200).duration.should eql(30.0)
+ scissor.duration.should eql(0.1)
+ scissor.pitch((0.1 / 120) * 100, true).duration.should be_close(120.0, 0.1)
+ scissor.stretch((120 / 0.1) * 100).duration.should be_close(120.0, 0.1)
end
it "should join instances of scissor" do

0 comments on commit 7e961a0

Please sign in to comment.