4 ms·
A bit late to the party, but I had a similar idea a while back and built a prototype of this here: http://pilliq.com/companion http://pilliq.com/companion It's
by pilliq 2y ago
A bit late to the party, but I had a similar idea a while back and built a prototype of this here: http://pilliq.com/companion http://pilliq.com/companion
It's a "runtime" that executes arbitrary JS code while continuously playing a single tone. Every loop iteration increases the tone's frequency, and every recursive function call increases the tone's pitch (when the function returns, the tone's pitch is decreased).
* There are visual markers to show what is currently being executed
* You can increase or decrease the speed of playback
* You write your own code and execute it in the browser.
I included two examples of fibonacci: one that's iterative and one recursive. I think the audio/visual feedback helps you "feel" the difference of why the iterative implementation is faster than the recursive one.
It's a bit of a hack, and you may need to refresh the page after it finishes running through the code once.