This commit is contained in:
Fireblade 2025-02-11 22:36:19 -05:00
parent 45cdb607e6
commit 5cc9d140fe
3 changed files with 25 additions and 1 deletions

24
Test.py Normal file
View file

@ -0,0 +1,24 @@
import requests
response = requests.get("http://localhost:8880/v1/audio/voices")
voices = response.json()["voices"]
# Generate audio
response = requests.post(
"http://localhost:8880/v1/audio/speech",
json={
"model": "kokoro",
"input": "http://localhost:8880/web/",
"voice": "af_heart",
"response_format": "mp3", # Supported: mp3, wav, opus, flac
"speed": 1.0,
"normalization_options": {
"normalize": True
}
}
)
# Save audio
with open("output.mp3", "wb") as f:
f.write(response.content)

View file

@ -174,7 +174,7 @@ class AudioService:
del AudioService._writers[writer_key]
return final_data if final_data else b""
return chunk_data if chunk_data else b""
return chunk_data if chunk_data else b"", audio_chunk
except Exception as e:
logger.error(f"Error converting audio stream to {output_format}: {str(e)}")

BIN
output.mp3 Normal file

Binary file not shown.