With only 460 bytes minified + gzipped, Audings exposes a simple API to incorporate interface sounds in your web application. By decoding and storing your audio in memory, Audings can instantly retrieve and play them when you need.
Click on the squares or hit the hotkeys (F, G, H, J) on your keyboard to trigger the audio.
audings.load(key, urlOrFile[, callback])- load an audio file from a absolute or relative URL through AJAX or from a File Object (eg.<input type="file">), save it in the memory under thekeykey and call the optional callback function if presentaudings.unload(key)- delete the audio stored underkeyfrom memoryaudings.start(key)- start playing the audio stored underkeyaudings.stop(key)- stop playing the audio stored underkey
Load notification.wav file through AJAX and store it in memory under the notification key:
audings.load('notification', 'sounds/notification.wav');...and play it through the notification key reference when you need:
audings.start('notification');Alternatively, load notification.wav file and play it as soon as it's ready (beware of latency):
audings.load('notification', 'sounds/notification.wav', function(key){
audings.start('notification');
})Chrome 10+, Firefox 25+, Edge 12+ Safari 6+, Opera 15+