Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Created July 8, 2020 23:13
Show Gist options
  • Save manualbashing/86b86aa583fad270f202040b25f2ccaa to your computer and use it in GitHub Desktop.
Save manualbashing/86b86aa583fad270f202040b25f2ccaa to your computer and use it in GitHub Desktop.
Explore available samples and synths using your midi controller #SonicPi
explore = "synths"
available_keys = 108
set_sched_ahead_time! -0.4
shift = 0
live_loop :midi_player do
note, amp = sync "/midi:digital_piano:0:1/note_on"
if amp != 0 # ignore key released events
if note == 108 # next page
shift = shift + 106
synth :beep, note: 88
elsif note == 107 # prev page
shift = shift - 106
synth :beep, note: 68
else
if explore == "samples"
sample all_sample_names[note + shift]
elsif explore == "synths"
synth synth_names[note + shift], note: 60
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment