New topic suggestion "controllers mapping"

I want to suggest a new topic, “controllers mapping”
I think controllers mapping section is a must in any music related software.

This topic will have a pre-coded mapping for controllers and the user can use what he needs from the controller for example:

User search for his controller
----------------V----------------
User copy text from the post (maybe a git section)
----------------V----------------
User paste the text in Sonic-Pi
----------------V----------------
User setting the midi controller address in the right variable
----------------V----------------
User implementing “KNOB_1” in his code for controlling stuff.

on those days I’m learning how to setup my arturia beatstep in sonic pi, got to the point where one knob controlling filter cutoff of a synth, while the pads are plaing notes (:
later on we can write programs inside SP for controllers, I imagine a Synthesizer “ruby text file” that turn my controller to a synth…

You mean a new topic on this forum? This is the kind of general purpose code I use, which picks up the 8 knobs on the Akai MPK Mini I’m using. The default for this keyboard is CC 13…20. The function :cc() makes them available, in the following example.

Myself, I’ve generally moved away from mapping midi controllers to things, having been around the houses with it. I’ve more embraced editing the code live - just a cultural thing really.

live_loop :midiccin do
  use_real_time
  n,v=sync "/midi:mpk_mini_midi_1:1:1/control_change"
  set "cc_"+n.to_s,v
end

define :cc do |n,min,max,default|
  v=get["cc_"+n.to_s]
  if v==nil
    x=default
  else
    x=min+(v/128.0)*(max-min)
  end
  puts n.to_s + "," + x.to_s
  x
end

I’m using them in this loop to control three FX, but they could be used for anything.

live_loop :arp0 do
  use_synth :piano
  notes = scale :C4, :chromatic, num_octaves: 1
  with_fx :reverb, mix: cc(19,0.0,1.0,0.0) do
    with_fx :echo, mix: cc(18,0.0,1.0,0.0) do
      with_fx :nbpf, centre: cc(17,30,100,80), amp: 0.2 do
        6.times do
          play notes.tick
          sleep 0.2
        end
      end
    end
  end
end
2 Likes

A very good example and solution. Thanks for sharing

1 Like