Spaces:
Running on Zero
Running on Zero
| title: Marine Soundscape Analyzer | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: indigo | |
| sdk: gradio | |
| sdk_version: 5.23.3 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| short_description: Coral reef acoustic analysis | |
| # π Marine Soundscape Analyzer | |
| A comprehensive acoustic analysis tool for **marine and coral reef hydrophone recordings**. | |
| ## Features | |
| Upload any audio file (WAV, MP3, FLAC, OGG, AIFF) and get: | |
| | Tab | Content | | |
| |-----|---------| | |
| | π Waveform | Time-domain signal with amplitude envelope | | |
| | π Spectrograms | Linear, Mel-scale, and Log-frequency spectrograms | | |
| | π‘ Frequency Analysis + MFCC | Power Spectral Density (Welch), spectral centroid over time, MFCC heatmap | | |
| | 𧬠Acoustic Indices | ACI, BI, NDSI, ADI, RMS β all shown as time-series bars | | |
| | π Temporal Features | Spectral bandwidth, rolloff, flatness, ZCR, onset detection, MFCC delta | | |
| | π Report | Full markdown report with all statistics and index interpretations | | |
| ## Acoustic Indices | |
| | Index | Reference | What it measures | | |
| |-------|-----------|-----------------| | |
| | **ACI** β Acoustic Complexity Index | Pieretti et al. 2011 | Temporal variation in spectral amplitude; higher = more complex soundscape | | |
| | **BI** β Bioacoustic Index | Boelman et al. 2007 | Energy in the 2β8 kHz biological band | | |
| | **NDSI** β Normalized Difference Soundscape Index | Kasten et al. 2012 | Ratio of biotic (2β11 kHz) to anthropogenic (1β2 kHz) energy | | |
| | **ADI** β Acoustic Diversity Index | Villanueva-Rivera et al. 2011 | Shannon diversity across frequency bands above a threshold | | |
| | **Hf** β Spectral Entropy | Sueur et al. 2008 | Uniformity of energy across frequencies; 0 = tonal, 1 = white noise | | |
| | **Ht** β Temporal Entropy | Sueur et al. 2008 | Uniformity of energy over time; 0 = impulsive, 1 = stationary | | |
| | **H** β Total Acoustic Entropy | Sueur et al. 2008 | Combined soundscape heterogeneity (Hf Γ Ht) | | |
| ## Marine Coral Reef Context | |
| | Frequency Band | Range | Typical Sources | | |
| |----------------|-------|-----------------| | |
| | Low | 20 β 1,000 Hz | Fish choruses, breaking waves, vessel traffic | | |
| | Snapping Shrimp | 1 β 5 kHz | *Alpheid* snapping shrimp β key reef health indicator | | |
| | High Biotic | 5 β 20 kHz | Small crustaceans, urchins, high-frequency fish sounds | | |
| Snapping shrimp produce a characteristic broadband crackling that can be heard throughout the 1β20 kHz range. Healthy reefs typically show **high ACI, positive NDSI, and elevated energy in the snapping-shrimp band**. Degraded reefs tend to be quieter, with lower ACI and flatter spectra. | |
| ## Example Recordings | |
| The app ships with example recordings from the project data folder: | |
| - π¦ Snapping Shrimp | |
| - π¦ Ghost Crab: Gastric Mill Stridulation | |
| - π Humpback Whale Song | |
| - π Red Grouper Vocalization | |
| ## Running Locally | |
| ```bash | |
| pip install -r requirements.txt | |
| python app.py | |
| ``` | |
| ## Deploying to Hugging Face Spaces | |
| 1. Create a new **Gradio** Space on [huggingface.co/spaces](https://huggingface.co/spaces). | |
| 2. Upload `app.py` and `requirements.txt` to the Space repository. | |
| 3. (Optional) Add audio example files under `data/` in the Space repo β the app will auto-detect them. | |
| ## References | |
| - Pieretti N., Farina A., Morri D. (2011). A new methodology to infer the singing activity of an avian community: The Acoustic Complexity Index (ACI). *Ecological Indicators*. | |
| - Boelman N.T., et al. (2007). Multi-trophic invasion resistance in Hawaii: bioacoustics, field surveys, and airborne remote sensing. *Ecological Applications*. | |
| - Kasten E.P., et al. (2012). The remote environmental assessment laboratory's acoustic library: An archive for studying soundscape ecology. *Ecological Informatics*. | |
| - Villanueva-Rivera L.J., et al. (2011). A primer of acoustic analysis for landscape ecologists. *Landscape Ecology*. | |
| - Sueur J., Pavoine S., Hamerlynck O., Duvail S. (2008). Rapid acoustic survey for biodiversity appraisal. *PLOS ONE*. |