music no no no no noah algorithmic gamelan

From Noah.org
Jump to navigationJump to search


This is a Chuck script I've been playing around with. Rift 0 is the salient one here.



[0, 2, 4, 7, 9, 12] @=> int scale[];
//best [0, 2, 4, 7, 9, 12] @=> int scale[];
//[0, 2, 4, 7, 9, 11] @=> int scale[];\\
//[0, 2, 4, 5, 9, 12] @=> int scale[];

fun void no_no_no_no (float now_period, int riff, int id)
{
    Moog moog => dac;
    0 => int index;
    while( true )
    {
        Math.random2f( 0.7, 0.99 ) => moog.filterQ;
        Math.random2f( 0.7, 0.89 ) => moog.filterSweepRate;
        Math.random2f( 11, 12 ) => moog.lfoSpeed; // set high-end low to feel weird
        Math.random2f( 0.01, 0.1 ) => moog.lfoDepth; // Ow! Ow! Now! Now! Meow! Meow! No! No! No! No! No! NO! NO! NO!!!
        Math.random2f( 0.7, 0.8) => moog.volume;
        
        scale[Math.random2(0,scale.size()-1)] => int note;
        if (riff == 0)
        {
            57 + note => Std.mtof => moog.freq;
            if (index % 5 == 0)
            {
                1.0 => moog.noteOn;
                now_period * 0.5::second => now;
            }
            else
            {
                0.5 => moog.noteOn;
                now_period * 0.5::second => now;                
            }
        }
        else if (riff == 1)
        {
            Math.sin(index/100.0)*0.02 + now_period => now_period;
            47 + note => Std.mtof => moog.freq;
            if ((index+2) % 7 == 0)
                1.0 => moog.noteOn;
            else
                0.5 => moog.noteOn;
            if ((index+2) % 7 == 0)
                now_period * 0.5::second => now;
            else 
            {
                if (index % 6 == 0) // || index % 4 == 0)
                    now_period * 0.5::second * 0.25 =>now;
                else
                    now_period * 0.5::second * 0.5 => now;
            }
        }
        else if (riff == 2)
        {
            49 + note => Std.mtof => moog.freq;
            if (index % 7 == 0)
                1.0 => moog.noteOn;
            else
                0.5 => moog.noteOn;
            if (index % 7 == 0)
                now_period * 0.5::second * 1.0 => now;
            else if (index % 6 == 0 || index % 4 == 0)
                now_period * 0.5::second * 0.25 =>now;
            else
                now_period * 0.5::second * 0.5 => now;
        }
        else if (riff == 3)
        {
            49 + note => Std.mtof => moog.freq;
            if (index % 7 == 0)
                1.0 => moog.noteOn;
            else
                0.5 => moog.noteOn;
            if (index % 7 == 0)
                now_period * 0.5::second => now;
            else if (index % 5 == 0)
                now_period * 0.5::second * 0.25 =>now;
            else
                now_period * 0.5::second * 0.5 => now;
        }
        else if (riff == 4)
        {
            Math.sin(index/10.0)*0.01 + now_period => now_period;
            if (index % 5 == 0) <<<4,index,now_period>>>;
            47 + note => Std.mtof => moog.freq;
            if ((index+2) % 7 == 0)
                1.0 => moog.noteOn;
            else
                0.5 => moog.noteOn;
            if ((index+2) % 7 == 0)
                now_period * 0.5::second => now;
            else 
            {
                if (index % 6 == 0) // || index % 4 == 0)
                    now_period * 0.5::second * 0.25 =>now;
                else
                    now_period * 0.5::second * 0.5 => now;
            }
        }
        else if (riff == 5)
        {
            Math.cos(index/10.0)*0.01 + now_period => now_period;
            47 + note => Std.mtof => moog.freq;
            if ((index+2) % 7 == 0)
                1.0 => moog.noteOn;
            else
                0.5 => moog.noteOn;
            if ((index+2) % 7 == 0)
                now_period * 0.5::second => now;
            else 
            {
                if (index % 6 == 0) // || index % 4 == 0)
                    now_period * 0.5::second * 0.25 =>now;
                else
                    now_period * 0.5::second * 0.5 => now;
            }
        }
        else if (riff == 6)
        {
            Math.sin(index/500.0)*0.001 + now_period => now_period;
            if (index % 10 == 0) 
            {
                if (id >= 10 && id < 100)
                    <<<"                    ",id,6,index,now_period>>>;
                else if (id >= 100)
                    <<<"                                        ",id,6,index,now_period>>>;
                else
                    <<<id,6,index,now_period>>>;
            }
            57 + note => Std.mtof => moog.freq;
            if (index % 5 == 0)
            {
                1.0 => moog.noteOn;
                now_period * 0.3::second => now;
            }
            else
            {
                0.5 => moog.noteOn;
                now_period * 0.3::second => now;                
            }
        }
        else if (riff == 7)
        {
            Math.cos(index/50.0)*0.001 + now_period => now_period;
            if (index % 10 == 0) 
            {
                if (id >= 10 && id < 100)
                    <<<"                    ",id,7,index,now_period>>>;
                else if (id >= 100)
                    <<<"                                        ",id,7,index,now_period>>>;
                else
                    <<<id,7,index,now_period>>>;
            }

            57 + note => Std.mtof => moog.freq;
            if (index % 5 == 0)
            {
                1.0 => moog.noteOn;
                now_period * 0.3::second => now;
            }
            else
            {
                0.5 => moog.noteOn;
                now_period * 0.3::second => now;                
            }
        }
        index + 1 => index;
    }
}

spork ~ no_no_no_no (0.95,0,0);
5::ms=>now;
spork ~ no_no_no_no (0.96,0,0);
6::ms=>now;
spork ~ no_no_no_no (0.97,0,0);
7::ms=>now;
spork ~ no_no_no_no (0.98,0,0);
8::ms=>now;
spork ~ no_no_no_no (0.99,0,0);

while(true)
    1::second => now;


//Hid hi;
//HidMsg msg;
//1 => int device;
//if( !hi.openKeyboard( device ) ) me.exit();
//<<< "keyboard '" + hi.name() + "' ready", "" >>>;