News for hackers. Stuff that matters.

sapiogenesis

Re:Variable duty cycle square waves with the Web Audio API on Tuesday April 15, 2025 @03:57AM (#43690135)
If you worked with Web Audio, what is for you “toy” quality and what do you mean hard to push past it, specifically?
Web Audio is awesome and IMHO people who got the spec out and pushed for implementation deserve lots of respect. You want to make a tracker that runs in your browser and you have all the primitives at your disposal to make it work? A few years ago I wouldn’t imagine it can be possible.

Looking forward to seeing the tracker some time!

I agree. There’s a bit of mental overhead related to working with audio worklets (you have to load them from an URL or a blob URL, etc.) but for square waves in particular the logic should be fairly straighforward, the process function just needs to output 1 or -1 for any given sample.
To my ears it sounded like 25% and 75% duty cycles were 50%, and 50% sounded like a shorter one, but not sure.