Tune MOSS audio quality
Validate the reference and defaults first. Change one variable at a time and compare with the same text and audio.
Check the reference audio first
- Use one clear speaker without music, room echo or clipping.
- Prefer 3–8 seconds of clean speech. Longer audio increases latency and memory pressure.
- The transcript must match the spoken reference.
- Validate with WAV before testing other containers or codecs.
Stable baseline
MOSS_PROMPT_AUDIO_MAX_SECONDS=8
MOSS_SAMPLE_MODE=fixed
MOSS_SEED=1234
MOSS_SEGMENT_LENGTH=120
MOSS_STREAM_CHUNK_SECONDS=0.40
MOSS_STREAM_PREBUFFER_SECONDS=0.75
MOSS_MAX_SILENCE_MS=480
MOSS_CROSSFADE_MS=12
MOSS_OUTPUT_TARGET_PEAK=0.86
MOSS_OUTPUT_GAIN=0.94
MOSS_OUTPUT_EDGE_FADE_MS=1.5
MOSS_REALTIME_STREAMING_DECODE=true
Adjust by workload
| Workload | Recommendation |
|---|---|
| Stable NAS operation | Keep moderate segments, fixed sampling and a short reference |
| Long Chinese narration | Increase segment length gradually and listen for boundary problems |
| Mixed Chinese and English | Avoid very long segments and verify the configured English policy |
| Low-latency dialogue | Use smaller chunks; increase prebuffer if playback stalls |
Adjust by symptom
| Symptom | First action |
|---|---|
| Clipping or harsh output | Lower input/output gain and keep the target peak near 0.86 |
| Electrical noise at boundaries | Keep edge fades and a short crossfade; compare with frame-by-frame decode disabled |
| Long silence | Reduce maximum silence and inspect the end of the reference audio |
| Repeated words or drifting endings | Use shorter text segments |
| Clone OOM | Shorten the reference before changing concurrency |
Measure and listen
python scripts/analyze_audio_quality.py output.wav
Automated checks cannot judge natural prosody. Always perform an A/B listening test with the same inputs.