generativefm / generative.fm

A platform for playing generative music in the browser.
https://generative.fm
MIT License
1.59k stars 86 forks source link

High CPU usage #206

Closed charliebarber closed 3 years ago

charliebarber commented 4 years ago

Using the website in Firefox has made my FirefoxCP Web Content CPU usage at 50% and making my fans quite noisy.

alexbainter commented 4 years ago

Hi @charliebarber. This is an unfortunate limitation of doing real-time audio processing with JavaScript and the Web Audio API. Reverb effects are especially hard on CPU usage, and I use reverb on basically everything on the site.

I'm still learning how to deal with this. Eventually I'll probably have to start writing all my systems in a different language, compile them to WebAssembly, and run them in AudioWorklets. I've also recently had good results with prerendering reverb effects on audio samples before starting the piece, and scheduling those instead of applying reverb effects live in real-time. Oxalis 1 uses this technique and should use far less of your CPU than most other pieces. You might have better luck with some of the other pieces too.

Thanks for bringing this up. Sorry that there's not much I can do about it right now! I'm planning on continuing to prerender stuff in future pieces so hopefully new ones won't use as much CPU.

alexbainter commented 3 years ago

Hi again @charliebarber. I just released v1.36.0 which should significantly reduce your CPU usage for many pieces.

alexbainter commented 3 years ago

I've heard a lot of feedback indicating this is no longer an issue, so closing this.