Difference between revisions of "FractalMelody.ck"

From CSWiki
Jump to: navigation, search
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
// Fractal-Glitchy-Techno by Kristjan Varnik
+
Go recursion!
// Placed in the Public Domain. 2005
 
  
120.0 * 0.2 => float tempo;
+
// Fractal-Glitchy-Techno by Kristjan Varnik
.5::second => dur T;
+
// Placed in the Public Domain. 2005
T - (now % T) => now;
+
0.0 => float pitch;
+
120.0 * 0.2 => float tempo;
 
+
.5::second => dur T;
fun float getStep(float step) {
+
T - (now % T) => now;
  60.0/tempo => float beat;   
+
0.0 => float pitch;
  beat / 2.0 => float step1;
+
  return step * step1;
+
fun float getStep(float step) {
}
+
  60.0/tempo => float beat;   
 
+
  beat / 2.0 => float step1;
// the patch
+
  return step * step1;
sinosc s=> gain g => dac;
+
}
 
+
fun void playA(float time, float pitch) {
+
// the patch
  pitch => s.freq;
+
sinosc s=> gain g => dac;
}
+
 
+
fun void playA(float time, float pitch) {
fun void playRecursive(float levels, float time, float pitch) {     
+
    pitch => s.freq;
    levels -1.0 => levels;
+
}
    if (levels < 0.0) {
+
      playA(time, pitch);
+
fun void playRecursive(float levels, float time, float pitch) {     
    } else {
+
    levels -1.0 => levels;
      playRecursive(levels, time, pitch * 1.0);
+
    if (levels < 0.0) {
      getStep(time)::T => now;
+
        playA(time, pitch);
      playRecursive(levels, time, pitch * 1.0);
+
    } else {
      getStep(time * 0.5)::T => now;
+
        playRecursive(levels, time, pitch * 1.0);
      playRecursive(levels, time, pitch * 1.0);
+
        getStep(time)::T => now;
      getStep(time)::T => now;
+
        playRecursive(levels, time, pitch * 1.0);
      playRecursive(levels, time, pitch * 1.414);
+
        getStep(time * 0.5)::T => now;
      getStep(time)::T => now;
+
        playRecursive(levels, time, pitch * 1.0);
    }
+
        getStep(time)::T => now;
}
+
        playRecursive(levels, time, pitch * 1.414);
 
+
        getStep(time)::T => now;
// go
+
    }
playRecursive(5.0,0.07, 110.0);
+
}
0.0 => g.gain;
+
 +
// go
 +
playRecursive(5.0,0.07, 110.0);
 +
0.0 => g.gain;

Latest revision as of 19:30, 21 February 2006

Go recursion!

// Fractal-Glitchy-Techno by Kristjan Varnik 
// Placed in the Public Domain. 2005

120.0 * 0.2 => float tempo;
.5::second => dur T;
T - (now % T) => now;
0.0 => float pitch;

fun float getStep(float step) {
  60.0/tempo => float beat;   
  beat / 2.0 => float step1;
  return step * step1;
}

// the patch
sinosc s=> gain g => dac;

fun void playA(float time, float pitch) {
   pitch => s.freq;
}

fun void playRecursive(float levels, float time, float pitch) {     
    levels -1.0 => levels;
    if (levels < 0.0) {
       playA(time, pitch);
    } else {
       playRecursive(levels, time, pitch * 1.0);
       getStep(time)::T => now;
       playRecursive(levels, time, pitch * 1.0);
       getStep(time * 0.5)::T => now;
       playRecursive(levels, time, pitch * 1.0);
       getStep(time)::T => now;
       playRecursive(levels, time, pitch * 1.414);
       getStep(time)::T => now;
    }
}

// go
playRecursive(5.0,0.07, 110.0);
0.0 => g.gain;