Skip to content

feat(audio): add soundfile fast path for WAV/FLAC decoding#1412

Open
eschmidbauer wants to merge 1 commit intoSYSTRAN:masterfrom
eschmidbauer:master
Open

feat(audio): add soundfile fast path for WAV/FLAC decoding#1412
eschmidbauer wants to merge 1 commit intoSYSTRAN:masterfrom
eschmidbauer:master

Conversation

@eschmidbauer
Copy link

The existing PyAV-based decode_audio() has significant overhead:

  • Creates AudioResampler for every file
  • Calls gc.collect() after each decode
  • Uses FFmpeg pipeline even for simple WAV files

This adds a fast path using soundfile (libsndfile) that:

  • Reads WAV/FLAC files directly without FFmpeg overhead
  • Falls back to PyAV for unsupported formats or file-like objects
  • Provides 10-100x speedup for batch transcription workloads

Tested on 1M synthetic audio files where decode time dropped from
6-45 seconds per file to milliseconds.

Requires: pip install soundfile (optional, graceful fallback if missing)

@MahmoudAshraf97
Copy link
Collaborator

how long were the files included in the 1M test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants