Audio Tone Generator
← Project Index Audio Tone Generator

Audio Tone Generator

An audio tone generator for brain/auditory experiments -; generates pure sine tones or binaural beats through the default audio output. A quick script for experimenting with auditory frequency response via EEG.

Archived Started: 2026 Updated: Apr 2026

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:

left = sin(2π · base · t)  ···  right = sin(2π · (base + beat) · t)

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.