Light design (day 3 at APO33)

After the direct mapping of the energy to the light - I decide that I need a more clear distinction in levels. So I create leaky integrators of the energy, and when the value from this gets passed a certain threshold, that corner shifts to a different light color.

Within these states and associated colors, the intensity varies directly with the energy, as before.

In addition, when the energy state changes, also the basic chord of the wavetable synthesis shifts, and the bouncy granular sounds get a new mapping of their parameters.

x.addExpected( 203, \energyInt, 4 );
x.setData( 203, [0,0,0,0] );

~leakPump = 0.01;
~leakLeak = 0.995;
x.nodes[201].action = { |data| 
    x.setData( 203, (~leakPump * data) + (~leakLeak * x.nodes[203].data) )
};

~energyThresholdsUp = (1..10).collect{ |it| [0.001,1.0, 7 ].asSpec.map( it/10 ) } ++ [ 1 ];
~energyThresholdsDown = [0] ++ (~energyThresholdsUp * 0.95);
~currentEnergyState = [0,0,0,0];
~colorHues = Array.series( 11, 0.0, 1/11 );

(
Tdef( \setLightsEnergy, {
var hasStateChange;
loop{
    hasStateChange = false;
    x.nodes[203].data.do{ |it,i|
        if ( it > ~energyThresholdsUp[ ~currentEnergyState[i] ] ){
            hasStateChange = true;
            ~currentEnergyState[i] = ~currentEnergyState[i] + 1;
            ~currentEnergyState.postln;
            ~influx.rand;
            ~currentEnergyState[i] = ~currentEnergyState[i].clip(0,~energyThresholdsUp.size-1);
        }{
            if ( it < ~energyThresholdsDown[ ~currentEnergyState[i] ] ){
                hasStateChange = true;
                ~currentEnergyState[i] = ~currentEnergyState[i] - 1;
                ~currentEnergyState.postln;
                ~influx.rand;
                ~currentEnergyState[i] = ~currentEnergyState[i].clip(0,~energyThresholdsUp.size-1);
            };
        };
        ~currentEnergyState[i] = ~currentEnergyState[i].clip(0,~energyThresholdsUp.size-1);
        ~intensity = x.nodes[202].data[i].specMap( ~energySpec, ~intensitySpec );
        ~color = Color.hsv( ~colorHues[ ~currentEnergyState[i] ], 1, ~intensity, 0 ).asArray;
        // ~color.postln;
        ~microWashes[i].rgbw_( *~color );
    };
    if ( hasStateChange ) { ~updateChord.value( ~currentEnergyState.sum.fold(0,15) ); };
    ~setAllLights.value;
    0.05.wait;
}
});
);

Tdef( \setLightsEnergy ).play;
Wed, 17 August, 2016
RSS Feed