Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save colinbdclark/7dcd5fd6ba5470fa72b0 to your computer and use it in GitHub Desktop.
Save colinbdclark/7dcd5fd6ba5470fa72b0 to your computer and use it in GitHub Desktop.
Minimal declarative MIDI example
window.midiBand = flock.band({
components: {
synth: {
type: "flock.synth",
options: {
synthDef: {
id: "carrier",
ugen: "flock.ugen.sinOsc",
freq: 440,
mul: {
id: "mod",
ugen: "flock.ugen.sinOsc",
freq: 1.0,
mul: 0.25
}
}
}
},
midiConnection: {
type: "flock.midi.connection",
options: {
openImmediately: true,
ports: {
input: {
name: "slider/knob"
}
},
listeners: {
control: {
func: "{synth}.set",
args: {
"carrier.freq": "@expand:flock.midiFreq({arguments}.0.value)"
}
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment