Skip to main content

Generate Chladni plate resonant pattern signatures from WAV audio waveforms using Fourier peak frequency estimation

Project description

WAV → Fourier → Chladni Pattern

An interactive tool to analyze WAV audio files, perform discrete Fourier analysis to extract dominant peak frequencies, and map those peaks to physical resonant modes on a square Chladni vibrating plate.

curl -fsSL https://raw.githubusercontent.com/ganidhu/wav-fourier-chladni/master/install.sh | bash

For the mathematical background of plate vibration models, see this paper on Chladni Plates.

Project Structure

  • voca-spectral.py — The main interactive Python pipeline script (3-step TUI: input selection, Fourier peak analysis, and visualizer exporting).
  • fourier_analysis.html — Dynamic HTML report template displaying audio waveform and FFT spectrum charts (Chart.js).
  • chladni_simulator.html — Interactive 2D vibrating plate simulator displaying nodal sand patterns corresponding to the wave equation.
  • fourier_transform_analysis.md — Document summarizing Fourier transform calculations and eigenvalue mapping.

Features

  • WAV Audio Analysis — Parse 16-bit PCM mono WAV waveforms and compute dominant peak frequencies using discrete Fourier analysis.
  • Mac-Native UI Dialogs — Native macOS file picker window dialogs (osascript) for importing audio and selecting export folders, with terminal fallback prompts for Windows/Linux.
  • Immediate Validation — Immediate WAV format parsing and corruption checks during step 1 before starting computation.
  • Vector SVG Exports — Generate resolution-independent SVG designs of the resulting nodal sand patterns for graphic/branding usage.
  • Portable Web Visualizers — Export standalone HTML dashboards to inspect audio waveforms, FFT spectra, and simulated 2D plate nodal lines.
  • Zero External Python Dependencies — Built entirely on the standard Python library (no numpy/scipy/matplotlib required to run the core script).

Advanced Wave Mechanics

This project models Chladni sand patterns using Cartesian standing wave solutions of the multi-dimensional wave equation.

The Cartesian Wave Equation

For a square vibrating plate $\Omega = {(x,y) \in \mathbb{R}^2 \mid -L \le x, y \le L}$, the displacement $u(x, y, t)$ is modeled by:

$$u_{tt} = c^2\nabla^2u = c^2\left(\frac{\partial^2u}{\partial x^2} + \frac{\partial^2u}{\partial y^2}\right)$$

Assuming clamped boundary conditions at the edges, the standing wave solutions (eigenmodes) can be approximated by:

$$u(x, y, t) = \sum_{n=1}^{\infty}\sum_{m=1}^{\infty} w_{nm} \cdot \left(\sin\left(\frac{n\pi x}{L}\right)\sin\left(\frac{m\pi y}{L}\right) + \beta\sin\left(\frac{m\pi x}{L}\right)\sin\left(\frac{n\pi y}{L}\right)\right)\cos(\omega_{nm} t)$$

Where:

  • $n, m$ are the integer mode parameters (eigenvalues).
  • $w_{nm}$ is the weight of each mode, mapped directly from the dominant audio frequency amplitudes computed via Fourier analysis.
  • $\beta$ is the symmetry factor (typically $\pm 1$ for square plates).
  • The sand particles accumulate at the nodal lines where the plate displacement is zero, i.e., $u(x,y,t) \approx 0$.

Installation & Running

Since the core pipeline runs entirely on the Python standard library, there are no third-party Python libraries to install.

1. One-Line Installer (macOS & Linux)

You can install and verify the tool globally in one line using curl:

curl -fsSL https://raw.githubusercontent.com/ganidhu/wav-fourier-chladni/master/install.sh | bash

2. Manual Global Installation

You can also install the tool manually from PyPI using one of the following methods:

Option A: Standard pip

pip install wav-fourier-chladni --break-system-packages

(Note: The --break-system-packages flag is required on macOS Homebrew Python installations to allow global CLI scripts).

Option B: Using pipx (Recommended for macOS/Linux)

pipx automatically manages isolated virtual environments for CLI tools:

# Install pipx (if not already installed)
brew install pipx

# Install the package
pipx install wav-fourier-chladni

Once installed via either option, launch the program globally from any directory:

wav-fourier-chladni

2. Alternative: Run the source script directly

If you do not want to install it globally, you can clone the repository and run the script directly:

python3 wav_fourier_chladni/cli.py

3. Prerequisites (Optional)

To run the core analysis and visualizers, you only need Python 3 installed.

  • macOS: brew install sox or ensure ffmpeg is in your system path.
  • Linux: sudo apt install alsa-utils (for arecord) or sox.

4. Uninstallation

To remove the package from your system:

  • If installed via pipx:
    pipx uninstall wav-fourier-chladni
    
  • If installed via pip:
    pip3 uninstall wav-fourier-chladni --break-system-packages
    

The script will guide you through:

  1. Audio Selection: Pick a WAV file using a native macOS window picker or record live from the microphone.
  2. Analysis: Performs the discrete Fourier calculations.
  3. Resonant Signatures: Renders an ASCII art preview of the pattern in the terminal, and lets you choose to export SVG files or HTML dashboards.

🤝 Contributing

Got ideas? Found a bug?

PRs and issues are very welcome! This is a community tool and it gets better when more people chip in. Even small improvements — better selectors, new step actions, docs fixes — make a real difference.

Open an issue or just submit a PR. Let's build it together. 🙌


📄 License

MIT


Built by Ganidhu and Baymax

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wav_fourier_chladni-1.2.1.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wav_fourier_chladni-1.2.1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file wav_fourier_chladni-1.2.1.tar.gz.

File metadata

  • Download URL: wav_fourier_chladni-1.2.1.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for wav_fourier_chladni-1.2.1.tar.gz
Algorithm Hash digest
SHA256 abd5e906bc13e35290fb19c509624800044d4366d64aebe4f7237e16c940d54c
MD5 6f7946416a03ed2d03e9ef3b7d3acd00
BLAKE2b-256 40dd2ae00177d6ce4dd940cca2ffd8ca863c78aa9fafd977a2dfde8fbb567123

See more details on using hashes here.

File details

Details for the file wav_fourier_chladni-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wav_fourier_chladni-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9fb8e1f1b506668d801272af7b07d4f7aeede790408063520b2ad9ad8e1be8a7
MD5 8f4ec0a31d999b186e1ca52f245a8239
BLAKE2b-256 566847e3bf218513f454bece510490d52a223809b46cf033025d2f07e1470ef5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page