Last active
November 15, 2019 01:54
-
-
Save goldengrape/d0615d8698dfec7711731a9ea86296bb to your computer and use it in GitHub Desktop.
artiphon instrument1 remap key to chord by sonic-pi
This file contains 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
artiphon_address= "/midi/instrument1/*/*/" | |
artiphon_synth= :dsaw | |
remap_hash={40 => (ring 40,45,50,55,59,64),\ | |
41 => chord(:d4,:major),\ | |
42 => chord(:e4,:major),\ | |
43 => chord(:f4,:major),\ | |
44 => chord(:g4,:major) | |
} | |
# if you want to remap keys to chords | |
# turn remap to true | |
remap=true | |
define :artiphon do |synth_name, event_address| | |
use_real_time | |
note, velocity = sync event_address+"note_on" | |
# remap the key | |
note=remap_hash[note] if remap_hash.keys.include?(note) if remap | |
# synth the audio | |
synth synth_name, \ | |
note: note, \ | |
release: 1.5,\ | |
amp: velocity/127.0 | |
end | |
with_fx :reverb do | |
live_loop :midi_play do | |
artiphon artiphon_synth,artiphon_address | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment