Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
add ainote
# inspired by https://github.com/negipo/ainote
require 'scissor/echonest'
def ainote(dir)
Scissor(dir + '/%i.m4a' % rand(5))
end
def main
ainote_dir, source_file = ARGV
src_track = Scissor(source_file)
ainote_track = Scissor.silence(src_track.duration)
bars = src_track.bars
bars.each do |bar|
ainote = ainote(ainote_dir)
ainote_track = ainote_track.replace(bar.start, [ainote.duration, bar.duration].min, ainote)
end
Scissor.mix([src_track, ainote_track], 'ainote.mp3', :overwrite => true)
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment