I am trying to extract amplitude information from a sound loaded from a URL using the Web Audio API instantaneously (not in real time), which will likely require the OfflineAudioContext
. I am expecting to obtain something along the lines of an array containing the amplitude of the sound every t
seconds for the duration of the sound (with size depending on the duration of the sound, divided by t
). Unfortunately, documentation is sparse at this point, and I'm unsure of how to proceed. How can I load the sound and extract the amplitude every t
seconds?
相关问题
- Sampling from a texture which is also a render tar
- librosa.load() takes too long to load(sample) mp3
- getting error - Uncaught (in promise) DOMException
- Get precise notes with riffwave.js
- Play audio from partial response and save the buff
相关文章
- Android webview black screen while playing
- Convert wav to ogg on app engine (or in javascript
- Implementing a post-processed low-pass filter usin
- Play symbol (▶) squished in document.title
- how I can get current time when use playbackRate.v
- html5 audio not playing in chrome
- Crossorigin errors when loading VTT file
- Why does HTML 5 Audio disregards mobile device aud
This was done very quickly, so the math might be messed up. But hopefully it'll get you started...
Basically, if you want to get data for an entire buffer faster than realtime, you really don't even need an
OfflineAudioContext
. You can just read the samples, do some math, and figure it out.This is pretty slow, though. Especially for larger audio files. So you might want to put it in a Web Worker.
It's possible that using an
OfflineAudioContext
would be faster. I'm really not sure. But even if you decide to go down that route, there's still a lot of manual work you'd need to do in order to get the amplitude of these arbitrary chunks oft
seconds.