Permalink
Browse files

This branch changes tempo randomly and changes time signature randoml…

…y. I have no idea why anybody would ever want this but somebody asked if it was possible and they post cool links on Twitter so I figured what the hell.
  • Loading branch information...
1 parent ded5543 commit 4159fbb06f13e0d6e882cb5d5f78f2699394ae82 @gilesbowkett committed Oct 17, 2008
Showing with 36 additions and 35 deletions.
  1. +31 −33 db_drum_definition.rb
  2. +1 −0 eval_style.rb
  3. +2 −2 lib/arkx.rb
  4. +2 −0 lib/rhythm.rb
View
@@ -1,38 +1,36 @@
-$clock.bpm = 175
+$clock.bpm = rand > 0.5 ? 175 : 140
$mutation = L{|measure| 0 == (measure - 1) % 2}
$measures = 4
-
-probabilities = {}
-
-probabilities[:none] = [0.0] * 16
-probabilities[:all] = [1.0] * 16
-
-# hip-hop
-# probabilities[36] = [1.0, 0.0, 0.5, 0.25, 0.0, 0.6, 0.0, 0.9, 0.9, 0.0, 1.0, 0.0, 0.5, 0.0, 0.3, 0.0]
-# probabilities[37] = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.0, 1.0, 0.0, 0.0, 0.0]
-
-# d&b
-probabilities[36] = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]
-probabilities[37] = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]
-
-# both
-probabilities[38] = [0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4, 0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0]
-probabilities[39] = [0.3, 0.0, 0.2, 0.6, 0.1, 0.0, 0.4, 0.1, 0.35, 0.15, 0.0, 0.0, 0.2, 0.0, 0.1, 0.0]
-probabilities[40] = [0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0, 0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4]
-probabilities[41] = [0.76, 0.0, 0.23, 0.0, 0.0, 0.0, 0.67, 0.0, 0.15, 0.0, 0.15, 0.0, 0.49, 0.0, 0.15, 0.0]
-probabilities[42] = [0.75, 0.0, 0.13, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.13, 0.0, 0.23, 0.0, 0.0, 0.35, 0.0]
-probabilities[43] = [0.9] * 16
-probabilities[44] = [0.65] * 16
-probabilities[45] = [0.85, 0.35] * 8
-
-# 0 DO NOT USE!
-# 1 distorted Roni Size
-# 2 Roni Size
-# 3 idm
-# 4 Trent Reznor
-# [2,5][rand(2)] hip-hop
-# 6 Zed
-# ((1..6).to_a)[rand(6)] madness
+$beats = rand > 0.5 ? 16 : 9
+
+puts $beats
+
+four_four = {}
+four_four[36] = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]
+four_four[37] = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]
+four_four[38] = [0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4, 0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0]
+four_four[39] = [0.3, 0.0, 0.2, 0.6, 0.1, 0.0, 0.4, 0.1, 0.35, 0.15, 0.0, 0.0, 0.2, 0.0, 0.1, 0.0]
+four_four[40] = [0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0, 0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4]
+four_four[41] = [0.76, 0.0, 0.23, 0.0, 0.0, 0.0, 0.67, 0.0, 0.15, 0.0, 0.15, 0.0, 0.49, 0.0, 0.15, 0.0]
+four_four[42] = [0.75, 0.0, 0.13, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.13, 0.0, 0.23, 0.0, 0.0, 0.35, 0.0]
+four_four[43] = [0.9] * 16
+four_four[44] = [0.65] * 16
+four_four[45] = [0.85, 0.35] * 8
+
+three_three = {}
+three_three[36] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0]
+three_three[37] = [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0]
+three_three[38] = [0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4, 0.0]
+three_three[39] = [0.3, 0.0, 0.2, 0.6, 0.1, 0.0, 0.4, 0.1, 0.35]
+three_three[40] = [0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0, 0.2]
+three_three[41] = [0.76, 0.0, 0.23, 0.0, 0.0, 0.0, 0.67, 0.0, 0.15]
+three_three[42] = [0.75, 0.13, 0.13] * 3
+three_three[43] = [0.9] * 9
+three_three[44] = [0.65] * 9
+three_three[45] = [0.85, 0.35, 0.15] * 3
+
+
+9 == $beat ? probabilities = three_three : probabilities = four_four
def note(midi_note_number)
Note.create(:channel => 2,
View
@@ -3,6 +3,7 @@
$clock = Clock.new(170)
$mutation = L{|measure| 0 == (measure - 1) % 2}
$measures = 4
+$beats = 16
@loop = Arkx.new(:clock => $clock, # rename Arkx to Loop
:measures => $measures,
View
@@ -3,7 +3,7 @@ class Arkx
def initialize(attributes)
@generator = attributes[:generator]
# @measures = attributes[:measures] || 32
- @beats = attributes[:beats] || 16
+ # @beats = attributes[:beats] || 16
midi_destination = attributes[:midi_destination] || 0
@evil_timer_offset_wtf = attributes[:evil_timer_offset_wtf]
@midi = LiveMIDI.new(:clock => @clock = attributes[:clock], # confusion!!!!!!!!!!
@@ -17,7 +17,7 @@ def go
generate_beats = L do
(1..$measures).each do |measure|
@generator.mutate(measure)
- (0..(@beats - 1)).each do |beat|
+ (0..($beats - 1)).each do |beat|
play @generator.notes(beat)
@clock.tick
end
View
@@ -1,8 +1,10 @@
module Archaeopteryx
class Rhythm
+ attr_accessor :beats
def initialize(attributes)
# @mutation = attributes[:mutation]
@drumfile = attributes[:drumfile]
+ @beats = attributes[:beats] || 16
reload
end
def reload

0 comments on commit 4159fbb

Please sign in to comment.