Skip to content

Instantly share code, notes, and snippets.

@clofresh
Created October 7, 2009 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clofresh/204126 to your computer and use it in GitHub Desktop.
Save clofresh/204126 to your computer and use it in GitHub Desktop.
$clock.bpm = 80
$mutation = L{|measure| true}
$measures = 4
def note(midi_note_number)
Note.create(:channel => 2,
:number => midi_note_number,
:duration => 1,
:velocity => 100 + rand(27))
end
kick = 36
snare = 38
clap = 39
hihat1 = 42
hihat2 = 69
xylo1 = 41
xylo2 = 43
xylo3 = 45
xylo4 = 47
xylo5 = 48
probabilities = {}
probabilities[kick] = [1.0, 0.5, 1.0, 0.5] * 4
probabilities[snare] = [0.5] * 16
probabilities[hihat1] = [0.75] * 16
probabilities[hihat2] = [1.0, 0.0] * 8
probabilities[xylo1] = [0.5]*16
probabilities[xylo2] = [0.5]*16
probabilities[xylo3] = [0.5]*16
probabilities[xylo4] = [0.5]*16
probabilities[xylo5] = [0.5]*16
probabilities[clap] = [0.0, 1.0]*8
notes = [
Drum.new(:note => note(kick),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[kick]),
Drum.new(:note => note(snare),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[snare]),
Drum.new(:note => note(hihat1),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[hihat1]),
Drum.new(:note => note(hihat2),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[hihat2]),
Drum.new(:note => note(xylo1),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[xylo1]),
Drum.new(:note => note(xylo2),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[xylo2]),
Drum.new(:note => note(xylo3),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[xylo3]),
Drum.new(:note => note(xylo4),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[xylo4]),
Drum.new(:note => note(xylo5),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[xylo5]),
Drum.new(:note => note(clap),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[clap]),
]
notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment