Skip to content

Instantly share code, notes, and snippets.

@youpy
Created August 29, 2009 15:37
Show Gist options
  • Save youpy/177513 to your computer and use it in GitHub Desktop.
Save youpy/177513 to your computer and use it in GitHub Desktop.
#!/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