31 ms·
I'm also working on a gameboy inspired music app! (for Android, in Rust) If you use a perfect square wave, the aliasing is extremely audible and sounds terribl
by SonOfLilit 2y ago
I'm also working on a gameboy inspired music app! (for Android, in Rust)
If you use a perfect square wave, the aliasing is extremely audible and sounds terrible.
As far as I can tell, in native everyone uses a nifty algorithm called bank-limited audio synthesis, and specifically blargg's implementation blip_buf.
https://slack.net/~ant/bl-synth/ https://slack.net/~ant/bl-synth/
If I were OP I'd try to compile the rust port of this library to WASM.
- iamdan 2y agoThat's sweet! I'm trying to see how far I can push the web audio api but yeah the aliasing can be harsh. I think there are also some things I can do with filter nodes to smooth things out a bit
- meindnoch 2y agoThe aliased harmonics are folded back and mixed with the true harmonic content of the square wave. You can't filter them out without significantly affecting the square wave sounds.
- SonOfLilit 2y agoYou can work in a much higher sample rate and then downsample
- sapiogenesis 2y ago[dead]