This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// each channel has its own trigger stream | |
// which is a slow Impulse and a faster CombN | |
// delay threshold is a regular trigger for an envelope | |
// the source is controlled by a Select (many:1) | |
// binary math takes triggers on several control channels | |
// and outputs the index of which channel was last triggered | |
(Ndef(\spaghettiArp, {|root=45, triggerThreshold=0.08, brightness=1.5, atk=0, dec=2.5| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- an imaginary verbose REPL | |
-- ------------------ | |
-- inspired by the ii help in crow/druid | |
-- most examples based on https://gist.github.com/trentgill/84ec5b68816eb03508566addb5a41dd4 | |
s = sequins | |
-- comments below are hypothetical log output (via e.g. print() or a REPL) | |
cs = s"abcd" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- LCG based on https://github.com/monome/dsp-kit/blob/main/noise/lcg.c by @catfact | |
-- due to differences in data types, the behavior is not the same. | |
-- int32_t values were truncated to avoid Lua converting them to inf or -inf. | |
output[1].action = loop { | |
to( | |
dyn{x=1} | |
:mul(dyn{a=-559}) | |
:step(dyn{c=21032}) | |
:wrap(-32768, 32767) | |
/ 32768 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JUNK | |
s.quit; | |
s.boot; | |
(~stopwatch = Routine { var ct = 0; | |
loop { ct.postln; 1.wait; ct = ct + 1 } | |
}.play;) | |
~stopwatch.stop; | |
Ndef.clear | |
s.options.recHeaderFormat = 'wav' | |
s.prepareForRecord |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// your keycodes may vary | |
~ctrl = 105; | |
// recording params - 12 sec for no particular reason | |
~bufferSeconds = 12; | |
// do this first and then wait | |
~buf = Buffer.alloc(s, s.sampleRate * ~bufferSeconds, 2); | |
(Ndef(\seekWt, { |offset=0,freq=55, gain=1, seekLag=5, curve=0, probability = 1, rate=1| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////// sunset 2020 | |
(Ndef(\reverb, {|wet=0.85, dry=0.15, size=10| | |
var input = \in.ar([0, 0]); | |
var primes = (2..13).nthPrime; | |
var reverb = Mix.ar(primes.collect({|i| | |
var delay = SinOsc.ar(0.02.rrand(0.1), 0, 0.02.rand, i/100); | |
AllpassL.ar(input, 1/2, delay, size, 1/primes.size) | |
})); | |
(wet*(reverb + input)) + (dry*input); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on @okyeron's hid_demo/hid-events.lua | |
-- check MIDI Devices list printed below to REPL for which port to choose | |
-- change these to suit your needs | |
local midi_port_id = 1 -- especially this one | |
local midi_channel = 1 -- and probably this one | |
local midi_velocity = 100 | |
function init() | |
-- print some device data to REPL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
const props = ['a', 'b', 'c']; | |
// Manufacture | |
const makeObj = (name) => { | |
const obj = {}; | |
props.forEach(prop => | |
Object.defineProperty(obj, prop, { | |
get: () => `this is ${name}'s ${prop}` | |
})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)(); | |
const sr = audioCtx.sampleRate; | |
const hzInc = 1 / sr; | |
const noteToHz = (midiNote) => Math.pow(2, midiNote/12) * 8.17570643783345; | |
class Accumulator { | |
constructor() { | |
this.oscs = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const partial = (f) => | |
(...args) => | |
(args.length >= f.length) | |
? f(...args) | |
: partial(f).bind(this, ...args) |
NewerOlder