Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
require 'rubygems'
require 'pit'
require 'scissor/echonest'
config = Pit.get('echonest.com', :require => {
'api_key' => 'your Echo Nest API key'
})
Scissor.echonest_api_key = config['api_key']
Scissor.logger.level = Logger::DEBUG
def main
if ARGV.size != 3
puts "usage: #$0 masterfile slavefile outfile"
exit
end
masterfile, slavefile, outfile = ARGV
master = Scissor(masterfile).beats
slave = Scissor(slavefile).beats
results = []
master.each_with_index do |chunk, index|
if slave[index]
pitch = slave[index].duration / chunk.duration * 100
results << slave[index].pitch(pitch)
else
break
end
end
Scissor.mix([Scissor.join(master), Scissor.join(results)], outfile, { :overwrite => true })
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment