SPi + QY Algorithm Sequencer (Test #1)

I created a basic Midi In handler that triggers samples based on input from a sequencer. A second sequencer is used as a live_audio input to play along with the beat and allows me to multitask between the sequencers. Everything is kept in time by Sonic Pi.

The track skips a bit. I didn’t see any slow down error messages but I’ll experiment more and see if I can minimize that issue. Maybe it has something to do with too many if-statements being called simultaneously.

(Sorry, the lead is a bit loud when it kicks in)

5 Likes

Hello … quite a late reaction but
what is a QY Algorithm Sequencer?
Would you offer the code for this sound?
Thanks.

Sorry for the confusion. The QY is referring to me using a Yamaha QY100 as a MIDI sequencer in this setup.

I wouldn’t exactly recommend the QY100 because there are better modern MIDI sequencing devices on the market that are probably easier to learn. The QY100 does have one thing that most modern hardware doesn’t have though… it has a system that can re-harmonize an entire composition to any chord or key no matter how complex. I haven’t seen this in any other MIDI hardware I’ve come across.

Rather that use MIDI to simply trigger notes. I have instead set up my code so Sonic Pi is listening for incoming MIDI notes and velocities and then carrying out chunks of code that are either playing Sonic Pi’s built-in synths or external samples that I have in folders on my desktop.

My code is very specific to the hardware I’m using but you can pull any ideas from it. In the code you can see how each live_loop is listening for incoming notes on certain midi channels for each particular instrument. It also checks for velocities as a way to decide which sample or synth to play, and with which effects. Also there is some live_audio coming in straight from the QY100 which is synthesizing one particular sound to accompany Sonic Pi. Sorry it’s a bit messy with lots of lines commented out. Also some portions of the code are not in use… I don’t think I made use of all the automation risers and LFOs I had defined, nor did I make use of all the sample libraries I referenced.

use_bpm 120

aolVox2 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Volca Glitch/" #[0-2]
aolVox = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Nutypre Chops/" #[0-2]
aolVox4 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Side Quest Loops/" #[0-2]
aolVox3 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Polybius/" #[0-2]
aolVox5 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Side Quest Vox/" #[0-2]
aolVox7 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Nutype/" #[0-2]
aolVox6 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Barret Loops/"
aolVox8 = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Let Go Jeeshan A/"

aolLoop = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Ravancloak/" #[0-2]
aolChop = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Side Quest Loops/" #[0-2]
aolX = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Looperman Samples/"
aolY = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Polybius/" #[0-2]
aolVoxA = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/Nutype Loops/"
aolTemplate = "/Users/sheakennedy/Desktop/Elder Desktop/DESKTOP/Drum Kits _ Samples/Homebrew/B - Breaks"

# AUTOMATION
line_Riser0 = (line 10, 0, inclusive: true, steps: 16)
line_Riser1 = (line 8, 0, inclusive: true, steps: 128)
line_Riser2 = (line 4, 0, inclusive: true, steps: 128)
lfo0 = (line 70, 100, inclusive: true, steps: 16).mirror
lfo1 = (line 0.8, 0.99, inclusive: true, steps: 32).mirror
lfo2 = (line 120, 60, inclusive: true, steps: 4).mirror
lfo3 = (line 30, 130, inclusive: true, steps: 64).mirror
lfo4 = (line 0.7, 0.99, inclusive: true, steps: 4).mirror
lfo5 = (line 0.3, 0.99, inclusive: true, steps: 2).mirror

##| Instrument w/o velocity:
##| live_loop :midi_piano do
##|   use_real_time
##|   note, velocity = sync "/midi:minilogue_kbd_knob:1/note_on"
##|   synth :tb303, note: note
##| end

##| Sync MIDI clock:
live_loop :midi_clock do
  midi_clock_beat
  sleep 1
end

##| Instrument w/ velocity:
##| live_loop :midi_minilogue do
##|   use_real_time
##|   note, velocity = sync "/midi:minilogue_kbd_knob:9/note_on"
##|   if(velocity >= 1)
##|     synth :dpulse, note: note, amp: velocity / 127.0
##|   end
##| end

live_audio :foo, stereo: true, input: 1

##| QY100 - 1:
live_loop :midi_qy100_1 do
  use_real_time
  note, velocity = sync "/midi:minilogue_midi_in:1/note_on"
  puts tick
  if(velocity >= 1)
    if(note == 52) # On keyboard = E
      with_fx :slicer do
        sample aolVox2, 1, rate: 1, onset: 1, release: 0.1
      end
    end
    if(note == 53) # On keyboard = F
      with_fx :ping_pong, phase: 4, feedback: 0.1 do
        ##| sample aolLoop, ring(7,9,4,4).look, rate: ring(2,1,4,4).look, onset: 1, release: 1
        sample aolLoop, 11, rate: 2, onset: 1, release: 0.1
      end
    end
    if(note == 54) # On keyboard = F#
      with_fx :flanger do
        sample aolVox5, 10, rate: 0.5, onset: 1, release: 0.1
      end
    end
  end
end


##| QY100 - 2:
live_loop :midi_qy100_2 do
  use_real_time
  note, velocity = sync "/midi:minilogue_midi_in:2/note_on"
  if(velocity >= 1)
    if(note == 52) # On keyboard = E
      ##| with_fx :distortion do
      sample aolY, 4, rate: 1, onset: 0, release: 0.1
      ##| end
    end
    if(note == 53) # On keyboard = F
      sample aolLoop, 4, rate: 1, onset: 3, release: 1
    end
    if(note == 54) # On keyboard = F#
      sample aolVox8, 5, rate: 1, onset: 1, release: 1
    end
  end
end

##| QY100 - 3:
live_loop :midi_qy100_3 do
  use_real_time
  note, velocity = sync "/midi:minilogue_midi_in:3/note_on"
  if(velocity >= 1)
    if(note == 52) # On keyboard = E
      ##| sample aolChop, 3, rate: 1, onset: 0, release: 1, beat_stretch: 8
    end
    if(note == 53) # On keyboard = F
      sample aolChop, 3, rate: 1, onset: 0, release: 1, beat_stretch: 2
    end
  end
end

##| QY100 - 4:
live_loop :midi_qy100_4 do
  use_real_time
  note, velocity = sync "/midi:minilogue_midi_in:4/note_on"
  if(velocity >= 1)
    ##| with_fx :slicer, phase: 0.25 do
    puts tick
    synth :blade, note: note, amp: velocity / 127.0, cutoff: lfo3.look
    ##| end
  end
end

##| QY100 - 5:
live_loop :midi_qy100_5 do
  use_real_time
  puts tick
  note, velocity = sync "/midi:minilogue_midi_in:5/note_on"
  if(velocity >= 1)
    synth :blade, note: note, amp: velocity / 127.0, cutoff: 130, attack: 0.05
  end
end

##| QY100 - 6:
live_loop :midi_qy100_6 do
  use_real_time
  puts tick
  note, velocity = sync "/midi:minilogue_midi_in:6/note_on"
  if(velocity >= 1)
    if(note == 53) # On keyboard = E
      with_fx :panslicer, phase: 2, amp: 1.2 do
        sample aolVox2, 1, rate: 2, release: 0.1, beat_stretch: 16, start: 0, finish: 0.75
      end
    end
  end
end

##| QY100 - 7:
live_loop :midi_qy100_7 do
  use_real_time
  puts tick
  set_rate = 1
  inst = 1
  folder = aolVoxA
  note, velocity = sync "/midi:minilogue_midi_in:7/note_on"
  with_fx :level, amp: choose([1]) do
    if(velocity >= 1)
      if(note == 52)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0, finish: 0.125
      end
      if(note == 53)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.125, finish: 0.25
      end
      if(note == 54)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.25, finish: 0.375
      end
      if(note == 55)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.375, finish: 0.5
      end
      if(note == 56)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.5, finish: 0.625
      end
      if(note == 57)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.625, finish: 0.75
      end
      if(note == 58)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.75, finish: 0.875
      end
      if(note == 59)
        sample folder, inst, rate: set_rate, release: 0.1, beat_stretch: 16, start: 0.875, finish: 1
      end
    end
  end
end
1 Like

Oh thank you. That is interesting to read. I would like to try out your code
with the QY100 which suprisingly I own myself.

Would you possibly provide the samples mentioned in your code?

Cheers

That’s awesome! I don’t meet many people who have one. It’s a really good piece of gear though once you get used to the workflow and menu-diving.

Here’s a link to the samples I’m using.

You can use any of those for personal projects to get you started. Just a heads up though, the Jeeshan, Ravancloak, Polybius, and Side Quest Vox folders are all sampled from songs I published with friends. So if you upload to YouTube or something their Content ID system might recognize and flag it. I won’t issue a takedown or anything though, so don’t worry. I just want to let you know so you’re not surprised if that happened.

Note, when you set up tracks on the QY100 you’ll have to play the same notes and velocities, on the same midi channels that are defined in the code. Or just change the code to meet you needs.

Have fun.