1
votes

I've recently been looking into doing some Audio processing and visualization in a web browser as a sort of pet project. Of course, I immediately googled to see what other people had done in this area. Most of the demos are a few years old. Many of the packages either don't work anymore or are (in my opinion) needlessly complex. The tag doesn't seem to support anything which allows me to access the audio data as it plays.

Does anyone know if a simple way has come about which someone can create an event callback which fires every time new audio data starts playing within a given waveform?

Unfortunately the Mozilla Audio Data API doesn't seem to be supported in Chrome (which is the primary browser I like to use). None of the events properly register and they never fire.

I'd really prefer to not have to reverse engineer stuff like this when all I want to do is create a very simple waveform display.

Any advice/recommendations for simple libraries or functions which I may not be finding would be much appreciated! I promise I've googled this for a few days now without finding any good, obvious solutions!

1
"callback which fires every time a new audio data starts playing within a given waveform", what does this mean? Also, what you are trying to do is complex, so stop thinking that what you are finding is "needlessly" complex.Brad
I'm used to being able to do it in an environment like LabVIEW or .NET where the code is fairly straight forward (especially in LabVIEW). What that means is that given a set of N samples is sent to the sound card to be produced by hardware, I want access to those N samples before (or while) they are sent.user986122
So, you want to get the data post-codec processing, pre-sound card buffer? The raw PCM samples sent for playback?Brad
Exactly! Sorry I wasn't clear. I would, ideally, like an array of floats representing the amplitude of each sample in the waveform being played (bonus if I have an index which represents the current offset in the waveform).user986122
The example you posted has excellent comments for what is going on. I recommend starting there.Brad

1 Answers

1
votes

You want the web audio API (HTML5 rocks tutorial) which unfortunately is only partially supported in Firefox, Chrome and Safari currently.

No doubt the Mozilla audio API has helped to shape the W3 proposal but is now deprecated in favour, I'm guessing, of the implementation of the emerging W3 standard.