Skip to content

fix(voice): normalize PCM16 float output correctly - #4755

Open
sylvesterkaczmarek wants to merge 2 commits into
openai:mainfrom
sylvesterkaczmarek:fix/voice-pcm16-float-normalization
Open

fix(voice): normalize PCM16 float output correctly#4755
sylvesterkaczmarek wants to merge 2 commits into
openai:mainfrom
sylvesterkaczmarek:fix/voice-pcm16-float-normalization

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

This pull request fixes PCM16-to-float32 normalization in StreamedAudioResult.

The existing conversion divided signed 16-bit samples by 32767.0, which maps the valid minimum PCM16 sample -32768 to approximately -1.00003. Using 32768.0 keeps the complete PCM16 range within the normalized float interval: -32768 maps to -1.0 and 32767 maps to approximately 0.99997. This also matches the existing PCM16 normalization used by the realtime CLI example when computing audio RMS.

The int16 output path, float32 output shape, buffering, and streaming behavior are unchanged.

Test plan

  • Added a focused regression covering both PCM16 full-scale endpoints.
  • Verified the float32 result remains within [-1.0, 1.0] and preserves the expected (n, 1) shape.

Issue number

N/A

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-29T14:50:36.742307Z ddca600 PR opened
🔒 Security Review Completed 2026-08-29T14:52:24.749242Z ddca600 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant