# Change parameters of a synth with MIDI CC from controller

**URL:** <https://in-thread.sonic-pi.net/t/change-parameters-of-a-synth-with-midi-cc-from-controller/8179>\
**Category:** Support, Help & Resources\
**Created:** [September 23, 2023, 7:19pm UTC](https://in-thread.sonic-pi.net/t/change-parameters-of-a-synth-with-midi-cc-from-controller/8179 "2023-09-23T19:19:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [September 23, 2023, 8:26pm UTC](https://in-thread.sonic-pi.net/t/change-parameters-of-a-synth-with-midi-cc-from-controller/8179/2 "2023-09-23T20:26:00Z")

</div>

This seem’s to work OK.  
I’ve modified it so I could use my keyboard “knobs” to provide the cc input,  
I used 20 and 72 instead of your 0 cc  
You can control them togehter on the same midi\_cc (eg your 0) which gives an interesting result.

```ruby
# Example to send to forum

#Midi CC in
#cc_in = "/midi:arduino_leonardo_*:1/control_change"
cc_in = "/midi*/control_change" #so that it would respond to my keyboard

with_fx :reverb, room: 0.5, mix: 0 do |fx|
  
  live_loop :midiccin do
    use_real_time
    n,v=sync cc_in
    if n== 72 #I used 72, but could be 0 for your midi input
      control fx, mix: v/127.00
    end
  end
  
  #Simple beat
  live_loop :beat do
    tick
    sample :bd_ada, amp: 1 if bools(1,0,0,0, 1,1,0,0).look
    sample :sn_dolf, amp: 1 if bools(0,0,1,0, 0,0,0,1).look
    sleep 0.25
  end
  set :startCO,80 #used from when program runs until cc changes it
  
  live_loop :contCutoff do
    use_real_time
    n,v = sync "/midi*/control_change"
    if n==20 #I used cc 20 from my keyboard controller
      co=10+100*v/127.0
      set :startCO,co
      control get(:s),cutoff: co
    end
  end
  
  
  
  #bassline
  live_loop :bass do
    s = synth :bass_foundation, note: 40, sustain: 2, release: 0, cutoff: get(:startCO)
    set :s,s
    sleep 1
    control s, note: 28
    sleep 0.2
    control s, note: 31
    sleep 0.8
  end
  
end

```

---

_[View the full topic](https://in-thread.sonic-pi.net/t/change-parameters-of-a-synth-with-midi-cc-from-controller/8179)._
