This is (as of now) some-how of topic, but as here are so many knowledgeable people I thought I'd try.
I built as little tool to render the waveform of an audio file as svg (GSAP is very helpful there). It is nothing fancy so far but I would like to animate it and make it nice in the next steps.
The basics works well with smaller and medium files, but loading and working with large files on slower machines is a problem by nature.
As I have to load the whole file, parse the raw data into an array and shorten that to a workable one. The loading and calculation of the final array I need for display purposes would be the perfect occasion - in my opinion - to use a web worker. (I like the concept, but haven't had the need to use them yet.)
The problem is, that web workers have no access to the window object but I need the AudioContext to parse the raw data and AudioContext is a child of window. So I'm stuck there. Maybe someone with more experience with web workers can give me a hint how to overcome this, recommend an alternative approach or just inform me that there definitely is none.
Thanks a lot.