Skip to content

Instantly share code, notes, and snippets.

@youpy youpy/amenizer.rb
Created Oct 31, 2011

What would you like to do?
%w!ubygems scissor/echonest pit open-uri tempfile!.each {|g| require g }
Scissor.logger.level = Logger::DEBUG
Scissor.echonest_api_key = Pit.get('', :require => {
'api_key' => 'your Echo Nest API key'
infile, outfile = ARGV
file = .wav/)
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)
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
You can’t perform that action at this time.