Using the modes

The idea is simple, a random number is generated, between 0 and 7, which corresponds to a position in several matrices (: c4,: major -: d4,: dorian -: e4,: phrygian) creating with a single number one melodic sequence 1 2 3 2, on the C major scale in this case ā€¦

I apologize for my limited knowledge of English

live_loop :tempo do
  use_synth :tb303
  play :c2,cutoff: 80,release: 1.8,amp: 0.5
  sleep 2
end

with_fx :reverb, mix: 0.5, amp: 0.75 do
  live_loop :mel do
    use_synth :dsaw
    nota= rand_i(0..7)
    dur= rrand(0.45,0.50)
    play scale(:c4,:major)[nota],release: dur
    sleep dur
    play scale(:d4,:dorian)[nota],release: dur/2
    sleep dur/2
    play scale(:e4,:phrygian)[nota],release: dur/2
    sleep dur/2
    sleep 1-(dur*2)
    use_synth :square
    play scale(:d4,:dorian)[nota],release: dur
    sleep 1
  end
end
1 Like

This sounds great Raul.
I think there is one slight error. The syntax for the line
nota=rand_i(0...7)
is not quite right. It should either be
nota=rand_i(8) #this give random integer in range 0..7
(note the last integer here is NOT part of the returned range of values)
or
nota = rrand_i(0,7) #this gives random integer in range 0..7

You can see the syntax if you look up rand_i and rrand_i in the lang section of the Help file.
I like the idea of mixing up notes from different scales. very nice.

Thanks Robin, you can use the same system to harmonize, or repeat four-bar melodies as in this example

with_fx :reverb, mix: 0.5, amp: 0.75 do
  live_loop :mel do
    use_synth :dsaw
    use_random_seed 2017
    4.times do
      nota= rand_i(8)
      dur=0.5
      play scale(:a3,:aeolian)[nota],release: dur
      sleep dur
      play scale(:c4,:major)[nota],release: dur/2
      play scale(:e4,:phrygian)[nota],release: dur/2
      sleep dur
      play scale(:c4,:major)[nota],release: dur/2
      sleep dur/2
      play scale(:d4,:dorian)[nota],release: dur
      sleep dur
      play scale(:b3,:locrian)[nota],release: dur/2
      sleep dur/2
    end
  end
end
1 Like

This is nice. Iā€™m going to have a play with it.