UNPKG

webaudiofont

Version:

Soundfonts for web. About of 2000 musical instruments. GM MIDI compatible.

26 lines 922 B
<html> <head> <script src='../npm/dist/WebAudioFontPlayer.js'></script> <script src='https://surikov.github.io/webaudiofontdata/sound/0000_JCLive_sf2_file.js'></script> <script> var selectedPreset=_tone_0000_JCLive_sf2_file; var AudioContextFunc = window.AudioContext || window.webkitAudioContext; var audioContext = new AudioContextFunc(); var player=new WebAudioFontPlayer(); player.loader.decodeAfterLoading(audioContext, '_tone_0000_JCLive_sf2_file'); var clickCOunt=0; function playStart(){ player.queueWaveTable(audioContext, audioContext.destination, selectedPreset, 0, 55, 3.5); clickCOunt++; console.log(clickCOunt); console.log(audioContext); console.log(selectedPreset); } </script> </head> <body> <p><a href="#" onmousedown="playStart();">Play a note</a></p> <hr/> <p><a href="https://surikov.github.io/webaudiofont/">source</a></p> </body> </html>