Scale illusion

Interleave an ascending and descending major scale between ears so listeners regroup the notes by pitch.

npx web-audio-api scale-illusion 200 261.63 8s
tempo=<bpm>
scale note tempo
root=<hz|note>
frequency or note name in the CLI (default: 261.63)
-d, --duration <time>
run time (CLI accepts s/m/h suffixes; default: 8s)
ready

This renders Deutsch's scale illusion: an ascending and a descending major scale are interleaved between the ears, and most listeners regroup the notes by pitch instead of by ear, hearing two smooth contours rather than the actual jagged ones. Play it in the browser over headphones, or render the same interleaved scale from the Node CLI.