Skip to content

Instantly share code, notes, and snippets.

Created April 21, 2017 17:01
What would you like to do?
Sonic Pi script to create four-part harmony from incoming notes using the “rotating chords” effect pioneered by Robby Kilgore in his work with Michael Brecker. Video here:
# Thirty years ago, Robby Kilgore invented a neat harmonization effect for Michael Brecker:
# The basic idea is that incoming notes are doubled by rotating intervals. So you get diverse chords from the same melodic notes.
# This script is an attempt to reproduce the same effect.
use_real_time # Prevents latency
use_synth :fm # Other interesting synth sounds for this: [:hoover, :prophet, :blade, :fm]
middle=[-8, -5, -7, -1].ring # Rotating intervals for the middle note of each chord.
low=[-12, -17, 0].ring # Rotating intervals for the “bass” note of each chord.
# Set up the different voices, as silent and long…
melody = play 0, release: 1000, amp: 0, cutoff_slide: 0.02
fifth = play 0, release: 1000, amp: 0, cutoff_slide: 0.02
middle_voice = play 0, release: 1000, amp: 0, cutoff_slide: 0.02
low_voice = play 0, release: 1000, amp: 0, cutoff_slide: 0.02
live_loop :notes do
note_on, velocity = sync "/midi/USB_Midi_Cable/4/1/note_on" # Get incoming notes from a MIDI device.
if velocity > 0 # Only act on actual note_on messages.
control melody, note: note_on, amp: velocity / 127.0
control fifth, note: note_on + 7, amp: velocity / 150.0
control middle_voice, note: note_on + middle.tick, amp: velocity / 180.0
control low_voice, note: note_on + low.look, amp: velocity / 127.0
live_loop :windy do # Use breath control (CC 2) to modulate filter cutoff.
control_change, breath = sync "/midi/USB_Midi_Cable/4/1/control_change"
if control_change==2
control melody, cutoff: breath
control fifth, cutoff: breath
control middle_voice, cutoff: breath
control low_voice, cutoff: breath
Copy link

samaaron commented Apr 21, 2017

You could make this a little succinct by changing line 19 to:

on velocity do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment