mirror of
https://github.com/iBundin/Open-Web-Piano.git
synced 2026-04-03 00:08:26 -06:00
No description
| audio | ||
| index.html | ||
| midi.js | ||
| OpenWebPiano.js | ||
| readme.md | ||
Lightweight virtual web piano. There is only one sample per octave, however samples are mixed with each other for realistic sound with correct full-length sustain. Lowpass filters are used to emulate dynamics. This instrument works well with sustain pedal.
Installation
Simply copy openWebPiano.js and audio folder. See index.html for the example.
API
- init(context) - load all samples and start;
- noteOn(note 21 - 105, velocity 0 - 127 ) - start a note with a particular velocity level in standard MIDI format;
- noteOff(note) - stop a note;
- sustain(value) - any value higher then 0 switches sustain on, 0 value switches sustain off.
Example
<script src="OpenWebPiano.js"></script>
<script>
var audioCtx = new AudioContext();
openWebPiano.init(audioCtx);
//on event(note,velocity) ->
openWebPiano.noteOn(note, velocity);
</script>