Skip to content

Instantly share code, notes, and snippets.

View Enkerli's full-sized avatar

Alexandre Enkerli Enkerli

View GitHub Profile
@Enkerli
Enkerli / spi_ctl_mc.txt
Created January 22, 2016 00:08
Controlling #SonicPi from Minecraft
use_synth :pretty_bell
loop do
x=mc_get_pos[0]
y=mc_get_pos[1]
z=mc_get_pos[2]
play [x, y+30, z]
sleep 2
end
@Enkerli
Enkerli / spi_just_chords.txt
Created February 14, 2016 05:52
Sonic Pi Just Chords: Chords in just tuning playing randomly through #SonicPi
use_tuning :just, :g3
loop do
play chord_degree(rrand(1,7), :g3, :major, 4)
sleep rrand(0.2, 1.3)
end
@Enkerli
Enkerli / spi_just_chords_inversions.txt
Created February 14, 2016 06:16
Sonic Pi Just Chords with Inversions: randomly playing inversions of four-note chords from a minor scale in just tuning
use_tuning :just, :g3
loop do
play chord_degree(dice(7), :g3, :minor, 4, invert: rrand_i(-3,3))
sleep 0.4
end
@Enkerli
Enkerli / spi_crib_mobile.txt
Created February 14, 2016 06:30
Sonic Pi Crib Mobile: sounds somewhat like a sound mobile suspended over a baby's crib
use_synth :tri
use_tuning :just, :g3
loop do
play scale(:g3, :major_pentatonic, num_octaves: 2).choose, amp: one_in(7)
sleep 0.1
end
// Title: Industriver
// Author: Alex Enkerli
// Date: 27 February 2016
// Course: Introduction to Programming for Musicians and Digital Artists
// Assignment for Session 3 – Sound File Manipulation
// Requires the audio samples from this link to be in the same directory: http://lar.me/30y
Gain master=>NRev r=>dac; // Adding reverb to master gain
.1=>r.mix; // Mixing the reverb with the master
SndBuf2 fx => master; // Sending stereo fx samples to master
// Title: FunctDustRiver
// Learning Author: Alex Enkerli
// Date: 27 February 2016
// Course: Introduction to Programming for Musicians and Digital Artists
// Assignment for Session 3 – Sound File Manipulation
// Requires the audio samples from this link to be in the same directory: http://lar.me/30y
Gain master=>NRev r=>dac; // Adding reverb to master gain
.1=>r.mix; // Mixing the reverb with the master
SndBuf2 fx => master; // Sending stereo fx samples to master
@Enkerli
Enkerli / chuck_touchosc_accelerometer.ck
Created March 6, 2016 18:58
A quick ChucK script to accept accelerometer coordinates from the iOS app TouchOSC and use those coordinates to control a sound. TouchOSC needs to be set up properly.
/*
A quick ChucK script to accept accelerometer coordinates from the iOS app TouchOSC and use those coordinates to control a sound.
TouchOSC needs to be set up properly, in its preferences (from any layout, those can be accessed through a button at the top-right corner).
The app needs to be running on the same (WiFi) network as this ChucK script and it needs to be associated with the right host: "OSC" is enabled, "Host" is the IP address or network name of the device where this script is running, the "Port (outgoing)" is set to the proper port.
In the case of a RaspberryPi running an unmodified version of Raspbian, the Host would be "raspberrypi.local". The port used in this script is 6449, an arbitrary number used in the ChucK-based book "Programming for Musicians and Digital Artists" (PMDA) which served as the basis for this script.
TouchOSC needs to be sending accelerometer values, which is in the "OSC" section of "Options": "Accelerometer (/xyz)" should be on (green).
@Enkerli
Enkerli / touchosc_accel.ck
Created March 7, 2016 00:09
Second ChucK script to control an oscillator through an accelerometer via TouchOSC.
/*
A quick ChucK script to accept accelerometer coordinates from the iOS app TouchOSC and use those coordinates to control a sound.
Originally setup the z coordinate to control a filter, before noticing that most ChucK oscillators accept “width” as a parameter. Sending the z coordinate to this parameter instead, simplifying the code from the previous version.
TouchOSC needs to be set up properly, in its preferences (from any layout, those can be accessed through a button at the top-right corner).
The app needs to be running on the same (WiFi) network as this ChucK script and it needs to be associated with the right host:
* "OSC" is enabled
* "Host" is the IP address or hostname of the device where this script is running
* The "Port (outgoing)" is set to the proper port.
@Enkerli
Enkerli / MultiPlu.ck
Created March 12, 2016 16:02
ChucK example: Plucking multiple strings together, based on PMDA example 6.8.
// MultiPlu.ck: Plucking Multiple Strings Together
// Alex Enkerli, March 12, 2016
// Based on PMDA, Listing 6.8: “Better plucked string physical model, excited with noise”
// Kapur, Ajay et al. (2015) “Programming for Musicians and Digital Artists”, Shelter Island: Manning, p. 128
33=>int snum; // number of strings: can’t be zero!
// Array of noise-excited Karplus-Strong plucked strings
Noise pluck[snum] => Delay str[snum] => dac;
// setting base duration for round-trip string delay, 100 Hz At 44.1k SRATE
@Enkerli
Enkerli / clibre2016.html
Created March 15, 2016 21:34
Fichier HTML contenant la présentation d’Alexandre Enkerli au Colloque libre Adte.ca, le 17 mars 2016: «Liberté d'apprendre et logiciels libres»
<!DOCTYPE html>
<html class="sl-root decks export loaded ua-phantomjs reveal-viewport theme-font-montserrat theme-color-white-blue">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Liberté d&#39;apprendre et logiciels libres: Slides</title>
<meta name="description" content="Slides">
<style>@import url("https://s3.amazonaws.com/static.slid.es/fonts/montserrat/montserrat.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/opensans/opensans.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/lato/lato.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/asul/asul.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/josefinsans/josefinsans.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/league/league_gothic.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/merriweathersans/merriweathersans.css");@