Skip to content

Commit

Permalink
More progress. Now I have major triads and a bassline, following the …
Browse files Browse the repository at this point in the history
…circle

of fifths. The bassline is exceptionally predictable, but I have the ability
to change that.
  • Loading branch information
gilesbowkett committed Aug 21, 2008
1 parent 3eedd6f commit 150acc4
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 46 deletions.
32 changes: 32 additions & 0 deletions ethniq.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,32 @@
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, 4),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[midi_note_number] || probabilities[:none])
end
notes
32 changes: 32 additions & 0 deletions forest_sounds.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,32 @@
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, 5),
:when => L{|beat| false},
:number_generator => L{rand},
:next => L{|queue| queue[rand(queue.size)]},
:probabilities => probabilities[midi_note_number] || probabilities[:none])
end
notes
66 changes: 21 additions & 45 deletions harmonic_cycle.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,57 +1,33 @@
$clock.bpm = 30 $clock.bpm = 30
$mutation = L{|measure| true} $mutation = L{|measure| 0 == (measure - 1) % 2}
$measures = 4 $measures = 4


next_midi_note_number = OCTAVES[3].to_a[SCALE[CIRCLE_OF_FOURTHS.next]] root = OCTAVES[2].to_a[SCALE[CIRCLE_OF_FIFTHS.next]]
puts next_midi_note_number puts root


def note(midi_note_number) def note(midi_note_number, channel)
Note.create(:channel => 2, Note.create(:channel => channel,
:number => midi_note_number, :number => midi_note_number,
:duration => 3.00, :duration => 3.00,
:velocity => 100 + rand(27)) :velocity => 100 + rand(27))
end end


notes = [] notes = []
notes << Drum.new(:note => note(next_midi_note_number), bass = Drum.new(:note => note(root - 36, 1),
:when => L{|beat| false}, :when => L{|beat| false},
# :number_generator => L{0.9}, :next => L{|queue| queue[queue.size - 1]},
:next => L{|queue| queue[queue.size - 1]}, :number_generator => L{rand},
:number_generator => L{rand}, :probabilities => [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])
# :next => L{|queue| queue[rand(queue.size)]}, notes << bass
:probabilities => [1.0] + [0.0] * 15)
MAJOR_TRIAD.each do |number|
notes << Drum.new(:note => note(root + number, 2),
:when => L{|beat| false},
:next => L{|queue| queue[queue.size - 1]},
:number_generator => L{rand},
:probabilities => [1.0] + [0.0] * 15)
end
notes notes


# # def temple_bells ; do(:awesome).stuff ; end
# # notes << temple_bells
# probabilities = {}
#
# 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{0.9},
# :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
1 change: 1 addition & 0 deletions lib/pitches.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# chords! this can also happen with scales! # chords! this can also happen with scales!
MINOR_7TH = [0, 2, 6, 9] MINOR_7TH = [0, 2, 6, 9]
MAJOR_7TH = [0, 4, 7, 11] MAJOR_7TH = [0, 4, 7, 11]
MAJOR_TRIAD = [0,4,7]


MAJOR_SCALE = [0, 2, 4, 5, 7, 9, 11] MAJOR_SCALE = [0, 2, 4, 5, 7, 9, 11]
MINOR_SCALE = [0, 2, 3, 5, 7, 8, 10] MINOR_SCALE = [0, 2, 3, 5, 7, 8, 10]
Expand Down
Binary file added music_software_files/temple.rns
Binary file not shown.
8 changes: 7 additions & 1 deletion temple.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
:logging => false, :logging => false,
:evil_timer_offset_wtf => 0.2, :evil_timer_offset_wtf => 0.2,
:generator => Mix.new(:rhythms => [Rhythm.new(:drumfile => "harmonic_cycle.rb", :generator => Mix.new(:rhythms => [Rhythm.new(:drumfile => "harmonic_cycle.rb",
:mutation => $mutation)])) :mutation => $mutation),
Rhythm.new(:drumfile => "xanadu.rb",
:mutation => L{|measure| 0 == (measure - 1) % 16}),
Rhythm.new(:drumfile => "forest_sounds.rb",
:mutation => L{|measure| 0 == (measure - 1) % 16}),
Rhythm.new(:drumfile => "ethniq.rb",
:mutation => L{|measure| 0 == (measure - 1) % 16})]))
@loop.go @loop.go




Expand Down
32 changes: 32 additions & 0 deletions xanadu.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,32 @@
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, 3),
: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 comments on commit 150acc4

Please sign in to comment.