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
3 Likes

A very good example and solution. Thanks for sharing

1 Like

Seems like I’m late to the party :sweat_smile:

I also experimented a bit with a basic USB MIDI keyboard like this one.
keywood-nomad-49

I mapped the 4 top left knobs on the ADSR synth envelope parameters, the slider thing on the volume, and I used the two roll knobs on the bottom for modulation synth phase and range control.

What I didn’t manage to do properly though is to use the keyboard as an organ, like play a note on keydown and stop playing on keyup. I suspect I could do this with play / control commands but I haven’t figured it out yet.

1 Like

hi @TotoLeTroll

bienvenue !

It’s never too late to do well ! So thanks for sharing this piece of code !

ps : j’habite en France itou mais à l’opposé près de Cherbourg :slight_smile:

1 Like