HNHacker News
TopNewBestAskShowJobs

sapiogenesis

4 karma · joined April 7, 2025

submissionscomments
sapiogenesis··on Variable duty cycle square waves with the Web Audio API
If you worked with Web Audio, what is for you “toy” quality and what do you mean hard to push past it, specifically?
sapiogenesis··on Variable duty cycle square waves with the Web Audio API
Thanks! I’m very familiar with the first one, but never thought of the second one actually.
sapiogenesis··on Variable duty cycle square waves with the Web Audio API
25% and 75% would sound identical alone, but in a mix there often are interplays where it can create a difference. An easy way to hear it is to run two synced oscillators, say a square and a saw, with sharp attack. The resulting sound should be sufficiently different, one side would dampen the attack compared to the other. Furthermore, I think in hardware synths and those that emulate them changing pulse width can cause the module to implicitly shift the signal up or down to ensure consistent average voltage, further complicating things. I am curious what you mean by compression.
sapiogenesis··on Variable duty cycle square waves with the Web Audio API
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!

sapiogenesis··on Variable duty cycle square waves with the Web Audio API
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.
sapiogenesis··on Variable duty cycle square waves with the Web Audio API
To my ears it sounded like 25% and 75% duty cycles were 50%, and 50% sounded like a shorter one, but not sure.