update for multiple instruments, use drum + piano

This commit is contained in:
Michael Deal 2012-11-21 02:03:56 -08:00
parent 30c224b067
commit 0560bae4f5
4 changed files with 4 additions and 95 deletions

View file

@ -19,11 +19,11 @@ var loader;
window.onload = function () {
loader = new widgets.Loader;
MIDI.loadPlugin({
instruments: [ "acoustic_grand_piano", "acoustic_guitar_nylon" ], // or multiple instruments
instruments: [ "acoustic_grand_piano", "synth_drum" ], // or multiple instruments
callback: function() {
loader.stop();
MIDI.programChange(0, 0);
MIDI.programChange(1, 24);
MIDI.programChange(1, 118);
for (var n = 0; n < 100; n ++) {
var delay = n / 4; // play one note every quarter second
var note = MIDI.pianoKeyOffset + n; // the MIDI note

View file

@ -66,7 +66,7 @@ RefreshFrame = function () {
var len = circleRadius * (1 + 1.0 / nbrPoints - r);
if (Math.floor(a / PI2) !== Math.floor(tines[i] / PI2)) {
MIDI.noteOn(0, i + 21, 100, 0);
MIDI.noteOn(24, i + 21 + 36, 100, 0);
MIDI.noteOn(1, i + 21 + 36, 100, 0);
lastSound[i] = ms;
}
var x = (cx + Math.cos(a) * len);
@ -86,7 +86,7 @@ RefreshFrame = function () {
window.onload = function () {
MIDI.loadPlugin({
instruments: [ "acoustic_grand_piano", "acoustic_guitar_nylon" ], // or multiple instruments
instrument: "acoustic_grand_piano", // or multiple instruments
callback: function() {
loader.stop();
var canvas = document.getElementById('mycanvas');

File diff suppressed because one or more lines are too long