aboutsummaryrefslogtreecommitdiffstats
path: root/BowelyzerAnalyzer.sc
diff options
context:
space:
mode:
Diffstat (limited to 'BowelyzerAnalyzer.sc')
-rw-r--r--BowelyzerAnalyzer.sc52
1 files changed, 25 insertions, 27 deletions
diff --git a/BowelyzerAnalyzer.sc b/BowelyzerAnalyzer.sc
index 928bef2..f50f89d 100644
--- a/BowelyzerAnalyzer.sc
+++ b/BowelyzerAnalyzer.sc
@@ -11,9 +11,9 @@ BowelyzerAnalyzer{
init{
arg config;
- synths = Dictionary.new(config.at("names").size);
+ synths = Dictionary.new(config.at(\inputs).size);
this.setupGroups;
- this.addAnalysisSynthsFromConfig(config);
+ this.addSynthsFromConfig(config);
Routine{
1.wait;
this.startSynthsFromConfig(config);
@@ -29,11 +29,10 @@ BowelyzerAnalyzer{
}
// add synths for the defined channels
- addAnalysisSynthsFromConfig{
+ addSynthsFromConfig{
arg config;
- config.at("names").size.do({|i|
- var name = config.at("names")[i];
- ("Adding SynthDef '"++name++"' on input "++i).postln;
+ config.at(\inputs).keysValuesDo({|name, inputChannel|
+ ("Adding SynthDef \""++name++"\" on input "++inputChannel).postln;
SynthDef(name, {
arg sendReplyFreq,
amplitudeAttackTime,
@@ -54,7 +53,7 @@ BowelyzerAnalyzer{
;
var amplitude, input, detect, pitch, hasPitch;
//TODO: Add volume for SoundIn
- input = SoundIn.ar(bus: i);
+ input = SoundIn.ar(bus: inputChannel);
amplitude = Amplitude.kr(
in: input,
attackTime: amplitudeAttackTime,
@@ -83,7 +82,7 @@ BowelyzerAnalyzer{
);
SendReply.kr(
Impulse.kr(sendReplyFreq),
- '/'++config.at("names")[i].asSymbol,
+ "/"++name,
[amplitude, pitch, hasPitch, detect]
);
}).add;
@@ -92,28 +91,27 @@ BowelyzerAnalyzer{
startSynthsFromConfig{
arg config;
- config.at("names").do({|name, i|
- var controls = config.at("controls").at(name);
- postln("Synths: "++name++" at "++i);
+ config.at(\controls).keysValuesDo({|name, controls|
+ postln("Starting synth \""++name++"\".");
synths.add(name -> Synth(
name,
[
- 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")
+ 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
);