feat(voice/clone): support MP3 and other audio formats for reference voices (#20)
## Summary - Adds support for MP3, FLAC, OGG, and other audio formats when uploading reference voices for cloning - Replace WAV-only `audio_read()` with a `soundfile`-based implementation - Update web UI file picker to accept multiple audio formats ## Changes - `pocket_tts/data/audio.py`: Use `soundfile` library instead of Python's `wave` module - `pocket_tts/main.py`: Preserve original file extension in temp files for format detection - `pocket_tts/main.py`: Add missing `truncate=True` to CLI generate command - `pocket_tts/static/index.html`: Update file input to accept `.wav,.mp3,.flac,.ogg,.m4a,audio/*` - `pyproject.toml`: Add `soundfile>=0.12.0` dependency ## Tested - [x] Upload a WAV file as reference voice and generate speech - [x] Upload an MP3 file as reference voice and generate speech - [x] Upload a FLAC file as reference voice and generate speech - [x] Verify CLI `--voice` option works with MP3 files --------- Co-authored-by: Gabriel de Marmiesse <gabrieldemarmiesse@gmail.com> Co-authored-by: Václav Volhejn <8401624+vvolhejn@users.noreply.github.com>
This commit is contained in:
co-authored by
Gabriel de Marmiesse
Václav Volhejn
parent
6f9dd250c2
commit
bedd1c4098
@@ -51,16 +51,16 @@
|
||||
|
||||
<div class="bg-white p-4 rounded-lg shadow">
|
||||
<label for="voice-wav-input" class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Or upload a WAV file for voice cloning:
|
||||
Or upload an audio file for voice cloning:
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
id="voice-wav-input"
|
||||
class="w-full border rounded p-2"
|
||||
accept=".wav,audio/wav"
|
||||
accept=".wav,.mp3,.flac,.ogg,.m4a,audio/*"
|
||||
/>
|
||||
<p class="text-xs text-gray-500 mt-1">
|
||||
Upload a WAV file to use as voice reference. Takes precedence over voice URL.
|
||||
Upload an audio file (WAV, MP3, FLAC, etc.) to use as voice reference. Takes precedence over voice URL.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user