Scale Chromatic

# variables generales e inicio
notas = scale(:eb3,:chromatic,num_octaves: 3)
use_bpm 96
acordes = [[0,4,7],[4,7,12],[7,12,16],[0,3,7],[3,7,12],[7,12,15]] # acoredes maj y min e inversiones
raiz = 0
maj = [0,2,4,7,9,12,14,16,19] # pentatonica maj
min = [0,3,5,7,10,12,15,17,19] #pentatonica min
escala = 0 # escala por defecto maj
acorde_uso = rrand_i(0,5) # acorde uso
acorde_esc = acordes[acorde_uso] # notas acorde
raiz = acorde_esc[[0,1,2].choose] # eleccion una de las notas como raiz
t = 0
zy = "zynaddsubfx_zynaddsubfx_132_0" # puerto
fl = "fluid_synth_(3528)_synth_input_port_(3528_0)_134_0" # puerto
contador = 0


# aura, gost whistle 1, bass analog 3, simple brass
define :canales do
  midi_cc 0,25,channel: 1,port: zy # banco 25
  midi_cc 32,0,channel: 1,port: zy # va a cambiar el banco 25
  midi_pc 50,channel: 1,port: zy # programa 50 banco 4
  sleep 1
  midi_cc 0,4,channel: 2,port: zy # banco 4
  midi_cc 32,0,channel: 2,port: zy # va cambiar banco 4
  midi_pc 22,channel: 2,port: zy# programa 22 banco 4
  sleep 1
  midi_cc 0,1,channel: 3,port: zy  # banco 24
  midi_cc 32,0,channel: 3,port: zy # cambiat banco 24
  midi_pc 2,channel: 3,port: zy # programa 39 banco 24
  sleep 1
  midi_cc 0,0,channel: 1, port: fl   # banco 0
  midi_cc 32,0,channel: 1,port: fl # va cambiar banco 0
  midi_pc 0,channel: 1,port: fl # programa 0 banco 0
  sleep 1
  midi_cc 0,2,channel: 4, port: zy   # banco 0
  midi_cc 32,0,channel: 4,port: zy # va cambiar banco 0
  midi_pc 64,channel: 4,port: zy # programa 0 banco 0
  sleep 1
  midi_cc 10,32,channel: 1, port: zy # pan canal 1
  sleep 1
  midi_cc 10,110,channel: 2, port: zy # pan canal 2
  sleep 1
  midi_cc 10,74,channel: 3, port: zy # pan canal 3
  sleep 1
  midi_cc 10,96,channel: 1, port: fl  # pan canal 1 puerto fl
  sleep 1
  midi_cc 10,54,channel: 4 , port: zy  # pan canal 1 puerto fl
  sleep 1
end

define :inicio do
  # eleccion acordes
  raiz = raiz+acorde_esc[[0,1,2].choose] # eleccion raiz
  acorde_uso = rrand_i(0,5) # acorde uso
  acorde_esc = acordes[acorde_uso] #  notas acorde uso
  # limitar octava raiz
  if raiz > 11
    raiz -= 12
  end
  t = 8
  contador += 1
  puts contador
end


define :bajo do
  # notas bajo
  midi_note_on notas[raiz]-24, channel: 3, port: zy,velocity: 60
  midi_note_on notas[raiz]-12, channel: 4, port: zy,velocity: 60
end

define :pads do
  
  3.times do |i|
    # notas acorde
    midi_note_on notas[raiz+acorde_esc[i]],channel: 1, velocity: 80, port: zy
    midi_note_on notas[raiz+acorde_esc[i]],channel: 2, velocity: 80, port: zy
    
  end
end

define :escala do
  # eleccion escala por defecto maj
  escala= maj
  # los 3 primeros acordes son maj
  if acorde_uso > 2
    escala= min
  end
end


define :melodia do
  # notas que contendra melodia
  z = rrand_i(5,9)
  
  11.times do
    if (spread z,11).tick
      no = rrand_i(0,7)
      n = raiz+escala[no]
      midi_note_on notas[n],channel: 1, port: fl,velocity: 90
      if no > 4 and no < 8
        n = raiz+escala[[no-2,no-3].choose]
        midi_note_on notas[n],channel: 1, port: fl,velocity: 90
      end
    end
    sleep 0.5
    midi_note_off n, channel: 1, port: fl
    if (spread 11-z,11).look
      sleep 0.5
    end
  end
end

define :fx do
  with_fx :reverb do
    with_fx :ixi_techno,phase: (ring 0.5,0.25,0.125).choose do
      with_fx :slicer,phase: (ring 0.5,0.25,0.125).choose do
        live_loop :buc do
          z = [0,1,2].choose
          if z == 0 # off loop
            stop
          end
          3.times do |i|
            synth :mod_dsaw, note: notas[raiz+acorde_esc[i]],amp: 0.2,attack: 2,sustain: 4,release: 3,cutoff: 80,pan: rrand(-1,1)
          end
          sleep 2
        end
      end
    end
  end
end

define :drum do
  live_loop :dr do
    z = [0,1,2].choose
    if z == 0 # off loop
      stop
    end
    with_fx :echo,pahase: (ring 0.5,0.25).choose do
      sample 25,pan: [-1,1].choose,amp: 2
      sleep 1
    end
  end
end


canales()
sleep 1

live_loop :a do
  if contador == 25
    midi_all_notes_off
    stop
  end
  use_real_time
  inicio()
  bajo()
  drum()
  escala()
  fx()
  pads()
  sleep 0.5
  melodia()
  midi_all_notes_off
end

I use the synths ZynaddsubFx and Qsynth
First I determine the banks and channels that I use, as well as the bread of each one of them
The scale is chromatic and the chords used are randomly chosen but the chord must have at least one note in common with the one used before, they can be higher or lower.
For each chord I use the major or minor pentatonic scale of the root note of the chord, depending on whether the chord was major or minor

https://www.youtube.com/watch?v=mlyLFANXaCw

3 Likes