Inspiration

Math textbooks, homework platforms, and classroom whiteboards rely heavily on visual curves. When a sighted student looks at $f(x) = \sin(x) \cdot x$, they immediately see waves growing taller and crossing the axis. A blind or low-vision student often receives only the raw equation—missing where the curve peaks, dips, crosses zero, or breaks at an asymptote. Tactile embossers are expensive and cannot update live, and standard screen readers cannot convey the continuous shape of a curve.

We built Graphsong so any student with headphones and a browser can hear the shape of a function and read or listen to a computed plain-English summary.

What it does

Graphsong runs 100% client-side with zero backend, zero sign-up, and no data leaving the browser:

  • Safe Equation & CSV Input: Type any function of $x$ (such as x^2, sin(x), 1/x, e^x, or sin(x) * x) or paste an $x, y$ CSV table.
  • Stereo Sonification: Sweeps $x$ from left to right, panning stereo position across the headphones. Higher $y$ values produce higher pitches, percussive clicks mark zero crossings, and a low 92 Hz tone signals undefined points or asymptotes.
  • Computed Plain-Word Descriptions: Detects zeros, local maxima and minima, asymptotes, and overall trends using numerical analysis, then announces a 2–3 sentence summary in an aria-live="polite" region and Key facts panel.
  • Step-Through Exploration: Use the Left / Right arrow keys to move point by point and hear "x = 2, y = 4, rising".
  • Compare Mode ($f$ vs. $g$): Play $f(x)$ in the left ear and $g(x)$ in the right ear simultaneously, with a distinct two-tone chime wherever the curves intersect.
  • Hear the Derivative: Toggle slope audio so a rising pitch means increasing, falling means decreasing, and a flat middle tone marks peaks and valleys.
  • 6 Guided Lessons: Keyboard-accessible interactive audio quizzes covering linear, quadratic, sine, exponential, reciprocal ($1/x$), and absolute value functions.
  • Accessibility First: Built with Atkinson Hyperlegible typography, 52px minimum targets, 4px gold focus outlines, High Contrast mode, Dark mode, and prefers-reduced-motion support.

How we built it

  1. Safe AST Parsing (mathjs): Every expression is parsed into an abstract syntax tree and checked against an allowlist of math symbols and functions—never eval or Function.
  2. Numerical Analysis: We sample 201 points across $[x_{\min}, x_{\max}]$, detect sign changes, refine roots and $f(x) = g(x)$ intersections via bisection, compute central-difference slopes $\frac{dy}{dx}$, and classify trends in pure TypeScript.
  3. Logarithmic Pitch Mapping (Web Audio API): Each valid $y$ value is mapped onto a logarithmic frequency scale between $f_{\min}$ (200 Hz default) and $f_{\max}$ (1000 Hz default):

$$f(y) = f_{\min} \cdot \left(\frac{f_{\max}}{f_{\min}}\right)^{\frac{y - y_{\min}}{y_{\max} - y_{\min}}}$$

  1. Stack: React 19, TypeScript, Vite, React Router, mathjs, Web Audio API (OscillatorNode, StereoPannerNode, GainNode), Web Speech API (speechSynthesis), and Vitest.

Challenges we ran into

  • Asymptotes vs. zero crossings: On $f(x) = \frac{1}{x}$, $y$ jumps from a large negative value to a large positive value across $x = 0$. A naive sign-change check would mark $x = 0$ as a zero crossing. We solved this by comparing adjacent jump magnitudes against the curve's span to flag asymptotes separately.
  • Audio–visual sync: Keeping the moving gold sweep cursor aligned with Web Audio playback required driving requestAnimationFrame directly from AudioContext.currentTime.
  • Bundle size: mathjs is large, so we lazy-loaded the /app player route with React.lazy and Suspense to keep the landing page bundle fast.

What we learned

  • Designing for keyboard-only and screen-reader users first (aria-live, focus rings, 52px targets, and no auto-play audio) makes the entire interface cleaner for everyone.
  • Stereo panning plus distinct oscillator timbres (sine vs. triangle) makes comparing two equations intuitively audible without needing to look at the screen.

What's next

  • Exportable tactile-ready SVG sheets for classroom embossing.
  • Multi-language spoken descriptions.

AI-assisted development disclosure: Google Antigravity was used to assist with scaffolding, refactoring, and writing unit tests, as documented in our README.md.

Built With

Share this project:

Updates

Submission history