Monday, June 4, 2012

Beat Experimentation

I was reading about beats and interference, so I thought I'd try it out.

I created this infinite time loop program, and it plays around with beats. Try it out, it's pretty cool, and doesn't completely give you a headache.

Disclaimer: I owe most of the coolness of the output to the JCRev...





SinOsc s => Gain g => JCRev r => dac;
SinOsc s1 => g;
SinOsc s2 => g;
SinOsc s3 => g;
Impulse i => g;
SinOsc n => r;
SinOsc n2 => r;

.1 => g.gain;

342 => n.freq;
.008 => n.gain;
228 => n2.freq;
.008 => n2.gain;


256 => int x;
512 => int y;
512 => int y1;
int x1;
1 => float e;

6::second => dur T;
now + T => time later;

while(true) {

    if(now >= later) {
       342 => n.freq;
       .008 => n.gain;
       683 => n2.freq;
       .008 => n2.gain;
        512 => x1; 
        if (T > 4::second) {
            if (e <= 3.0) {
                e + .2 => e;
            } else {
                e -.2 => e;
            }
        x + 1 => x;
        y + 1 => y;
        T - 1::second => T;
        now + T => later;
        
        } else {
            342 => n.freq;
            .008 => n.gain;
            228 => n2.freq;
            .008 => n2.gain;
            1024 => int d;
            while(T < 6::second) {
                1024 => x1;
                x - 1 => x;
                y - 1 => y;
                d + 1 => d;
                T + 1::second => T;
                now + T => later;
            }
        }
        
    }
    e => i.next;
    x => s.freq;
    x1 => s1.freq;
    y => s2.freq;
    y1 => s3.freq;
    
    200::ms => now;
    
    0 => s.freq;
    0 => s1.freq;
    0 => s2.freq;
    0 => s3.freq;
    
    200::ms => now;

}

4 comments:

  1. Nice!
    How do you make a comment in Chuck?
    I now have this in a .k file, but no documentation
    (hint hint).

    ReplyDelete
  2. Nice!
    How do you make a comment in Chuck?
    I now have this in a .k file, but no documentation
    (hint hint).

    ReplyDelete
  3. I'll document it :) "//" works to add a comment in ChucK

    ReplyDelete
  4. Very nice beats here

    ReplyDelete