Overview
A small Python script that plays clean tones out of whatever audio device is default -; a single pure sine at a frequency you pick, or a pair of slightly detuned tones, one per ear, that the brain fuses into a perceived "binaural beat." Built as a quick bench tool for auditory and brainwave experiments, ideally through a decent pair of headphones.
How It Works
Waveforms are synthesized with NumPy at 44.1 kHz and pushed to the speakers via
sounddevice. Every tone gets a short 50 ms linear fade in and out so it
doesn't pop the speakers. A pure tone is just an amplitude-scaled sine; a binaural beat
builds a stereo signal where the left channel sits at the carrier frequency and the right
sits a few hertz above, so the difference is what you "hear" beating:
It runs either from the command line (-f frequency, -d
duration, --binaural BASE BEAT) or, with no arguments, drops into a little
interactive REPL where you can type frequencies, set volume, and list audio devices. A
helper maps any frequency to its conventional EEG band -; delta, theta, alpha, beta,
gamma -; which is the part that ties it to the brainwave-experiment use case.