Skip to content

Instantly share code, notes, and snippets.

@youpy
Created November 22, 2012 04:38
Show Gist options
  • Save youpy/4129439 to your computer and use it in GitHub Desktop.
Save youpy/4129439 to your computer and use it in GitHub Desktop.
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