Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Karan Goel
481-SoundBrain
Commits
d82fb993
Commit
d82fb993
authored
Feb 24, 2015
by
Max-Ferdinand Suffel
Browse files
enabled led feedback during sound synthesis
parent
40c3fe7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
webapp/index.html
View file @
d82fb993
...
...
@@ -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:
fals
e // Debug: remove to hear audio on system speaker
});
//
};
callbackPCM
:
function
(
pcmBuffer
)
{
sendAudioData
(
relaySocket
,
pcmBuffer
);
},
silent
:
tru
e
// Debug: remove to hear audio on system speaker
});
};
};
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment