Permalink
Browse files

Translating from svn, let's see if I got this

  • Loading branch information...
gilesbowkett committed Jun 30, 2008
0 parents commit da6cab436faff8b8075c460d8e29516c105be61a
@@ -0,0 +1,29 @@
+require 'lib/archaeopteryx'
+
+
+
+
+
+Arkx.new(:clock => Clock.new(23),
+ :measures => 64,
+ :logging => true,
+ :evil_timer_offset_wtf => 4.0,
+ :generator => Mix.new(:rhythms => [Rhythm.new(:drumfile => "def_ambient.rb",
+ :mutation => L{|measure| 0 == (measure - 1) % 16}),
+ Bassline.new(:drumfile => "ambient_low.rb",
+ :mutation => L{|measure| 0 == (measure - 1) % 32}),
+ Bassline.new(:drumfile => "ambient_high.rb",
+ :mutation => L{|measure| 0 == (measure - 1) % 24})
+ ])).go # Ruby can get Lispy fast
+
+
+
+
+# ok this needs: a system to move the notes through the circle of fifths; a system to restrict notes
+# within a given scale which changes as the notes move through the circle of fifths; and real drum rhythms,
+# i.e., ones that actually sound good in the context of all this stuff.
+
+# probably a system similar to the current system for Rhythms and RhythmWithoutEvals (which should probably
+# be the same things, just using different lambdas). just in the mutate method, get your scale from the
+# scale generator, and the scale generator knows where it is in the circle of fifths and has some
+# independent, long-running cycle for moving through that circle.
@@ -0,0 +1,23 @@
+glass_probabilities = {}
+
+glass_probabilities[:never] = [0.0] * 16
+glass_probabilities[:once] = [1.0] + ([0.0] * 15)
+glass_probabilities[:maybe] = [0.67] + ([0.0] * 15)
+
+def glass_note(midi_note_number)
+ Note.create(:channel => [0,1,4,5][rand(4)],
+ :number => midi_note_number,
+ :duration => 3.67,
+ :velocity => 50 + rand(77))
+end
+
+
+moon_notes = []
+(82..91).each do |midi_note_number|
+ moon_notes << Drum.new(:note => glass_note(midi_note_number),
+ :when => L{|beat| false},
+ :number_generator => L{rand},
+ :next => L{|queue| queue[queue.size - 1]},
+ :probabilities => glass_probabilities[midi_note_number] || glass_probabilities[:once])
+end
+moon_notes
@@ -0,0 +1,23 @@
+glass_probabilities = {}
+
+glass_probabilities[:never] = [0.0] * 16
+glass_probabilities[:once] = [1.0] + ([0.0] * 15)
+glass_probabilities[:maybe] = [0.67] + ([0.0] * 15)
+
+def glass_note(midi_note_number, channel)
+ Note.create(:channel => [0,5][rand(2)],
+ :number => midi_note_number,
+ :duration => 3.67,
+ :velocity => 50 + rand(77))
+end
+
+glass_notes = []
+(36..45).each do |midi_note_number|
+ glass_notes << Drum.new(:note => glass_note(midi_note_number, 0),
+ :when => L{|beat| false},
+ :number_generator => L{rand},
+ :next => L{|queue| queue[queue.size - 1]},
+ :probabilities => glass_probabilities[midi_note_number] || glass_probabilities[:once])
+end
+
+glass_notes
@@ -0,0 +1,34 @@
+probabilities = {}
+
+probabilities[:none] = [0.0] * 16
+probabilities[:all] = [1.0] * 16
+
+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]
+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
+
+def note(midi_note_number)
+ Note.create(:channel => 2,
+ :number => midi_note_number,
+ :duration => 0.25,
+ :velocity => 100 + rand(27))
+end
+
+notes = []
+(36..45).each do |midi_note_number|
+ notes << Drum.new(:note => note(midi_note_number),
+ :when => L{|beat| false},
+ :number_generator => L{1.0},
+ :next => L{|queue| queue[queue.size - 1]},
+ # :number_generator => L{rand},
+ # :next => L{|queue| queue[rand(queue.size)]},
+ :probabilities => probabilities[midi_note_number] || probabilities[:none])
+end
+notes
@@ -0,0 +1,39 @@
+probabilities = {}
+
+probabilities[:none] = [0.0] * 16
+probabilities[:all] = [1.0] * 16
+
+probabilities[36] = [0.23, 0.0, 0.0, 0.0, 0.0, 0.0, 0.23, 0.0, 0.0, 0.0, 0.0, 0.0, 0.23, 0.0, 0.0, 0.0]
+probabilities[37] = [0.0, 0.0, 0.0, 0.0, 0.23, 0.0, 0.0, 0.0, 0.0, 0.0, 0.23, 0.0, 0.0, 0.0, 0.0, 0.0]
+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.32, 0.0, 0.23, 0.0, 0.0, 0.0, 0.23, 0.0, 0.15, 0.0, 0.15, 0.0, 0.29, 0.0, 0.15, 0.0]
+probabilities[42] = [0.23, 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.3] * 16
+probabilities[44] = [0.15] * 16
+probabilities[45] = [0.32, 0.23] * 8
+
+def note(midi_note_number, channel)
+ Note.create(:channel => channel,
+ :number => midi_note_number,
+ :duration => 0.25,
+ :velocity => 100 + rand(27))
+end
+
+notes = []
+(36..45).each do |midi_note_number|
+ notes << Drum.new(:note => note(midi_note_number, 2),
+ :when => L{|beat| false},
+ :number_generator => L{rand},
+ :next => L{|queue| queue[rand(queue.size)]},
+ :probabilities => probabilities[midi_note_number] || probabilities[:none])
+end
+(36..45).each do |midi_note_number|
+ notes << Drum.new(:note => note(midi_note_number, [3,3,3,6,7,7,7][rand(7)]),
+ :when => L{|beat| false},
+ :number_generator => L{rand},
+ :next => L{|queue| queue[rand(queue.size)]},
+ :probabilities => probabilities[midi_note_number] || probabilities[:none])
+end
+notes
@@ -0,0 +1,34 @@
+probabilities = {}
+
+probabilities[:none] = [0.0] * 16
+probabilities[:all] = [1.0] * 16
+
+probabilities[36] = [1.0, 0.0, 0.0, 0.0] * 4
+probabilities[37] = ([0.0] * 4 + [1.0] + [0.0] * 3) * 2
+probabilities[38] = [0.8, 0.0, 0.3, 0.0] * 4
+probabilities[39] = [0.0, 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]
+probabilities[40] = [0.01, 0.05] * 16
+probabilities[41] = [0.96] * 16
+probabilities[42] = [0.0, 0.0, 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]
+probabilities[43] = [0.3] * 16
+probabilities[44] = [0.65] * 16
+probabilities[45] = [0.0, 0.0, 0.67, 0.0, 0.25] * 3 + [0.0, 0.1, 0.0]
+
+def note(midi_note_number)
+ Note.create(:channel => 3,
+ :number => midi_note_number,
+ :duration => 0.25,
+ :velocity => 100 + rand(27))
+end
+
+notes = []
+(36..45).each do |midi_note_number|
+ notes << Drum.new(:note => note(midi_note_number),
+ :when => L{|beat| false},
+ # :number_generator => L{rand},
+ # :next => L{|queue| queue[queue.size - 1]},
+ :number_generator => L{rand},
+ :next => L{|queue| queue[rand(queue.size)]},
+ :probabilities => probabilities[midi_note_number] || probabilities[:none])
+end
+notes
@@ -0,0 +1,97 @@
+require 'lib/archaeopteryx'
+
+class Fader # < InfiniteStream
+ attr_accessor :midi_channel, :controller_number
+ # def generating_loop
+ # generate(109)
+ # car = 109
+ # cdr = 0
+ # loop do
+ # generate(cdr)
+ # car, cdr = cdr, car
+ # end
+ # end
+ def toggle
+ [midi_channel, controller_number, self.next]
+ end
+ # def value
+ # @value ||= 100
+ # case @value
+ # when 0
+ # @value = 100
+ # when 100
+ # @value = 0
+ # end
+ # @value
+ # end
+ attr_accessor :value
+end
+
+
+class TapTempo
+ def midi_channel; 0 ; end
+ def controller_number ; 8 ; end
+ def value ; 127 ; end
+end
+
+class DocOck
+ def initialize(attributes)
+ @generator = attributes[:generator]
+ @measures = attributes[:measures] || 32
+ @beats = attributes[:beats] || 16
+ @evil_timer_offset_wtf = attributes[:evil_timer_offset_wtf]
+ @midi = LiveMIDI.new(:clock => @clock = attributes[:clock], # confusion!!!!!!!!!!
+ :logging => attributes[:logging] || false)
+ @tap_tempo = TapTempo.new
+ @faders = []
+ (0..7).each do |number|
+ @faders[number] = Fader.new
+ @faders[number].midi_channel = 0
+ @faders[number].controller_number = number
+ end
+ end
+ def go
+ generate_beats = L do
+ (1..@measures).each do |measure|
+ (0..(@beats - 1)).each do |beat|
+ chosen = rand(7)
+ # @midi.send_controller_message(@tap_tempo) if 0 == beat % 2
+ (0..7).each do |number|
+ case number
+ when chosen
+ @faders[number].value = 100
+ @midi.send_controller_message(@faders[number].midi_channel,
+ @faders[number].controller_number,
+ @faders[number].value)
+ else
+ @faders[number].value = 0
+ @midi.send_controller_message(@faders[number].midi_channel,
+ @faders[number].controller_number,
+ @faders[number].value)
+ end
+ end
+ @clock.tick
+ end
+ end
+ @midi.timer.at((@clock.start + @clock.time) - @evil_timer_offset_wtf, &generate_beats)
+ end
+ generate_beats[]
+ gets
+ end
+end
+
+DocOck.new(:clock => Clock.new(116),
+ :evil_timer_offset_wtf => 0.2).go
+
+
+# so, I need to schedule these motions, just like I would schedule a MIDI note; and also I need to
+# apply tweens, to make the motion fluid. I need to support the variety of different control styles
+# which Live enables, and I need some way of mapping these things, so that I can accomodate complexity
+# in their number and arrangement. I need programmatic control, similar to my Reason live-coding, and
+# I need to power the tap tempo button in such a way that I retain my Reason features while hitting
+# the absolute bare minimum of complexity in MIDI synch.
+
+# if I get all these things done, I have a combined live-coding package which generates music in
+# Reason and Live simultaneously. then you throw the outputs to a hardware mixer and sort it out live
+# (no pun intended). at that point there's a use case for cue audio again, so at that point you can
+# build a cue setup in Reason and use the cue features in Live as well.
@@ -0,0 +1,8 @@
+require 'lib/archaeopteryx'
+
+Arkx.new(:clock => Clock.new(167),
+ :measures => 4,
+ :logging => true,
+ :evil_timer_offset_wtf => 0.2,
+ :generator => Rhythm.new(:drumfile => "db_drum_definition.rb",
+ :mutation => L{|measure| 0 == (measure - 1) % 2})).go
@@ -0,0 +1,58 @@
+@probabilities = {}
+
+@probabilities[:none] = [0.0] * 16
+@probabilities[:all] = [1.0] * 16
+
+@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]
+@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
+
+def note(midi_note_number, channel =2)
+ Note.create(:channel => channel,
+ :number => midi_note_number,
+ :duration => 0.25,
+ :velocity => 100 + rand(27))
+end
+
+def fill_drums
+ fill = []
+ (36..45).each do |midi_note_number|
+ fill << Drum.new(:note => note(midi_note_number, [2,3][rand(2)]),
+ :when => L{|beat| false},
+ :number_generator => L{rand},
+ :next => L{|queue| queue[rand(queue.size)]},
+ :probabilities => @probabilities[midi_note_number] || @probabilities[:none])
+ end
+ fill
+end
+
+def main_drums
+ main = []
+ (36..45).each do |midi_note_number|
+ main << Drum.new(:note => note(midi_note_number),
+ :when => L{|beat| false},
+ :number_generator => L{0.8},
+ :next => L{|queue| queue[queue.size - 1]},
+ :probabilities => @probabilities[midi_note_number] || @probabilities[:none])
+ end
+ main
+end
+
+def alt_drums
+ alt = []
+ (36..45).each do |midi_note_number|
+ alt << Drum.new(:note => note(midi_note_number),
+ :when => L{|beat| false},
+ :number_generator => L{0.9},
+ :next => L{|queue| queue[queue.size - 1]},
+ :probabilities => @probabilities[midi_note_number] || @probabilities[:none])
+ end
+ alt
+end
@@ -0,0 +1,22 @@
+require 'lib/archaeopteryx'
+require 'incr_drum_definition'
+
+literal_rhythm = RhythmWithoutEval.new(:drums => main_drums,
+ :mutation => L{|measure| true})
+literal_2 = RhythmWithoutEval.new(:drums => alt_drums,
+ :mutation => L{|measure| true})
+dynamically_calculated_fill = L{RhythmWithoutEval.new(:drums => fill_drums,
+ :mutation => L{|measure| 0 == (measure - 1) % 2})}
+first_rhythm = L{literal_rhythm}
+second_rhythm = L{literal_2}
+
+rhythms = [first_rhythm] * 4 +
+ [second_rhythm] * 4 +
+ [first_rhythm] * 2 + [second_rhythm] * 2 +
+ [first_rhythm, second_rhythm, first_rhythm, dynamically_calculated_fill]
+
+Arkx.new(:clock => Clock.new(167),
+ :evil_timer_offset_wtf => 0.2,
+ # :measures => 4, # this does absolutely fucking nothing!
+ :generator => Sequence.new(:array => rhythms,
+ :measures => 1)).go
Oops, something went wrong.

0 comments on commit da6cab4

Please sign in to comment.