Skip to content

Commit fd1412e

Browse files
authored
feat(external): add WaveSurfer audio widget demo (#41)
## Summary Adds an interactive audio waveform widget demo using wavesurfer.js and anywidget. Note: If the idea of the notebook is relevant - i'll be happy to work on it - otherwise - you can reject it and close it. I could try to use https://github.com/pengzhendong/wavesurfer instead of the directly the js library. ## Features - 🎵 **Interactive Waveform**: Draggable/resizable regions for audio segment annotation - ⏩ **Playback Speed**: 7 speed options (0.5x - 2.0x) for transcription/analysis - 🎹 **Synthetic Audio**: Self-contained with multi-pitch A major chord sample - 📁 **File Upload**: Optional upload support (MP3/WAV/OGG/M4A) - 🔄 **Bidirectional Sync**: Python ↔ JavaScript state via traitlets - 📊 **Table Integration**: Two-way sync between table and waveform - 📥 **Export**: JSON export of annotated regions ## Use Cases - Audio transcription and annotation - Podcast chapter marking - Music analysis (verse/chorus identification) - Language learning with sentence-level audio alignment - Torah reading verse boundary alignment ## Technical Details - **Widget Framework**: anywidget (portable across Jupyter/marimo) - **Audio Library**: wavesurfer.js v7 (loaded from CDN) - **Dependencies**: PEP 723 compliant (marimo, anywidget, traitlets, numpy) - **Self-Contained**: Generates 5-second synthetic audio (A4/C5/E5 chord) - **Size**: 18KB, 17 cells, ~600 lines - **Python**: 3.12+ compatible ## Testing - [x] \`uvx marimo check\` passes - [x] Session metadata generated successfully - [x] Notebook runs without errors - [x] All interactive features tested
1 parent ff9d401 commit fd1412e

2 files changed

Lines changed: 864 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)