←
LCA-2
Created: 2025-12-21
•
Updated: 2025-12-21
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-21
Implemented audio utilities module:
**Created files:**
- `src/librechat_audio/utils/__init__.py` - Package exports
- `src/librechat_audio/utils/audio.py` - Audio format utilities
**Key functions:**
- `normalize_format()` - Normalizes format strings (case, leading dots, whitespace)
- `is_supported_input_format()` - Validates STT input formats (flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm)
- `is_supported_output_format()` - Validates TTS output formats (mp3, opus, aac, flac, wav, pcm)
- `get_content_type()` - Returns MIME type for audio format
- `get_file_extension()` - Returns file extension with leading dot
- `get_audio_format()` - Detects format from magic bytes or filename
**Test results:**
- 73 new tests in `tests/test_audio_utils.py` - all passing
- Full test suite (191 tests) - all passing
**Verification:**
- All format constants match OpenAI Audio API spec in `docs/openai-audio-api-spec.md`
- Magic byte detection tested for MP3, FLAC, WAV, OGG, WebM