update for multiple instruments, use drum + piano
This commit is contained in:
parent
30c224b067
commit
0560bae4f5
4 changed files with 4 additions and 95 deletions
|
@ -19,11 +19,11 @@ var loader;
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
loader = new widgets.Loader;
|
loader = new widgets.Loader;
|
||||||
MIDI.loadPlugin({
|
MIDI.loadPlugin({
|
||||||
instruments: [ "acoustic_grand_piano", "acoustic_guitar_nylon" ], // or multiple instruments
|
instruments: [ "acoustic_grand_piano", "synth_drum" ], // or multiple instruments
|
||||||
callback: function() {
|
callback: function() {
|
||||||
loader.stop();
|
loader.stop();
|
||||||
MIDI.programChange(0, 0);
|
MIDI.programChange(0, 0);
|
||||||
MIDI.programChange(1, 24);
|
MIDI.programChange(1, 118);
|
||||||
for (var n = 0; n < 100; n ++) {
|
for (var n = 0; n < 100; n ++) {
|
||||||
var delay = n / 4; // play one note every quarter second
|
var delay = n / 4; // play one note every quarter second
|
||||||
var note = MIDI.pianoKeyOffset + n; // the MIDI note
|
var note = MIDI.pianoKeyOffset + n; // the MIDI note
|
||||||
|
|
|
@ -66,7 +66,7 @@ RefreshFrame = function () {
|
||||||
var len = circleRadius * (1 + 1.0 / nbrPoints - r);
|
var len = circleRadius * (1 + 1.0 / nbrPoints - r);
|
||||||
if (Math.floor(a / PI2) !== Math.floor(tines[i] / PI2)) {
|
if (Math.floor(a / PI2) !== Math.floor(tines[i] / PI2)) {
|
||||||
MIDI.noteOn(0, i + 21, 100, 0);
|
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;
|
lastSound[i] = ms;
|
||||||
}
|
}
|
||||||
var x = (cx + Math.cos(a) * len);
|
var x = (cx + Math.cos(a) * len);
|
||||||
|
@ -86,7 +86,7 @@ RefreshFrame = function () {
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
MIDI.loadPlugin({
|
MIDI.loadPlugin({
|
||||||
instruments: [ "acoustic_grand_piano", "acoustic_guitar_nylon" ], // or multiple instruments
|
instrument: "acoustic_grand_piano", // or multiple instruments
|
||||||
callback: function() {
|
callback: function() {
|
||||||
loader.stop();
|
loader.stop();
|
||||||
var canvas = document.getElementById('mycanvas');
|
var canvas = document.getElementById('mycanvas');
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue