Inspiration
Mathematics is usually experienced visually: equations, graphs, numbers, and symbols. We wanted to explore another question: what if mathematical behavior could be heard?
Freq-Math was created from the idea of turning abstract mathematical expressions into something perceptual and tangible through sound. Instead of treating an equation as only a calculation, Freq-Math treats it as a signal that can be explored through audio, waveforms, and frequency spectra.
The goal was to build a bridge between mathematics, signal processing, and auditory perception—making equations something you can not only calculate, but also listen to and analyze.
What it does
Freq-Math is a mathematical equation sonifier.
You provide a mathematical expression such as:
"sin(2*pi*x*5 + 3*sin(2*pi*x*0.5))"
and Freq-Math evaluates the expression and transforms its mathematical behavior into sound.
It provides:
- Advanced mathematical expression parsing
- Real-time equation evaluation
- Secure AST-based validation
- Implicit multiplication and mathematical notation support
- Multiple audio synthesis methods including FM, AM, phase distortion, wavetable, and direct mapping
- Real-time waveform and frequency-spectrum visualization
- Audio analysis including RMS, peak, crest factor, and zero-crossing rate
- WAV export
- GUI, CLI, and Python API interfaces
- Cross-platform support
- C++ and Python integration
This makes Freq-Math useful for mathematical experimentation, education, signal exploration, and creative sound design.
How we built it
Freq-Math uses a hybrid C++/Python architecture.
The performance-critical mathematical layer is implemented in C++, including equation tokenization, parsing, compilation to RPN bytecode, evaluation, and audio/DSP operations.
Python handles higher-level functionality such as:
- Audio synthesis
- Visualization
- GUI interaction
- API access
- Command-line workflows
The two layers communicate through pybind11 bindings.
The system is organized around several core components:
Equation Parser → Math Compiler/Evaluator → Audio Mapping → Visualization/Analysis
Security was also designed into the mathematical engine. Rather than executing arbitrary expressions, equations are validated through an AST-based, whitelist-oriented approach, avoiding unrestricted "eval()"/"exec()" execution.
For performance, the project incorporates techniques such as caching, parallel processing, zero-copy operations, and SIMD-oriented optimization.
Challenges we ran into
One of the biggest challenges was that an equation parser cannot simply interpret mathematical text as ordinary Python code. Mathematical notation introduces its own problems: implicit multiplication, functions, constants, operators, parameters, and different representations of the same concept.
Another challenge was connecting mathematical values to meaningful audio behavior. A mathematical function can be mapped directly to samples, but different synthesis techniques can produce dramatically different results. This led to multiple mapping strategies such as FM, AM, phase distortion, wavetable, and direct synthesis.
Performance was another major consideration. Audio generation requires processing large numbers of samples while maintaining responsiveness, so the project separates high-performance numerical work from the higher-level Python interface.
Finally, allowing users to enter equations created a security problem: mathematical expressions need to be evaluated without turning user input into arbitrary code execution. This motivated the dedicated validation and controlled evaluation architecture.
Accomplishments that we're proud of
We're proud that Freq-Math evolved beyond a simple equation-to-sound experiment into a complete mathematical sonification system.
The project combines:
- A custom mathematical parsing and evaluation pipeline
- A C++23 performance backend
- Python-based synthesis and visualization
- Multiple DSP synthesis modes
- Real-time mathematical, waveform, and spectral visualization
- GUI, CLI, and programmatic APIs
- Security-conscious expression evaluation
- Automated building and testing infrastructure
- Cross-platform design
Most importantly, Freq-Math demonstrates that a mathematical expression can become more than a number or graph—it can become an auditory representation of mathematical behavior.
What we learned
We learned that building an interdisciplinary system requires thinking about the boundaries between domains.
Mathematics determines the underlying structure, signal processing determines how that structure becomes sound, and software architecture determines whether the whole system can operate efficiently and safely.
We also learned the importance of separating concerns. Keeping parsing, evaluation, synthesis, visualization, and interfaces modular made it possible to experiment with each part without redesigning the entire system.
Perhaps the biggest lesson was that computation can be represented through multiple senses. A graph shows what an equation looks like; sonification provides another way to perceive its behavior.
What's next for Freq-Math
The next stage is to push Freq-Math further toward a broader mathematical exploration and sonification platform.
Future directions include:
- More advanced mathematical and symbolic operations
- Expanded synthesis and DSP techniques
- Better interactive visualization
- More sophisticated equation-to-sound mappings
- Expanded Python/C++ APIs
- Improved educational workflows
- More performance optimization
- Additional analysis and signal-processing tools
- Larger preset and experiment libraries
- More extensive automated testing and benchmarking
The long-term vision is to make Freq-Math a tool where users can write mathematics, see mathematics, hear mathematics, and experiment with mathematics in the same environment.
Log in or sign up for Devpost to join the conversation.