How to use the midi.Player function in midi

To help you get started, we’ve selected a few midi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github panarch / concerto / src / Player.js View on Github external
tracks[trackIndex] = track;
                    }
                    else
                        track = tracks[trackIndex];

                    var notes = voices[j];
                    run(p, track, 0, notes, 0, maxDuration);
                }
            }

            sumMaxDuration += maxDuration;
        }

        MIDI.Player.timeWarp = 1; // speed the song is played back
        MIDI.Player.currentData = this.file.toBytes();
        MIDI.Player.loadMidiFile();
        L.debug('Finished generating midi file');
    }
github michaelnew / web-piano / js / app.js View on Github external
onsuccess: function() {
  		// var delay = 0; // play one note every quarter second
		// var note = 50; // the MIDI note
		// var velocity = 127; // how hard the note hits
		MIDI.setVolume(0, 127);
		// MIDI.noteOn(0, note, velocity, delay);
		// MIDI.noteOff(0, note, delay + 0.75);
		player = MIDI.Player;
		// player.BPM = 300;
		// player.loadFile(song, player.start);

		//MIDIPlayerPercentage(player);
		MIDI.programChange(0, MIDI.GM.byName['acoustic_grand_piano'].number);
		MIDI.programChange(1, MIDI.GM.byName['synth_drum'].number);
		MIDI.programChange(2, MIDI.GM.byName['banjo'].number);
	}
});
github panarch / concerto / src / Player.js View on Github external
this.file.addTrack(track);
                        tracks[trackIndex] = track;
                    }
                    else
                        track = tracks[trackIndex];

                    var notes = voices[j];
                    run(p, track, 0, notes, 0, maxDuration);
                }
            }

            sumMaxDuration += maxDuration;
        }

        MIDI.Player.timeWarp = 1; // speed the song is played back
        MIDI.Player.currentData = this.file.toBytes();
        MIDI.Player.loadMidiFile();
        L.debug('Finished generating midi file');
    }
github panarch / concerto / src / Player.js View on Github external
}
                        this.file.addTrack(track);
                        tracks[trackIndex] = track;
                    }
                    else
                        track = tracks[trackIndex];

                    var notes = voices[j];
                    run(p, track, 0, notes, 0, maxDuration);
                }
            }

            sumMaxDuration += maxDuration;
        }

        MIDI.Player.timeWarp = 1; // speed the song is played back
        MIDI.Player.currentData = this.file.toBytes();
        MIDI.Player.loadMidiFile();
        L.debug('Finished generating midi file');
    }