Skip to content

Instantly share code, notes, and snippets.

@fand
Created April 6, 2018 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/5ec6ff5d391d8e28b103a5a8dee72c19 to your computer and use it in GitHub Desktop.
Save fand/5ec6ff5d391d8e28b103a5a8dee72c19 to your computer and use it in GitHub Desktop.
tidal midi test
import Sound.Tidal.MIDI.Context
import Sound.Tidal.MIDI.Control
import Sound.Tidal.MIDI.CC
devices <- midiDevices
m1 <- midiStream devices "" 1 synthController
m1 $ midinote "60*4 62*4 64*2 65*4"
m1 $ silence
/*{ "vertexCount": 100, "midi": true }*/
precision mediump float;
attribute float vertexId;
uniform float vertexCount;
uniform float time;
uniform vec2 resolution;
varying vec4 v_color;
uniform sampler2D midi;
uniform sampler2D note;
void main() {
float i = vertexId + time * 0.01;
// float k = texture2D(midi, vec2(181. / 256., 119. / 256.)).x;
float k = (
texture2D(note, vec2(60. / 128.)).x * 1. +
texture2D(note, vec2(62. / 128.)).x * 2. +
texture2D(note, vec2(64. / 128.)).x * 3. +
texture2D(note, vec2(65. / 128.)).x
) * 20.;
vec3 pos = vec3(cos(i * k), sin(i * 5.), cos(i * 2.));
gl_Position = vec4(pos.x, pos.y, pos.z, 1);
v_color = vec4(fract(vertexId / 1.), 1,1,1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment