Created
May 5, 2017 00:43
-
-
Save Enkerli/31b065e0a885a7f61a7c339140247df3 to your computer and use it in GitHub Desktop.
Using lip control (“pitch bend”) to drive ring modulation in Sonic Pi using a WX-11 Wind Controller.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_real_time # Preventing latency | |
use_tuning :just, :c # Just Intonation | |
with_fx :compressor, threshold: 0.2 do # Preventing clipping | |
with_fx :reverb, room: 0.8 do # Everything on the same reverb | |
with_fx :ring_mod, mix_slide: 0.02 do |ringy| # Everything on lip-controlled Ring Mod | |
with_fx :rlpf, res: 0.7, cutoff_slide: 0.02 do |lipf| # Everything on breath-controlled low-pass filter | |
tibi = synth :tb303, note: 0, wave: 1, pulse_width_slide: 0.02, res: 0.7, release: 1000, amp: 0 # TB-303-inspired pulse | |
prof = synth :prophet, note: 0, res: 0.8, release: 1000, amp: 0 # Prophet-like sub | |
live_loop :notes do | |
note_on, velocity = sync "/midi/USB_Midi_Cable/4/1/note_on" # Incoming notes from Yamaha WX-11 wind controller | |
if velocity > 0 # Only use actual note-ons | |
control tibi, note: note_on, amp: velocity / 150.0 # Incoming note | |
control ringy, freq: note_on-20 # Assign a lower frequency to ring mod | |
control prof, note: note_on-12, amp: velocity / 127.0 # Lower octave | |
end | |
end | |
live_loop :windy do # Use the incoming breath control, MIDI CC#2, to modulate the low-pass filter | |
control_change, breath = sync "/midi/USB_Midi_Cable/4/1/control_change" | |
if control_change==2 | |
control lipf, cutoff: breath | |
control tibi, pulse_width: 0.5-(breath/256.0) # Also modulate the pulse width: lower is closer to square wave | |
end | |
end | |
live_loop :bendy do | |
bend_change = sync "/midi/USB_Midi_Cable/4/1/pitch_bend" # The WX-11 sends lip pressure as pitch bend | |
bent=(bend_change[0]-8192)/ 8192.0 # Convert pitch bend to -1.0 to 1.0 | |
control ringy, mix: (bent.abs) # Use the absolute value to modulate the ring mod mix | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment