Skip to content

Instantly share code, notes, and snippets.

@CharStiles
Created December 6, 2021 02:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
uniform sampler2D midi;
vec2 midiCoord(float offset)
{
float x = mod(offset,32.);
float y = offset / 32.;
return vec2(x,y)/32.;
}
float getMidi(float number){
float num = 3. * 127. + number;
texture2D(midi, (midiCoord(num)));
return texture2D(midi, (midiCoord(num))).x;
}
// using
float one = 3. * 127. + 1.;
float two = 3. * 127. + 2.;
float four = 3. * 127. + 4.;
float five = 3. * 127. + 5.;
float six = 3. * 127. + 6.;
//now we can use texture2D and midiCoord to pull r, g, and b values fro the 4th dimension of the sample
float speed = 1-texture2D(midi,midiCoord(one)).w;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment