Permalink
Browse files

adding single lfo trem, wave shaper, and dist

  • Loading branch information...
1 parent b1f7631 commit b69f82417074c7fcb6aeaf0ef681367d30f2adef @heuermh committed Oct 26, 2012
Showing with 467 additions and 1 deletion.
  1. +38 −0 Dist.ck
  2. +38 −0 FrostburnDist.ck
  3. +32 −0 GainShaper.ck
  4. +38 −0 KijjazDist.ck
  5. +39 −0 KijjazDist2.ck
  6. +39 −0 KijjazDist3.ck
  7. +39 −0 KijjazDist4.ck
  8. +53 −0 SinTrem.ck
  9. +53 −0 SqrTrem.ck
  10. +53 −0 TriTrem.ck
  11. +31 −0 WaveShaper.ck
  12. +14 −1 import.ck
View
38 Dist.ck
@@ -0,0 +1,38 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+class F extends FloatFunction
+{
+ fun float evaluate(float value)
+ {
+ // f(x) = x / (1.0 + abs(x))
+ return value / (1.0 + Math.fabs(value));
+ }
+}
+
+public class Dist extends WaveShaper
+{
+ {
+ F f;
+ f @=> shape;
+ }
+}
View
@@ -0,0 +1,38 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+class F extends FloatFunction
+{
+ fun float evaluate(float value)
+ {
+ // f(x) = (x * abs(x) + x) / (x^2 + abs(x) + 1.0)
+ return (value * Math.fabs(value) + value) / (value * value + Math.fabs(value) + 1.0);
+ }
+}
+
+public class FrostburnDist extends WaveShaper
+{
+ {
+ F f;
+ f @=> shape;
+ }
+}
View
@@ -0,0 +1,32 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+public class GainShaper extends Chugen
+{
+ FloatFunction shape;
+
+ fun float tick(float in)
+ {
+ shape.evaluate(gain()) => gain;
+ return in;
+ }
+}
View
@@ -0,0 +1,38 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+class F extends FloatFunction
+{
+ fun float evaluate(float value)
+ {
+ // f(x) = x / (1.0 + x^2)
+ return value / (1.0 + value * value);
+ }
+}
+
+public class KijjazDist extends WaveShaper
+{
+ {
+ F f;
+ f @=> shape;
+ }
+}
View
@@ -0,0 +1,39 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+class F extends FloatFunction
+{
+ fun float evaluate(float value)
+ {
+ // f(x) = x^3 / (1.0 + abs(x^3))
+ (value * value * value) => float v;
+ return v / (1.0 + Math.fabs(v));
+ }
+}
+
+public class KijjazDist2 extends WaveShaper
+{
+ {
+ F f;
+ f @=> shape;
+ }
+}
View
@@ -0,0 +1,39 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+class F extends FloatFunction
+{
+ fun float evaluate(float value)
+ {
+ // f(x) = x(1.0 + x^2) / (1.0 + abs(x(1.0 + x^2)))
+ value * (1.0 + value * value) => float v;
+ return v / (1.0 + Math.fabs(v));
+ }
+}
+
+public class KijjazDist3 extends WaveShaper
+{
+ {
+ F f;
+ f @=> shape;
+ }
+}
View
@@ -0,0 +1,39 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+class F extends FloatFunction
+{
+ fun float evaluate(float value)
+ {
+ // f(x) = x(1.0 + x^4) / (1.0 + abs(x(1.0 + x^4)))
+ value * (1.0 + value * value * value * value) => float v;
+ return v / (1.0 + Math.fabs(v));
+ }
+}
+
+public class KijjazDist4 extends WaveShaper
+{
+ {
+ F f;
+ f @=> shape;
+ }
+}
View
@@ -0,0 +1,53 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+public class SinTrem extends Chugen
+{
+ SinOsc lfo;
+
+ {
+ lfo => blackhole;
+ }
+
+ fun float rate(float rate)
+ {
+ rate => lfo.freq;
+ return rate;
+ }
+
+ fun float depth(float depth)
+ {
+ depth => lfo.gain;
+ return depth;
+ }
+
+ fun float tick(float in)
+ {
+ interp(lfo.last(), -1.0, 1.0, 0.0, 1.0) => gain;
+ return in;
+ }
+
+ fun float interp(float value, float sourceMin, float sourceMax, float targetMin, float targetMax)
+ {
+ return targetMin + (targetMax - targetMin) * ((value - sourceMin) / (sourceMax - sourceMin));
+ }
+}
View
@@ -0,0 +1,53 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+public class SqrTrem extends Chugen
+{
+ SqrOsc lfo;
+
+ {
+ lfo => blackhole;
+ }
+
+ fun float rate(float rate)
+ {
+ rate => lfo.freq;
+ return rate;
+ }
+
+ fun float depth(float depth)
+ {
+ depth => lfo.gain;
+ return depth;
+ }
+
+ fun float tick(float in)
+ {
+ interp(lfo.last(), -1.0, 1.0, 0.0, 1.0) => gain;
+ return in;
+ }
+
+ fun float interp(float value, float sourceMin, float sourceMax, float targetMin, float targetMax)
+ {
+ return targetMin + (targetMax - targetMin) * ((value - sourceMin) / (sourceMax - sourceMin));
+ }
+}
Oops, something went wrong.

0 comments on commit b69f824

Please sign in to comment.