aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BowelyzerAnalyzer.sc85
1 files changed, 38 insertions, 47 deletions
diff --git a/BowelyzerAnalyzer.sc b/BowelyzerAnalyzer.sc
index f6dda05..bccc733 100644
--- a/BowelyzerAnalyzer.sc
+++ b/BowelyzerAnalyzer.sc
@@ -1,8 +1,6 @@
BowelyzerAnalyzer{
- var <>config;
var <synths;
- var <controls;
var <analyzerGroup;
var <monitoringGroup;
@@ -13,14 +11,13 @@ BowelyzerAnalyzer{
init{
arg config;
- this.config = config;
synths = Dictionary.new(config.at("names").size);
- controls = Dictionary.new(config.at("names").size);
- config.at("names").do({ |item, i|
- controls.putPairs([item, Dictionary.new(7)]);
- });
this.setupGroups;
- this.addAnalysisSynthsFromConfig(this.config);
+ this.addAnalysisSynthsFromConfig(config);
+ Routine{
+ 2.wait;
+ this.startSynthsFromConfig(config);
+ }.play;
}
// setup a synth group for the analyzers
@@ -35,10 +32,9 @@ BowelyzerAnalyzer{
addAnalysisSynthsFromConfig{
arg config;
config.at("names").size.do({|i|
- var name = config.at("names")[i],
- controls = config.at("controls").at(name);
+ var name = config.at("names")[i];
("Adding SynthDef '"++name++"' on input "++(i+config.at("channelOffset")[i])).postln;
- synths.add(name -> SynthDef(name, {
+ SynthDef(name, {
arg sendReplyFreq,
amplitudeAttackTime,
amplitudeReleaseTime,
@@ -90,50 +86,45 @@ BowelyzerAnalyzer{
'/'++config.at("names")[i].asSymbol,
[amplitude, pitch, hasPitch, detect]
);
- }).play(
- target: analyzerGroup,
- args: //arguments to the Synth. Order matters!
+ }).add;
+ });
+ }
+
+ startSynthsFromConfig{
+ arg config;
+ config.at("names").do({|name, i|
+ var controls = config.at("controls").at(name);
+ postln("Synths: "++name++" at "++i);
+ synths.add(name -> Synth(
+ name,
[
- controls.at("sendReplyFreq"),
- controls.at("amplitudeAttackTime"),
- controls.at("amplitudeReleaseTime"),
- controls.at("hfHainsworth"),
- controls.at("hfFoote"),
- controls.at("hfThreshold"),
- controls.at("hfWaitTime"),
- controls.at("pitchInitFreq"),
- controls.at("pitchMinFreq"),
- controls.at("pitchMaxFreq"),
- controls.at("pitchExecFreq"),
- controls.at("pitchMaxBinsPerOctave"),
- controls.at("pitchMedian"),
- controls.at("pitchAmpThreshold"),
- controls.at("pitchPeakThreshold"),
- controls.at("pitchDownSample")
- ]
- )
+ sendReplyFreq: controls.at("sendReplyFreq"),
+ amplitudeAttackTime: controls.at("amplitudeAttackTime"),
+ amplitudeReleaseTime: controls.at("amplitudeReleaseTime"),
+ hfHainsworth: controls.at("hfhainsworth"),
+ hfFoote: controls.at("hfFoote"),
+ hfThreshold: controls.at("hfThreshold"),
+ hfWaitTime: controls.at("hfWaitTime"),
+ pitchInitFreq: controls.at("pitchInitFreq"),
+ pitchMinFreq: controls.at("pitchMinFreq"),
+ pitchMaxFreq: controls.at("pitchMaxFreq"),
+ pitchExecFreq: controls.at("pitchExecFreq"),
+ pitchMaxBinsPerOctave: controls.at("pitchMaxBinsPerOctave"),
+ pitchMedian: controls.at("pitchMedian"),
+ pitchAmpThreshold: controls.at("pitchAmpThreshold"),
+ pitchPeakThreshold: controls.at("pitchPeakThreshold"),
+ pitchDownSample: controls.at("pitchDownSample")
+ ],
+ analyzerGroup
+ );
);
});
}
- setAnalysisSynthControl{
+ setSynthControl{
arg name, control;
- controls.at(name).put(control[0], control[1]);
synths.at(name).set(control[0], control[1]);
}
-//TODO: get all this from BowelyzerConfig
- getAnalysisSynthControl{
- arg name, control;
- synths.at(name).get(
- control,
- {
- arg value;
- controls.at(name).put(control, value);
- }
- );
- //TODO: wait for the control to be set
- ^controls.at(name.asSymbol).at(control.asSymbol);
- }
startAnalysisSynth{
arg name;