idris2-dom
idris2-dom copied to clipboard
Support for Web Audio API
https://webaudio.github.io/web-audio-api/
For my particular use case, I'd like to use the AudioContext
to decode the contents of a file I get
(e.g. MP3) and then get access to its metadata fields and its sample contents.
Example JavaScript code:
const AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
const response = await fetch(url);
const buf = await audioCtx.decodeAudioData(await response.arrayBuffer());
const ratio = cpu_freq / buf.sampleRate;
const len = buf.length;
const chan = buf.getChannelData(0);
...
Note that most parts are asynchronous.