Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AcoustoPulse

Bioacoustic soundscape ecology & automated acoustic threat localization engine. Built with Next.js 14 (App Router, TypeScript), Tailwind CSS, Lucide React, and the Web Audio API.

What it does

AcoustoPulse listens to an audio source (your microphone, or one of three procedurally-synthesized demo tracks) and:

  1. Scores ecosystem health in real time via the Normalized Difference Soundscape Index (NDSI): (biophony − anthrophony) / (biophony + anthrophony), comparing energy in the 2–8 kHz biophony band against the 1–2 kHz anthrophony band.
  2. Detects acoustic threats (chainsaws, engines) as sharp transient spikes in the anthrophony band.
  3. Pinpoints the threat's location using Time Difference of Arrival (TDoA) multilateration across a 3-node sensor array, solved with iterative Gauss-Newton least squares over a local tangent-plane projection.

Everything runs client-side. There are no external audio assets and no map tile / API-key dependencies — the app is fully usable offline, which matters a lot for a live hackathon demo.

Project structure

src/
  lib/
    audioEngine.ts   Web Audio graph, FFT extraction, NDSI + transient detection,
                      synthetic demo-track synthesis (oscillators + filtered noise)
    tdoaSolver.ts     Geodetic <-> local ENU projection, Gauss-Newton TDoA solve,
                      GDOP-based accuracy estimate, synthetic arrival-time helper
  components/
    Spectrogram.tsx   Canvas waterfall spectrogram (log frequency axis, heatmap)
    NDSIGauge.tsx      SVG speedometer for the live NDSI score
    ThreatMap.tsx      Custom SVG tactical/radar map (see note below)
    AudioControls.tsx Source selection: live mic or one of 3 demo tracks
  app/
    page.tsx           Dashboard shell wiring everything together
    layout.tsx, globals.css

Design decision: custom SVG map instead of Mapbox/Leaflet

The spec called for Mapbox GL JS / Leaflet. Both require either a paid API key (Mapbox) or live tile-server internet access (Leaflet + OSM) — either of which can silently fail mid-demo on hackathon wifi, and neither is compatible with the "works 100% offline out-of-the-box" requirement given for the audio layer. Since the actual need is a small local tactical picture (three fixed nodes + one computed target within a ~1km aperture), ThreatMap.tsx instead renders a self-contained SVG radar/topo view driven by the same equirectangular projection used by the TDoA solver. It has zero network dependency, zero API keys, and stays pixel-crisp at any size. If a real basemap is wanted later, the projection math in tdoaSolver.ts already produces plain (x, y) meters, so swapping in Mapbox/Leaflet later just means projecting through their coordinate system instead.

Running locally

npm install
npm run dev

Open http://localhost:3000. Click a demo track to hear/see it immediately — no microphone permission required. "Chainsaw Anomaly" will trigger a TDoA pinpoint alert on the map and log an incident within a few seconds.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages