Commit d82fb993 authored by Max-Ferdinand Suffel's avatar Max-Ferdinand Suffel
Browse files

enabled led feedback during sound synthesis

parent 40c3fe7c
......@@ -158,6 +158,7 @@ var instruments = [
// Instrument that we play
var instrument = 4;
var relaySocket; // TODO: refactor
RefreshFrame = function () {
var speed = (PI2 * nbrPoints) / cycleLength;
......@@ -171,6 +172,8 @@ RefreshFrame = function () {
velocity = 127;
note = MIDI.pianoKeyOffset + i;
sendLightData(relaySocket, "red", note*2.5);
MIDI.noteOn(instrument, note, velocity, delay);
lastSound[i] = ms;
......@@ -217,9 +220,9 @@ RefreshFrame = function () {
window.onload = function () {
// Connect to relay server via web socket.
// var relaySocket = new WebSocket(AUDIO_SOCKET_SERVER);
// relaySocket.binaryType = "arraybuffer";
// relaySocket.onopen = function(e) {
relaySocket = new WebSocket(AUDIO_SOCKET_SERVER);
relaySocket.binaryType = "arraybuffer";
relaySocket.onopen = function(e) {
MIDI.loadPlugin({
soundfontUrl: "./soundfont/",
......@@ -233,12 +236,12 @@ window.onload = function () {
setInterval(RefreshFrame, 200);
},
// callbackPCM: function (pcmBuffer) {
// sendAudioData(relaySocket, pcmBuffer);
// },
// silent: false // Debug: remove to hear audio on system speaker
});
// };
callbackPCM: function (pcmBuffer) {
sendAudioData(relaySocket, pcmBuffer);
},
silent: true // Debug: remove to hear audio on system speaker
});
};
};
</script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment