Choose MIDI Chord

After some research

Sonic Pi does not support chords to be played via midi natively. But we can create a function to achieve that.

@robin.newman proposed a solution in 2017 https://github.com/samaaron/sonic-pi/issues/1691

so you can do that

 use_midi_defaults port: "midi_through_port-0", channel: 1


define :midi_chord do |notes, *args|
  notes.each do |note|
    midi note, *args
  end
end

live_loop :play_chords_via_midi do
  midi_chord chords.choose, release: 0.6
  sleep 0.5
end

If you are on windows, you have to create a midi loop via https://www.tobias-erichsen.de/software/loopmidi.html

au plaisir !