Repository navigation
Mkulakow/audio format fix - #4637
Open
michalkulakowski wants to merge 2 commits into
Open
michalkulakowski wants to merge 2 commits into
michalkulakowski wants to merge 2 commits into
Conversation
added 2 commits
October 7, 2026 10:47
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implementation has portability, undefined-behavior, disabled-build, and oversized-test defects.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Updates text-to-speech responses to honor WAV/PCM formats and return matching content types.
Changes:
- Converts generated audio to PCM16 WAV or raw PCM16.
- Rejects unsupported response formats.
- Adds custom HTTP content types and tests.
| File | Description |
|---|---|
src/audio/audio_utils.cpp |
Implements PCM16 conversion and output. |
src/audio/audio_utils.hpp |
Declares audio format utilities. |
src/audio/text_to_speech/t2s_calculator.cc |
Selects and validates response formats. |
src/http_rest_api_handler.cpp |
Assigns audio response content types. |
src/http_rest_api_handler.hpp |
Adds custom content-type support. |
src/http_server.cpp |
Emits custom HTTP content types. |
src/llm/omni_model/legacy/servable.cpp |
Uses the updated WAV writer. |
src/test/audio/audio_utils_test.cpp |
Tests PCM16 output and limits. |
src/test/audio/text2speech_test.cpp |
Tests formats and content types. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| #include "src/port/rapidjson_writer.hpp" | ||
|
|
||
| #include "config.hpp" | ||
| #include "audio/audio_utils.hpp" |
| if (sample < -1.0f) { | ||
| sample = -1.0f; | ||
| } | ||
| return static_cast<int16_t>(sample * 32767.0f); |
| size_t pDataSize = 0; | ||
| EXPECT_THROW( | ||
| prepareAudioOutput(&ppData, pDataSize, sampleRate, bitsPerSample, oversizedSpeech, &dummyWaveform), | ||
| prepareAudioOutput(&ppData, pDataSize, sampleRate, oversizedSpeech, &dummyWaveform), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


🛠 Summary
#4613
🧪 Checklist
``