Skip to content

Instantly share code, notes, and snippets.

View Enkerli's full-sized avatar

Alexandre Enkerli Enkerli

View GitHub Profile
@Enkerli
Enkerli / JazzPatt.tsv
Last active December 18, 2023 04:01
Simple Python code to create MIDI files from melodic patterns formatted as arrays of intervals in semitones (from #DigThatLick). Created with the kind help of ChatGPT 4 (because I’m a noncoder and it was a valuable learning exercise).
Pattern ID Instances
[-1, -1, -1, -2, -2, -1] r3prd0u5e1 127
[-1, -1, -1, -1, -1, -2] k68sn02uof 126
[-3, 1, 2, 1, 2, 2] 2bf2a3yced 122
[-2, -1, -2, -2, -2, -1] lv7dtm7aeu 110
[-2, -1, -1, -1, -1, -1] pghi0goc5x 106
[-2, -1, -2, -2, -1, -1] 7b2ryh0s2e 98
[1, 2, 2, 2, 1, 2] yt0htbzb45 95
[2, 1, 2, 2, 2, 1] janxn6gkmj 94
[-1, -2, -2, -2, -1, -2] 6sjw0i0kzw 93
@Enkerli
Enkerli / spi-ctl-bpf.rb
Last active September 15, 2023 02:27
A Sonic Pi script (spi-ctl-bpf.rb) and a Processing one (spi_ctl_bpf.pde) to control a band pass filter using the mouse. Been having performance issues with the sound lagging behind. Setting `set_sched_ahead_time!` in Sonic Pi sounds like it helps, but not enough. Original code from Robin Newman: https://gist.github.com/rbnpi/ca5e80258c0c1296b1c…
set_sched_ahead_time! 0 # Setting that one to a negative value makes Sonic Pi complain, it sounds like.
with_fx :bpf do |s| # Setting up the fx to be controlled internally
synth :square, note: 32,release: 400 # Long release as the control will affect a single note
live_loop :ctl do # The loop is inside the fx as this is where the action will be.
ctl=sync "/ctl" # The OSC message which Processing sends, based on mouse coordinates.
rz=ctl[:args][0] # Assigning the first argument to resonance.
ct=ctl[:args][1] # Assigning the second argument to centre.
control s, res: rz, centre: ct # The actual control of the fx.
set_sched_ahead_time! -2 # Sounds like setting this again every time actually helps.
@Enkerli
Enkerli / tonespace_chords.rb
Created April 23, 2017 06:38
Sonic Pi script to emulate the tonespace MIDI harmonizer from mucoder.
use_real_time # Preventing latency
use_tuning :just, :c # Just Intonation, chords are diatonic in C major
with_fx :compressor, threshold: 0.1 do # Preventing clipping
with_fx :reverb do # Everything on the same reverb
with_fx :lpf, cutoff_slide: 0.02 do |filtre| # Everything on the same breath-controlled filter
baritone = synth :hoover, note: 0, release: 1000, amp: 0 # “Classic early 90’s rave synth”
tenor = synth :chipbass, note: 0, release: 1000, amp: 0 # “A 16 step triangle wave modelled after the 2A03 chip found in voice 3 of the NES games console.”
alto = synth :beep, note: 0, release: 1000, amp: 0 # Sine wave
soprano = synth :chiplead, note: 0, release: 1000, amp: 0 # “A slightly clipped square (pulse) wave with phases of 12.5%, 25% or 50% modelled after the 2A03 chip found in voices 1 and 2 of the NES games console.”
@Enkerli
Enkerli / PlugList.ipynb
Created November 30, 2022 00:13
A Jupyter notebook using pandas to process my list of VST3, VST, and AudioUnit plugins (as produced by Tracktion Waveform). Doing a bit of data cleanup.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Enkerli
Enkerli / spi_examples_29mar16.txt
Last active July 25, 2020 12:18
Scripts d’exemples pour Sonic Pi dans le cadre d’un cours du programme de médias interactifs au Cégep André-Laurendeau, le 29 mars 2016.
# Intro
# https://rbnrpi.wordpress.com/2015/04/06/musical-fireworks-with-sonic-pi-and-minecraft/
# Ex 1: Notes
## # Ex 1a: Play
play 60
## # Ex 1b: Play 2
play 60
play 56
## # Ex 1c: Sleep
@Enkerli
Enkerli / csBreathLead.csd
Created February 19, 2020 03:04
Simple breath-controlled lead with reverb, in Csound through Cabbage Audio
<Cabbage>
form caption("Breath Solo") size(400, 400), colour(58, 110, 182), pluginid("def1")
keyboard bounds(8, 236, 381, 95)
rslider bounds(78, 10, 70, 70), channel("porttime"), range(0, 1, 0.01, 1, 0.01), text("Portamento Time")
rslider bounds(162, 10, 70, 70), channel("cutoff"), range(0, 22000, 21000, 0.5, 0.01), text("Cutoff")
rslider bounds(246, 10, 70, 70), channel("res"), range(0, 1, 0.9, 1, 0.01), text("Resonance")
groupbox bounds(78, 94, 238, 112), text("Reverb")
rslider bounds(94, 124, 68, 70), channel("size"), range(0, 1, 0.9, 1, 0.001), text("Size"), colour(2, 132, 0, 255),
rslider bounds(208, 122, 68, 70), channel("fco"), range(1, 22000, 21000, 1, 0.001), text("Damp"), colour(2, 132, 0, 255),
# Simple Sonic Pi script which randomly picks part of a looping sample to create a groovy rhythm.
# https://soundcloud.com/synthbreath/sonic-pi-random-safari-loop
# Thanks to Sam Aaron for that “pick” trick! https://in-thread.sonic-pi.net/t/find-the-last-onset-within-a-sample/1299/10?u=enkerli
# And thanks to Martin Butz for the actual solution of finding the number of onsets in a sample! Quite elegant.
# https://in-thread.sonic-pi.net/t/find-the-last-onset-within-a-sample/1299/14?u=enkerli
# I also explored loops from sample libraries: https://soundcloud.com/synthbreath/sliced-loops
smp=:loop_safari
maxons=sample_buffer(smp, 0).onset_slices.last[:index]
loop do
@Enkerli
Enkerli / spi_mbe.rb
Created April 21, 2017 17:01
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: https://vimeo.com/214204872
# Thirty years ago, Robby Kilgore invented a neat harmonization effect for Michael Brecker: http://robbykilgore.com/?p=19
# 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.
@Enkerli
Enkerli / tshallendj_louptah.rb
Last active December 17, 2017 04:36
Work-in-progress: partial response to a Sonic Pi challenge about using a single sample. Not quite a full piece, yet. Haven’t really been working through “song structure”, since getting into digital musicking. But it’s still a fun little experiment. https://in-thread.sonic-pi.net/t/challenge-make-a-track-with-only-one-sonic-pi-sample/525/3
ting=[4,12,13,18,26,34,43,44,49,57].ring
doum=[6,10,20,24,41,55].ring
claps=[8,19,23,28,29,39,48,50,60].ring
snay=[33,22,8].ring
tomtom=[2,17,32].ring
tock=[3,9,40,51,53,54,59].ring
dwi=[7,21,56,5,38].ring
dwo=[11,47,25,52,27,42].ring
dub=[14,31,58,5,46,35].ring
tonton=[0,1,45,30].ring
@Enkerli
Enkerli / counter_ringy_bendy.rb
Last active May 8, 2017 00:32
Getting a few things together, in Sonic Pi. Pulse width and ring modulation driven by breath. Lip pressure (sent through MIDI as pitch bend) modulates the ring modulation mix. Incoming notes for the melody (with TB-303 type synth), counter motion for the counter melody (in FM synth).
use_real_time # Preventing latency
use_tuning :just, :c # Just Intonation
delta=counter=naute=idx=0 # Initialize a few things
previous=60 # First note for the counter melody
gamme=(scale 50, :hex_dorian, num_octaves: 5) # Setting a “ring” of values in which to find incoming notes
counter_gamme=(scale 38, :hex_dorian, num_octaves: 2) # Same for the countermelody, an octave below
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