aboutsummaryrefslogtreecommitdiffstats
path: root/BowelyzerAnalyzer.sc
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-06-19 19:33:36 +0200
committerDavid Runge <dave@sleepmap.de>2016-06-19 19:33:36 +0200
commit830f1d296e402a89c6146e4183e1a2490ca64406 (patch)
tree56ecef28182f57e5f3971fc06e2f9ab6a46efeb0 /BowelyzerAnalyzer.sc
parent5b3f3167eaf5f4165ba471afc7b3894e1d81ce79 (diff)
downloadbowelyzer-830f1d296e402a89c6146e4183e1a2490ca64406.tar.gz
bowelyzer-830f1d296e402a89c6146e4183e1a2490ca64406.tar.bz2
bowelyzer-830f1d296e402a89c6146e4183e1a2490ca64406.tar.xz
bowelyzer-830f1d296e402a89c6146e4183e1a2490ca64406.zip
Bowelyzer.sc, BowelyzerAnalyzer.sc, BowelyzerConfig.sc, BowelyzerOSCHub.sc: Moving from String based identifiers to Symbols. Further refining the configuration parsing and validation process. darmstadt.json: Moving names into inputs Dictionary, holding channel number (offsets are not required/feasible) and name.
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
);