Skip to content

Instantly share code, notes, and snippets.

View Enkerli's full-sized avatar

Alexandre Enkerli Enkerli

View GitHub Profile
@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");@
@Enkerli
Enkerli / spi_restless_lix.txt
Last active March 19, 2016 19:14
Sonic Pi: having fun with note rings in minor pentatonic, used as licks. The little graphs created by the spark function help understand those licks.
def play_lick(lick,root, scale, time)
spark lick
lick.each{|note| play((degree note, root, scale)) ; sleep time }
end
lix=(ring
[1, 9, 4, 9, 2, 9, 3, 9, 5, 9, 6, 9],
# ▄▁▆▁▅▁▅▁▆▁▇▁
[1, 4, 9, 9, 2, 9, 3, 5, 9, 9, 6, 9],
# ▄▆▁▁▅▁▅▆▁▁▇▁
@Enkerli
Enkerli / spi_lix_explorer.txt
Last active March 20, 2016 16:56
Sonic Pi script to play with licks (short melodies notated in scale degrees). The function to convert degrees to notes is cobbled together from the built-in `resolve_degree` and `resolve_degree_index` methods.
# Sonic Pi script to play with licks (short melodies notated in scale degrees). The function to convert degrees to notes is cobbled together from the built-in `resolve_degree` and `resolve_degree_index` methods.
# Defining two new functions. Once defined, they don’t need to be included in other scripts.
# Lick player
def play_lick(lick, root, scale, time) # A “lick” is a list of scale degree numbers, with a set timing (i.e. “isorhythmic”).
spark lick # Show the lick as a text-based graph
lick.each{|note| play((degree_to_note note, root, scale)) ; sleep time } # Convert each degree number into a note and play it for the set amount of time. This function doesn’t use all the other `play` arguments such as `release:`and `amp:`. Could be useful in a future version, especially for timing.
end
DEGREES = {:i => 0, # Thought these were defined by default. They’re necessary for the degree conversion.
@Enkerli
Enkerli / spi_rranding_ring_chains.rb
Created March 25, 2016 02:00
“Rranding Ring Chains”, coded by Alex Enkerli, March 24, 2016. Playing with ring chains in Sonic Pi, using a previously-built script to play with “licks”. <https://gist.github.com/Enkerli/0687533338c5e40516fc> In several cases, the basic “lick” using degrees 3, 5, 1, and 4 of a given scale makes for intriguing combinations, once shuffled and cut…
# “Rranding Ring Chains”
# Coded by Alex Enkerli, March 24, 2016
# Playing with ring chains in Sonic Pi, using a previously-built script to play with “licks”. https://gist.github.com/Enkerli/0687533338c5e40516fc
# In several cases, the basic “lick” using degrees 3, 5, 1, and 4 of a given scale makes for intriguing combinations, once shuffled and cut apart.
def play_lick(lick, root, scale, time)
spark lick
lick.each{|note| play((degree_to_note note, root, scale)) ; sleep time }
end
@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 / spi_midi_wx11.txt
Last active April 9, 2016 06:46
Quick Sonic Pi script using MIDI in from a WX11 wind controller to control amplitude. Based on Robin Newman’s blogpost: https://rbnrpi.wordpress.com/2016/04/01/a-completely-different-way-to-use-sonic-pi-with-a-midi-controller/
require 'drb/drb'
DRB_URI="drbunix:/var/tmp/sonic-pi-midiconnector"
@midi = DRbObject.new_with_uri(DRB_URI)
use_bpm 240
use_synth :dtri
note_node=play 60, release: 100, attack: 1
live_loop :ctl do
control note_node, amp: @midi.k2/127.0
@Enkerli
Enkerli / pot-tone.html
Created May 7, 2016 22:27
Simple Arduino code: control pitch with a potentiometer. Material required: potentiometer, piezo buzzer, Arduino board, jumper cables.
<pre>
<font color="#00979c">void</font> <font color="#5e6d03">setup</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#000000">{</font>
&nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">begin</font><font color="#000000">(</font><font color="#000000">9600</font><font color="#000000">)</font><font color="#000000">;</font>
<font color="#000000">}</font>
<font color="#00979c">void</font> <font color="#5e6d03">loop</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#000000">{</font>
&nbsp;<font color="#00979c">int</font> <font color="#000000">readTime</font> <font color="#434f54">=</font> <font color="#000000">20</font><font color="#000000">;</font>
&nbsp;&nbsp;&nbsp;<font color="#434f54">// read the input on analog pin 0:</font>
&nbsp;<font color="#00979c">int</font> <font color="#000000">sensorValue</font> <font color="#434f54">=</font> <font color="#d35400">analogRead</font><font color="#000000">(</
@Enkerli
Enkerli / voice-granulator_touchosc_accel.pd
Last active May 16, 2016 02:10
Slight tweak of Voice Granulator by davidjgurney, adding accelerometer control through TouchOSC. http://www.davidjgurney.com/portfolio/wall-e-style-voice-granulator/
#N canvas 431 139 708 570 10;
#N canvas 553 258 450 300 soundload 0;
#X obj 100 157 openpanel;
#X obj 100 100 bng 45 250 50 0 empty empty Load 11 22 0 10 -261682
-33289 -33289;
#X msg 100 182 read -resize \$1 soundfile1;
#X obj 100 209 soundfiler;
#X floatatom 100 233 10 0 0 0 - - -;
#X obj 100 256 s filelength;
#X obj 254 238 samplerate~;
@Enkerli
Enkerli / geyger.py
Created May 21, 2016 01:46
#RasPi script to link a passive buzzer to a distance sensor. The effect is similar to a geiger counter. Based on this code to play melodies on a passive buzzer: http://www.linuxcircle.com/2015/04/12/how-to-play-piezo-buzzer-tunes-on-raspberry-pi-gpio-with-pwm/
import RPi.GPIO as GPIO #import the GPIO library
import time #import the time library
from gpiozero import DistanceSensor
class Buzzer(object):
def __init__(self):
GPIO.setmode(GPIO.BCM)
self.buzzer_pin = 22 #set to GPIO pin 22
GPIO.setup(self.buzzer_pin, GPIO.IN)
GPIO.setup(self.buzzer_pin, GPIO.OUT)
@Enkerli
Enkerli / distance_pulse.py
Created May 21, 2016 03:11
Simple #RasPi script to change a passive buzzer’s frequency based on an ultrasound distance sensor.
from gpiozero import *
from time import sleep
sensor = DistanceSensor(24, 23)
n = 0
bz = PWMOutputDevice(18, initial_value=0.4)
bz.pulse(fade_in_time=0.3)
while True:
print('Distance to nearest object is', sensor.distance, 'm')