Skip to content

Instantly share code, notes, and snippets.

View RemyPorter's full-sized avatar

Remy Porter RemyPorter

View GitHub Profile
@RemyPorter
RemyPorter / FluidCells.pde
Last active April 1, 2020 21:28
A fluid-dynamics/cellular automata mashup for Processing. Click to drop a "leader" cell and watch what happens.
//CELL TYPES
final int EMPTY = 0;
final int LEADING = 1;
final int TRAILING = 2;
final int LINGER = 10;
final int REFLECTED = 3;
final int REFLECT_FADE = 4;
final int REFLECT_STOP = 5;
final int REFLECTOR = 6;
final int SOURCE = 7;
@RemyPorter
RemyPorter / intrion.rb
Created November 6, 2019 21:06
The code for intrion. This was edited and modified live/improvisationally, so this is not what it started as, but it is what it ended as
use_bpm 90
prog = (ring
(chord :c3, :m11),
(chord :f3, :M7),
(chord :d3, :m6),
(chord :eb3, :M))
live_loop :bline do
use_synth :mod_sine
use_synth_defaults attack: 0.24, amp: 0.2, mod_wave: 2, mod_phase: 1, mod_range: 5
float normGauss() {
return norm(randomGaussian(), -1, 1.);
}
class Particle {
PVector position;
PVector velocity;
Particle() {
position = new PVector(normGauss(), normGauss(), normGauss());
velocity = PVector.random2D();
}
@RemyPorter
RemyPorter / style.css
Created August 23, 2019 19:14
A stylesheet for tweaking Jupyter Notebooks for presentation
.unselected, .output_stderr {
display: none !important;
}
* {
font-size: large !important;
}
@RemyPorter
RemyPorter / MarkovGlyphs.pde
Last active May 29, 2021 16:33
A Markov Chain-based glyph generator
/**
A markov-chain based glyph generator. Given sequences of points as a corpus, this will create a markov chain based on those points.
Then, by sampling the chain, we can generate entirely new glyphs that weren't in our original dataset.
Press "r" to generate a new frame. Press "s" to save the frame to a file (with a random UUID as its name).
Requires the PostFx library: https://github.com/cansik/processing-postfx/
*/
import java.util.*;
@RemyPorter
RemyPorter / broken.py
Created April 4, 2019 21:16
Stupid Decorator Tricks
class Foo(object):
def __init__(self):
self.value = 5
def wrap(param):
def _wrap(clss):
class _Wrap(clss):
def __init__(self):
super(_Wrap, self).__init__()
self.other_value = param
@RemyPorter
RemyPorter / sample.py
Last active January 4, 2023 18:25
This is a simple synthesizer based on NumPy, which allows you to create surprisingly complex sounds with surprisingly simple code. Uses the Python library `sounddevice` for playback, so you'll need to `pip install sounddevice`
import time
import spatial as sp
import sounddevice as sd
def play(sound, sample_rate=sp.SAMPLE_RATE):
"""Helper to play serially"""
sd.play(sound)
time.sleep(len(sound) / sample_rate)
space = sp.space(3)
use_synth :dpulse
use_synth_defaults pulse_width: 0.0001, pulse_width_slide: 0.25, detune_slide: 0.25
use_bpm 20
uncomment do
live_loop :crankcase do
sync :burp
with_fx :gverb, room: 10 do
#g = play (scale :G0, :blues_minor).shuffle.tick, attack: 0.7, sustain: 0.75, release: 0.4, amp: 0.25
4.times do
s0 = (scale :C, :chromatic, num_octaves: 3).shuffle
s1 = s0.rotate(2)
s2 = s1.rotate(3)
amps = (line 0, 1, steps: 64)
use_synth :piano
use_synth_defaults stereo_width: 0.2
with_fx :bpf, centre: :C+6, res: 0.5 do
with_fx :bitcrusher, bits: 16, sample_rate: 5000 do
@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();