Skip to content

Instantly share code, notes, and snippets.

View colinbdclark's full-sized avatar

Colin Clark colinbdclark

  • Institute for Research and Development on Inclusion and Society
  • Toronto, Ontario
View GitHub Profile
@colinbdclark
colinbdclark / gist:9179042
Last active August 29, 2015 13:56
Wiring Flocking up to Web Audio nodes
flock.init();
var as = flock.enviro.shared.audioStrategy;
// Create the new gain node and set some parameters on it.
var gainNode = as.context.createGain();
gainNode.gain.setValueAtTime(0.0, as.context.currentTime);
as.insertOutputNode(gainNode);
@colinbdclark
colinbdclark / cat.json
Last active August 29, 2015 14:01
A cat is a cat is a...
{
"you are": "a catttt!"
}
@colinbdclark
colinbdclark / flocking-midi-demo.js
Last active August 29, 2015 14:02
Flocking MIDI example
flock.midiAmp = function (velocity) {
return velocity / 127;
};
flock.midiVibrato = function (value) {
return value / 32;
};
var synth = flock.synth({
synthDef: {
@colinbdclark
colinbdclark / declarative-flocking-midi.js
Last active August 29, 2015 14:02
Infusion-style Flocking MIDI example
flock.midiAmp = function (velocity) {
return velocity / 127;
};
flock.midiVibrato = function (value) {
return value / 32;
};
flock.band({
components: {
@colinbdclark
colinbdclark / minimal-declarative-flocking-midi.js
Created June 14, 2014 01:55
Minimal declarative MIDI example
window.midiBand = flock.band({
components: {
synth: {
type: "flock.synth",
options: {
synthDef: {
id: "carrier",
ugen: "flock.ugen.sinOsc",
freq: 440,
mul: {
@colinbdclark
colinbdclark / mapping-midi-to-synth.js
Created June 14, 2014 11:19
Simple example of custom mapping of MIDI controls to a Flocking synth
// Create a new synth consisting of a sine wave,
// modulating its amplitude slowly with another sine wave.
var synth = flock.synth({
synthDef: {
id: "carrier",
ugen: "flock.ugen.sinOsc",
freq: 440,
mul: {
id: "mod",
ugen: "flock.ugen.sinOsc",
@colinbdclark
colinbdclark / fleischmidi.js
Last active August 29, 2015 14:05
MIDI Fleischstrument (stereo)
fluid.defaults("flock.midi.controller", {
gradeNames: ["fluid.eventedComponent", "autoInit"],
members: {
controlMap: "@expand:flock.midi.controller.optimizeControlMap({that}.options.controlMap)"
},
controlMap: {}, // Needs to be specified by the user.
components: {
@colinbdclark
colinbdclark / msgTrigger.js
Created November 14, 2014 20:30
Message-based trigger sketch.
// Represents a trigger from some external (i.e. non-ugen graph) source.
// Whenever it receives a change to its "msg" input, this trigger will fire.
flock.ugen.msgTrigger = function (inputs, output, options) {
var that = flock.ugen(inputs, output, options);
// Only runs at control rate or lower.
that.gen = function (numSamps) {
var m = that.model,
inputs = that.inputs,
out = that.output;
@colinbdclark
colinbdclark / writeBuffer.js
Created November 14, 2014 20:35
Sketch of a writeBuffer unit generator for Flocking
flock.ugen.writeBuffer = function (inputs, output, options) {
var that = flock.ugen(inputs, output, options);
that.gen = function (numSamps) {
var m = that.model,
out = that.output,
inputs = that.inputs,
sources = that.multiInputs.sources,
bufferDesc = that.bufferDesc,
numInputChans = sources.length,
@colinbdclark
colinbdclark / wobbling-sines.js
Last active August 29, 2015 14:10
Wobbling Sines
var synth = flock.synth({
synthDef: [
{
ugen: "flock.ugen.sinOsc",
freq: {
ugen: "flock.ugen.xLine",
start: 60,
end: 90,
duration: 120
},