Skip to content
Browse files

More progress. Now I have major triads and a bassline, following the …

…circle

of fifths. The bassline is exceptionally predictable, but I have the ability
to change that.
  • Loading branch information...
1 parent 3eedd6f commit 150acc422389af20b197d8a4c07f2b1a1d966c30 @gilesbowkett committed
Showing with 125 additions and 46 deletions.
  1. +32 −0 ethniq.rb
  2. +32 −0 forest_sounds.rb
  3. +21 −45 harmonic_cycle.rb
  4. +1 −0 lib/pitches.rb
  5. BIN music_software_files/temple.rns
  6. +7 −1 temple.rb
  7. +32 −0 xanadu.rb
View
32 ethniq.rb
@@ -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
View
32 forest_sounds.rb
@@ -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
View
66 harmonic_cycle.rb
@@ -1,57 +1,33 @@
$clock.bpm = 30
-$mutation = L{|measure| true}
+$mutation = L{|measure| 0 == (measure - 1) % 2}
$measures = 4
-next_midi_note_number = OCTAVES[3].to_a[SCALE[CIRCLE_OF_FOURTHS.next]]
-puts next_midi_note_number
+root = OCTAVES[2].to_a[SCALE[CIRCLE_OF_FIFTHS.next]]
+puts root
-def note(midi_note_number)
- Note.create(:channel => 2,
+def note(midi_note_number, channel)
+ Note.create(:channel => channel,
:number => midi_note_number,
:duration => 3.00,
:velocity => 100 + rand(27))
end
notes = []
-notes << Drum.new(:note => note(next_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 => [1.0] + [0.0] * 15)
+bass = Drum.new(:note => note(root - 36, 1),
+ :when => L{|beat| false},
+ :next => L{|queue| queue[queue.size - 1]},
+ :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])
+notes << bass
+
+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
-#
-#
-# 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
+# def temple_bells ; do(:awesome).stuff ; end
+# notes << temple_bells
View
1 lib/pitches.rb
@@ -31,6 +31,7 @@
# chords! this can also happen with scales!
MINOR_7TH = [0, 2, 6, 9]
MAJOR_7TH = [0, 4, 7, 11]
+MAJOR_TRIAD = [0,4,7]
MAJOR_SCALE = [0, 2, 4, 5, 7, 9, 11]
MINOR_SCALE = [0, 2, 3, 5, 7, 8, 10]
View
BIN music_software_files/temple.rns
Binary file not shown.
View
8 temple.rb
@@ -11,7 +11,13 @@
:logging => false,
:evil_timer_offset_wtf => 0.2,
: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
View
32 xanadu.rb
@@ -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.
Something went wrong with that request. Please try again.