Skip to content

Instantly share code, notes, and snippets.

View RemyPorter's full-sized avatar

Remy Porter RemyPorter

View GitHub Profile

Keybase proof

I hereby claim:

  • I am remyporter on github.
  • I am remyporter (https://keybase.io/remyporter) on keybase.
  • I have a public key whose fingerprint is D840 B879 0B81 8F62 5F75 5BF9 E7DF E43C 3AB9 6896

To claim this, I am signing this object:

@RemyPorter
RemyPorter / events.py
Created November 26, 2014 16:51
An example of implementing the observer pattern using decorators. I'm sure there's a secret crime in implementing GOF patterns this way.
"""The observer pattern, implemented as decorators,
to simplify event-binding. Usage:
EventSender("foo")
class FooSender:
def some_method(self):
self.send_foo_event(details)
EventReceiver("foo","foo_handler")
@RemyPorter
RemyPorter / Synethiser.pde
Created April 26, 2015 21:55
Synethiser: a visualizing synthesizer for Leap Motion
/**
* This sketch does a number of things.
* First, it uses OSC Motion and a LeapMotion controller to drive
* Finger tracking. Each Finger is associated with an AMSynth implemented
* in Minim. The X/Y/Z coordinates of the fingers are mapped to frequencies
* and amplitudes of the oscilators.
*
* Finally, there's a running video capture that feeds into a pointillist filter.
* Each finger drives this, dropping points. If the finger is "cold" (not in Leap's view),
* then it grabs random pixels from the video and draws an ellipse in that color, centered on
@RemyPorter
RemyPorter / conductor.ck
Created June 6, 2015 22:15
Simple, event-driven conductor for ChucK
public class Conductor {
float interval;
int divs;
int divsPerM;
fun void setTiming(float bpm, int subdivs, int measure) {
bpm / subdivs / 60 => interval;
subdivs => divs;
subdivs * measure => divsPerM;
}
@RemyPorter
RemyPorter / beatdetection.ck
Created June 8, 2015 00:33
First stab at beat detection
32 => int bands;
6 => int threshold;
2048 => int size;
20 => int low;
10000 => int high;
(high - low) / bands => float step;
BPF banded[bands];
FFT ffts[bands];
@RemyPorter
RemyPorter / functions.pyde
Created July 6, 2016 22:13
A Processing Sketch that procedurally generates a variety of kinds of images, the ones that interest me are the ones that look like weird undersea critters (http://imgur.com/a/aIS0W)
import uuid
a = randomGaussian() * HALF_PI
b = randomGaussian() * HALF_PI
c = randomGaussian() * HALF_PI
d = randomGaussian() * HALF_PI
e = randomGaussian() * HALF_PI
f = randomGaussian() * HALF_PI
scaleFactor = 200
#A Fizzbuzz implementation for SonicPi
use_bpm 120
live_loop :fizzbuzz do
fb = tick :fb
if fb % 3 == 0
sample :bd_klub
end
if fb % 5 == 0
sample :sn_zome
end
@RemyPorter
RemyPorter / random.rb
Created April 17, 2017 17:05
A SonicPi script that uses true random data
numbers =[14,103,81,12,22,65,90,35,46,10,98,95,116,102,8,56,95,110,15,118,104,99,15,96,107,51,66,92,43,16,74,8,123,68,103,79,123,24,97,11,82,100,97,94,88,31,91,12,92,4,63,39,48,22,52,128,4,10,31,65,31,126,42,21,45,8,95,39,42,100,75,87,25,56,110,91,122,28,96,83,42,42,94,27,58,74,15,79,36,49,30,18,68,80,107,81,106,52,51,56,49,112,123,30,99,125,24,40,60,127,113,99,44,20,30,93,10,82,93,40,38,18,91,78,46,33,21,4,100,14,99,120,104,76,82,109,72,117,31,68,41,91,128,31,82,50,125,1,74,91,36,50,67,98,46,1,67,103,58,118,93,59,13,1,100,90,96,75,26,78,75,16,80,18,25,4,77,8,122,58,84,6,66,97,43,21,60,106,48,49,78,120,110,84,125,70,112,84,55,1,127,94,110,56,121,117,31,61,21,95,92,53,64,100,62,88,60,63,40,16,27,121,103,85,43,59,55,50,69,36,56,75,119,33,121,73,92,123,72,3,51,119,109,67,6,105,4,19,76,46,10,11,29,66,31,67]
def make_phrase(name, data, &block)
slice = data
beats = slice.shift
per = slice.shift
if per < beats
per += beats
end
minmax = [slice.shift, slice.shift]
s = (scale :C, :chromatic)
a = (line 0, 1, steps: 18)
r = (ring 1/4.0, 1/2.9, 1/3.0).stretch(36)
density = (ring 6, 6, 8, 12, 6, 4, 3, 2)
point = 6
apoint = 9
rpoint = 18
with_fx :reverb, room: 0.8 do
with_fx :band_eq do |be|
@RemyPorter
RemyPorter / Rings.pde
Created May 31, 2017 23:50
Code for a composition, a Processing Sketch and a Sonic-Pi composition
PVector center;
float ratio = 1.0;
float baseRotate = -0.0001;
void setup() {
fullScreen(P3D);
frameRate(60);
center = new PVector(width/2, height/2);
ellipseMode(CENTER);
noFill();