aboutsummaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2017-05-01 14:54:51 +0200
committerDavid Runge <dave@sleepmap.de>2017-05-01 14:54:51 +0200
commit3819ef4a768e87e00c3586591505638e6820976e (patch)
tree4386eca25a9061419f2fffd8e921682afc685fc9 /classes
parentb2b6c92bd1dc0a1e1b5f4559378d05e3d4285d57 (diff)
downloadzzz-3819ef4a768e87e00c3586591505638e6820976e.tar.gz
zzz-3819ef4a768e87e00c3586591505638e6820976e.tar.bz2
zzz-3819ef4a768e87e00c3586591505638e6820976e.tar.xz
zzz-3819ef4a768e87e00c3586591505638e6820976e.zip
classes/ZZZ.sc: Removing unneeded postlns. Adding wrapper functions hzToAmp and ampToHz for direct conversion.
Diffstat (limited to 'classes')
-rw-r--r--classes/ZZZ.sc23
1 files changed, 19 insertions, 4 deletions
diff --git a/classes/ZZZ.sc b/classes/ZZZ.sc
index 3f39357..65b18c1 100644
--- a/classes/ZZZ.sc
+++ b/classes/ZZZ.sc
@@ -51,7 +51,6 @@ ZZZ{
},{
voltage = amplitude.lincurve(1.0, 2.5, ampToVACConst, 7.7, -4, nil);
});
- voltage.postln;
^voltage;
}
@@ -69,7 +68,6 @@ ZZZ{
},{
amplitude = voltage.curvelin(ampToVACConst, 7.7, 1.0, 2.5, -4, \max);
});
- amplitude.postln;
^amplitude;
}
@@ -86,7 +84,6 @@ ZZZ{
},{
voltage = frequency.explin(55, 880, 1.0, 5.0, nil);
});
- voltage.postln;
^voltage;
}
@@ -103,8 +100,26 @@ ZZZ{
},{
frequency = voltage.linexp(1.0, 5.0, 55, 880, nil);
});
- frequency.postln;
^frequency;
}
+ /**
+ * Calculates amplitude for supplied frequency.
+ * Wraps call to hzToVAC -> vacToAmp
+ * @return amplitude for corresponding frequency
+ */
+ *hzToAmp{
+ arg frequency;
+ ^this.vacToAmp(this.hzToVAC(frequency));
+ }
+
+ /**
+ * Calculates frequency for supplied amplitude.
+ * Wraps call to ampToVAC -> vacToHz
+ * @return frequency for corresponding amplitude
+ */
+ *ampToHz{
+ arg amplitude;
+ ^this.vacToHz(this.ampToVAC(amplitude));
+ }
}