block by alexmacy c287489c4925719821a108006a9362d5

Compound Radial Waves v3 [WARNING: LOUD!]

Full Screen

This is a big update from the previous version, including the addition of sound!

Please note that this is part of an ongoing series of experiments. While it should run smoothly in Chrome, it hasn’t been optimized for other browsers at this time.

Previous blocks in this series:

One note on the sound synthesis: I started with generating the sound for the compound wave by calculating each sample and pushing it to the sound buffer. The idea being that it would be a more ‘pure’ demonstration of how sound waves interact by synthesizing the sound using an algorithm rather than using Web Audio’s built-in oscillators. But this was causing a lot of problems. Namely, the longer waves would never be able to fit in the buffer unless treated like a queue - but that was causing a lot of clipping when changing the frequencies due to difficulties ensuring that the waves meet at a zero crossing point. The workaround for this was to just use the built-in oscillator.

All that said, the end result is ultimately the same since the sound generated by the oscillators gets combined when it goes to the AudioDestinationNode.

Other features include:

I chose to only use three oscillators because more than that can cause the drawn compound wave to be too busy. But there’s a hidden feature for adding more oscillators by running addNewOsc() in the console. This is included for stress-testing and exploring more complex combinations.

index.html