Create a gist now

Instantly share code, notes, and snippets.

amenizer
%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
file = Tempfile.new(%w/amen .wav/)
file.write(open('http://dl.dropbox.com/u/334064/amen_lq.wav').read)
amens = Scissor(file.path) / 4
target = Scissor(infile)
result = Scissor.silence(target.duration)
target.bars.each do |bar|
amen = amens[rand(amens.size)]
new_bar = amen.stretch((bar.duration / amen.duration) * 100)
result = result.replace(bar.start - 0.05, bar.duration, new_bar)
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