Created
November 22, 2012 04:38
-
-
Save youpy/4129439 to your computer and use it in GitHub Desktop.
add ainote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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