Created
December 1, 2011 08:06
-
-
Save youpy/1414847 to your computer and use it in GitHub Desktop.
909 乗っけるやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %w!ubygems scissor/echonest pit open-uri tempfile!.each {|g| require g } | |
| Scissor.logger.level = Logger::DEBUG | |
| Scissor.echonest_api_key = Pit.get('echonest.com', :require => { | |
| 'api_key' => 'your Echo Nest API key' | |
| })['api_key'] | |
| infile, outfile = ARGV | |
| bd = Scissor('http://dl.dropbox.com/u/334064/909BD.wav') | |
| target = Scissor(infile) | |
| result = Scissor.silence(target.duration) | |
| target.beats.each do |beat| | |
| x = nil | |
| if bd.duration > beat.duration | |
| x = bd + Scissor.silence(beat.duration - bd.duration) | |
| else | |
| x = bd[0, beat.duration] | |
| end | |
| result = result.replace(beat.start, beat.duration, x) | |
| end | |
| Scissor.mix([target, result], outfile, :overwrite => true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment