iDad5 Posted June 13, 2021 Share Posted June 13, 2021 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. Link to comment Share on other sites More sharing options...
OSUblake Posted June 13, 2021 Share Posted June 13, 2021 If you already know what audio files are going to be used, then I would just precompute all the data you need upfront. If that's not possible, then you'll probably have better luck with this question on StackOverflow. Sorry I can't be of more help. 1 Link to comment Share on other sites More sharing options...
iDad5 Posted June 14, 2021 Author Share Posted June 14, 2021 @OSUblake thank you for taking the time. Precompiling isn't a real option, even though I'm considering a way to compute in the uploading browser and storing on the server. That approach has many downsides though and I'm not sure if it's worth it. I tried my luck on StackOverflow a day before posting here, but the only thing I got was one down-vote and no answers so far... But I knew it was a long shot. Thx! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now