Skip to content

Mkulakow/audio format fix - #4637

Open
michalkulakowski wants to merge 2 commits into
mainfrom
mkulakow/audio_format_fix
Open

michalkulakowski wants to merge 2 commits into
mainfrom
mkulakow/audio_format_fix

Conversation

@michalkulakowski

@michalkulakowski michalkulakowski commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

🛠 Summary

#4613

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

Copilot AI balanced review requested due to automatic review settings October 7, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The implementation has portability, undefined-behavior, disabled-build, and oversized-test defects.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

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"
Comment thread src/audio/audio_utils.cpp
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),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants