Salutations! (A Journey into Sonic Pi and MIDI)

Hi @M_Rollers - welcome!

I agree that less typing is good - especially in live situations. And functions are indeed super powerful. One thing that they’re great for is reducing repetition. And since functions can call other functions, one suggestion I might have is to create a separate :brute function that handles all of the values that are the same, and accepts the midi note as a parameter.

Maybe something like this:

define :brute do |midi_note|
  midi_note_on midi_note, release: 1, channel:10, port:"akai_eie_pro_midi"
end

define :dbk1 do brute 36 end
define :dbk2 do brute 37 end
define :dbsn do brute 38 end
# etc...

This way, if you ever want to change the release, channel, or port, you just have to do it in one place. Less typing! :smiley:

I hope that answers your question, and if not, please let us know. Have fun, and please post some recordings of what you’re up to!

1 Like