by **FStriker** on 04 Dec 2018, 23:11

Hi Mixbives,

I downloaded the Essential Generator pack.

Everything works fine to the rhythm of the music except the Dynamic Lines effect. And when I edit the file, I realize that it lacks the variable #pragma input ichannel10 audio

Impossible to move the curve depending on the sound, ... or so I do not know how the effect works.

Is it possible to modify the code by adding the variable to the place (float sound for example?)

Here's the code:

#pragma autoreload;

#pragma shadertoy;// Using shadertoy's formalism for non-specific uniforms

#define PI 3.14

#define bpm 24.*PI*cycleClock

/*UNIFORMS*/

uniform float cycleClock;

uniform float barClock;

float random(float x){

return fract(sin(dot(x,343.903434))*2324.42423);

}

float fbm(float x){

// Properties

const int octaves = 1;

float lacunarity = 2.0;

float gain = 0.5;

float y;

//

// Initial values

float amplitude = 0.5;

float frequency = 1.;

//

// Loop of octaves

for (int i = 0; i < octaves; i++) {

y += amplitude * sin(frequency*x);

frequency *= lacunarity;

amplitude *= gain;

}

return y;

}

float trace(vec2 uv, float f){

return smoothstep(f-.01, f, uv.y)-smoothstep(f,f+.01,uv.y);

}

float mask(vec2 uv, float f){

return smoothstep(f-.002, f, uv.y);

}

float line(float x, float amp, float freq, float t, float seed){

float line = .9*sin(x*freq+t) + sin(x*freq*seed+t*.5*seed)+ Fragment*fract(x*freq*seed+t*.75*seed);

return line*=amp;

}

void mainImage( out vec4 fragColor, in vec2 fragCoord )

{

vec2 uv = -1. + 2.*fragCoord.xy / iResolution.xy;// Remap the space to [-1;1]

uv.x *= iResolution.x/iResolution.y;// Aspect ratio correction

vec3 color = vec3(0.);

float t = 2.*iGlobalTime;

//float t = bpm;

float freq = 8.;

float amp = mix(1.,clamp(2.*sin(bpm),-1.,1.),Bounce);

float lines[8];

/* color += trace(uv, line(uv.x, .1, 8., t, 1.46));

color += trace(uv, line(uv.x, .1, 8.32, t*.92, 1.4892))*mask(uv, line(uv.x, .1, 8., t, 1.46));

color += trace(uv, line(uv.x, .143, 8.67, t*.832, .46))*mask(uv, line(uv.x, .1, 8.32, t*.92, 1.4892))*mask(uv, line(uv.x, .1, 8., t, 1.46));*/

for(int i=0;i<8;i++){

lines[i] = amp*line(uv.x, .1+Amplitude*float(i)*.01, 8., t+float(i)*Spacing, 1.46);

color += trace(uv,lines[i]);

}

fragColor = vec4(color,1.0);

}