Permalink
Browse files

adding humanize class and related changes

  • Loading branch information...
1 parent 83855b2 commit 7ae440e3d4d102823918db2e2712cf54f2a752f7 Michael Heuer committed Feb 29, 2012
Showing with 68 additions and 5 deletions.
  1. +2 −3 BigMono.ck
  2. +56 −0 Humanize.ck
  3. +1 −1 HumanizedDurProvider.ck
  4. +7 −1 examples/bigMonoExample.ck
  5. +1 −0 examples/euclidOscBigMono.ck
  6. +1 −0 import.ck
View
@@ -445,7 +445,6 @@ public class BigMono
{
//BellRide bellRide;
ClosedHat closedHat;
- // todo: demo ends/fails at Crash 15
Crash crash;
//CrossStick crossStick;
DarkCrash darkCrash;
@@ -464,8 +463,8 @@ public class BigMono
{
ArrayList samples;
//samples.add(bellRide);
- //samples.add(closedHat);
- //samples.add(crash);
+ samples.add(closedHat);
+ samples.add(crash);
//samples.add(crossStick);
samples.add(darkCrash);
samples.add(hardSnare);
View
@@ -0,0 +1,56 @@
+/*
+
+ 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 Humanize
+{
+ fun static dur humanize(dur value)
+ {
+ return humanize(value, 0.05, 0.05);
+ }
+
+ fun static dur humanize(dur value, float anticipation, float delay)
+ {
+ return value - Std.rand2f(0.0, anticipation) * value + Std.rand2f(0.0, delay) * value;
+ }
+
+ fun static dur anticipate(dur value)
+ {
+ return anticipate(value, 0.1);
+ }
+
+ fun static dur anticipate(dur value, float anticipation)
+ {
+ return value - Std.rand2f(0.0, anticipation) * value;
+ }
+
+ fun static dur delay(dur value)
+ {
+ return delay(value, 0.1);
+ }
+
+ fun static dur delay(dur value, float delay)
+ {
+ return value + Std.rand2f(0.0, delay) * value;
+ }
+
+ // gaussian, etc.
+}
View
@@ -27,7 +27,7 @@ public class HumanizedDurProvider extends DurProvider
fun dur evaluate()
{
- return duration - (duration * Std.rand2f(0.0, anticipation)) + (duration * Std.rand2f(0.0, delay));
+ return Humanize.humanize(duration, anticipation, delay);
}
fun static HumanizedDurProvider create(dur duration, float anticipation, float delay)
@@ -26,6 +26,12 @@ TimeSignature.common(98) @=> TimeSignature t;
spork ~ Loops.loop(bigMono.kick.asProcedure(), t.half(), t.bar * 8).run();
spork ~ Loops.loop(bigMono.kick.asProcedure(), t.whole() + t.eighth(), t.whole() + t.half(), t.bar * 2).run();
spork ~ Loops.loop(bigMono.snare.asProcedure(), t.quarter(), t.half(), t.bar * 8).run();
-spork ~ Loops.loop(bigMono.closedHat.asProcedure(), t.eighth(), t.bar * 4 * 8).run();
+
+// humanize eighth notes
+t.eighthProvider() @=> HumanizedDurProvider eighth;
+0.0025 => eighth.anticipation;
+0.005 => eighth.delay;
+
+spork ~ Loops.loop(bigMono.closedHat.asProcedure(), t.whole(), eighth, t.bar * 4 * 8).run();
1::minute => now;
@@ -31,6 +31,7 @@ euclid.addPattern("/eu/hardSnare", bigMono.hardSnare.asIntIntProcedure(), noop);
euclid.addPattern("/eu/openHat", bigMono.openHat.asIntIntProcedure(), noop);
euclid.addPattern("/eu/closedHat", bigMono.closedHat.asIntIntProcedure(), noop);
euclid.addPattern("/eu/crash", bigMono.crash.asIntIntProcedure(), noop);
+euclid.addPattern("/eu/darkCrash", bigMono.darkCrash.asIntIntProcedure(), noop);
euclid.connect();
<<<"ready">>>;
View
@@ -137,6 +137,7 @@ Machine.add("SinusoidalOut.ck");
// duration providers
Machine.add("DurProvider.ck");
+Machine.add("Humanize.ck");
Machine.add("HumanizedDurProvider.ck");
// procedures

0 comments on commit 7ae440e

Please sign in to comment.