Possible to record note from midi keyboard?

I’m enjoying getting into SPi as a live instrument. Ideally I’d like the option of recording notes input from a midi keyboard to store/sequence/arpeggiate in the moment. Is there a pattern to do this?

The obvious thing of reading played notes into an array doesn’t work as those objects are immutable.

Ok, I’ve worked out something that’ll do for now. No arrays, hmmm

Here’s what it sounds like, an 8-note sequencer with changing the notes as you go, and bit of drum to here where we are. If there is a simpler way to do this, please could you share, thanks?

live_loop "midi" do
  use_real_time
  n, v = sync "/midi:arturia_minilab_mkii:0:1/note_on"
  #play n, amp: 0.5, release: 0.5
  idx = get[:currentArpIndex]-1
  if idx<0 then
    idx = 8
  end
  s   = "arp" + idx.to_s
  set s, n
end

live_loop "arp", sync: "/cue/bar" do
  tick_reset
  tick
  8.times do
    set :currentArpIndex, look
    s = "arp" + look.to_s
    n = get[s]
    play n, amp: 0.2
    sleep 0.25
    tick
  end
end

live_loop "drums" do
  sync "/cue/bar"
  in_thread do
    8.times do
      sample :drum_cymbal_closed, amp: 0.2
      sleep 0.5
    end
  end
  in_thread do
    2.times do
      sample :drum_bass_soft, amp: 0.4
      sleep 2
    end
  end
end

live_loop "bar" do
  cue "bar"
  sleep 4
end
1 Like