Skip to content

Instantly share code, notes, and snippets.

@CharStiles
Created December 6, 2021 02:01
Show Gist options
  • Save CharStiles/85938501be7f534ded8848036bdb4c2c to your computer and use it in GitHub Desktop.
Save CharStiles/85938501be7f534ded8848036bdb4c2c to your computer and use it in GitHub Desktop.
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