Skip to content

Instantly share code, notes, and snippets.

@youpy
Created June 4, 2012 01:46
Show Gist options
  • Save youpy/2865826 to your computer and use it in GitHub Desktop.
Save youpy/2865826 to your computer and use it in GitHub Desktop.
Scissor.sequence example
require 'scissor'
# original
# http://beatsdrummachine.com/
def main
@kits = {
:b => tape('house_2_1.wav'),
:s => tape('roland_tr_909_2.wav').pan(60),
:h => tape('house_2_5.wav') .pan(20),
:c => tape('big_beat_5.wav') .pan(90),
:d => tape('house_2_2.wav')
}
verse = [
sequence('b b b b '),
sequence(' s s '),
sequence(' h h h h '),
]
chorus = [
sequence('b b b b '),
sequence(' s s '),
sequence('hhhhhhhhhhhhh '),
sequence(' cc c c c '),
sequence(' d '),
]
(mix(verse, 'verse.wav') * 4) + (mix(chorus, 'chorus.wav') * 4) >> 'result.wav'
end
def mix(tracks, filename)
Scissor.mix(tracks, filename, :overwrite => true)
end
def tape(basename)
# http://beatsdrummachine.com/hammerhead_drum_sounds.zip
Scissor(File.expand_path('~/Downloads/hammerhead_drum_sounds/' + basename))
end
def sequence(seq)
Scissor.sequence(seq, 60.0 / 105 / 4).apply(@kits)
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment