Skip to content

Instantly share code, notes, and snippets.

@waharnum
Forked from colinbdclark/electric-piano-synth
Last active November 12, 2015 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waharnum/ad6f2afb00519ef976fd to your computer and use it in GitHub Desktop.
Save waharnum/ad6f2afb00519ef976fd to your computer and use it in GitHub Desktop.
Early sketch of electric piano synth for FLOE Chart Authoring sonification tool
fluid.defaults("floe.chartAuthoring.electricPianoBand", {
gradeNames: ["flock.band"],
components: {
midiNoteSynth: {
type: "floe.chartAuthoring.midiNoteSynth"
},
pianoEnvelopeSynth: {
type: "floe.chartAuthoring.pianoEnvelopeSynth"
},
carrierSynth: {
type: "floe.chartAuthoring.carrierSynth"
}
}
});
fluid.defaults("flock.interconnectOutputSynth", {
gradeNames: ["flock.modelSynth"],
outputBus: "@expand:{flock.enviro}.busManager.acquireNextBus(interconnect)",
synthDef: {
ugen: "flock.ugen.out",
bus: "{that}.options.outputBus",
expand: 1,
sources: "{that}.options.ugenDef"
}
});
fluid.defaults("floe.chartAuthoring.midiNoteSynth", {
gradeNames: ["flock.interconnectOutputSynth"],
ugenDef: {
id: "freq",
ugen: "flock.ugen.midiFreq",
rate: "control",
note: {
id: "noteSequencer",
ugen: "flock.ugen.sequencer"
}
},
model: {
noteSequencer: {
durations: [0.375, 0.375, 0.16666667, 0.16666667, 0.16666667],
values: [91, 91, 90, 90, 90, 90]
}
},
addToEnvironment: "head"
});
fluid.defaults("floe.chartAuthoring.carrierSynth", {
gradeNames: ["flock.modelSynth"],
ugenDef: {
ugen: "flock.ugen.sinOsc",
phase: 0.0,
freq: {
ugen: "flock.ugen.in",
bus: "{midiNoteSynth}.options.outputBus"
},
mul: {
ugen: "flock.ugen.in",
bus: "{pianoEnvelopeSynth}.options.outputBus"
}
},
phases: [0.0, 0.5, 0.25],
synthDef: {
ugen: "flock.ugen.sum",
sources: {
expander: {
funcName: "floe.chartAuthoring.carrierSynth.additiveExpander",
args: ["{that}.options.phases", "{that}.options.ugenDef"]
}
}
}
});
floe.chartAuthoring.carrierSynth.additiveExpander = function (phases, ugenDef) {
return fluid.transform(phases, function (phaseValue, i) {
var voiceDef = fluid.copy(ugenDef);
voiceDef.phase = phaseValue;
return voiceDef;
});
};
fluid.defaults("floe.chartAuthoring.pianoEnvelopeSynth", {
gradeNames: ["flock.interconnectOutputSynth"],
ugenDef: {
ugen: "flock.ugen.envGen",
envelope: {
levels: [0, 1, 0],
times: [0.01, 0.1],
curves: ["linear", -5],
sustainPoint: 1
},
gate: {
id: "envelopeSequencer",
ugen: "flock.ugen.sequencer"
},
mul: 0.05
},
model: {
gateSequencer: {
durations: [0.125, 0.25, 0.125, 0.25, 0.04166667, 0.0625, 0.04166667, 0.0625, 0.04166667, 0.0625],
values: [1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0]
}
},
addToEnviroment: "head"
});
floe.chartAuthoring.electricPianoBand();
[
{label: "Label 1",
evelope: {
durations: [],
values: []
},
notes: {
durations: [],
values: []
}
}
]
- invoke text to speech to read Label
- register listener for end of text to speech
- update synth model
- schedule an event 5 seconds from now to read the next Label
---
10,10,10,1,1,1,1,1
#1: durations: 0.375, 0.375, 0.375, 0.16666667, 0.16666667, 0.16666667, 0.16666667, 0.16666667
#2: envelope (on/off pairs)
- duration of sound
10 -> 0.125
pause -> 0.25
- duration of silence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment