Add multipart audio alignment endpoint - #391
Conversation
|
Tested and accepted. I ran the Docker image built from this PR and verified the new multipart endpoint with the project fixture The request was sent as The implementation matches the intended scope: dedicated upload route, required-field and WAV validation, in-memory audio decoding, task/mode checks, reuse of the existing alignment runtime, timing/sample-offset response fields, and updated documentation. All GitHub CI checks are passing. One non-blocking observation: the returned No blocking issues found. Accepted from my side — thank you! |
|
This is a very much needed feature, thank you |
Summary
Adds
POST /v1/audio/alignmentsfor forced alignment with uploaded audio bytes. This is the upload-based counterpart to/v1/tasks/runfor remote or Docker clients that cannot pass a server-local audio path.Request shape:
The endpoint requires
file,model, andtext;languageandbusy_timeout_msare optional. It only accepts WAV uploads for now and requires the selected model to be configured withtask=alignandmode=offline.Fixes #350.
Example Response
{ "text": "Some call me nature. Others call me Mother Nature.", "language": "English", "words": [ { "word": "Some", "start": 0.266667, "end": 0.64, "start_sample": 6400, "end_sample": 15360, "confidence": 0 } ], "timing": { "wall_ms": 123.0, "audio_duration_ms": 456.0, "rtf": 0.27 } }Validation
Built the debug server and validated multipart behavior with
assets/resources/sample.wav.200,words=25, first word includesstart,end,start_sample, andend_sample200,words=24, first word includesstart,end,start_sample, andend_sample400,audio alignment requests must use multipart/form-data400,multipart alignment request requires a non-empty 'file' field400,multipart alignment request requires a non-empty 'file' field400,multipart alignment request requires a 'model' field400,multipart alignment request requires a non-empty 'text' field400,only WAV audio uploads are currently supported for alignmentbusy_timeout_ms400,multipart busy_timeout_ms field must be an integerbusy_timeout_ms400,busy_timeout_ms must be >= 0 (0 means no client-side bound)400,unknown model id: missing-align-model400,audio alignment requires a model configured with task=align