Skip to content

Propagate errors in audio combine pipeline; init speaker once#5

Open
phyceClaw wants to merge 1 commit into
phyce:mainfrom
phyceClaw:fix/audio-error-propagation
Open

Propagate errors in audio combine pipeline; init speaker once#5
phyceClaw wants to merge 1 commit into
phyce:mainfrom
phyceClaw:fix/audio-error-propagation

Conversation

@phyceClaw

Copy link
Copy Markdown

Summary

In app/common/audio/audio.go, CombineWAVFiles swallowed errors:

  • Resample/channel/bit-depth conversion errors were logged but discarded, so the un-converted buffer was appended — corrupting the combined WAV. Now propagated.
  • os.Create/encoder.Write/encoder.Close errors were logged but the function returned nil. Now propagated.
  • Source files were defer-closed inside the loop (fd leak); now closed per iteration.

In player/player.go, the global beep speaker was re-initialized on every PlayAudioFile; now guarded with sync.Once.

Testing

CGO_ENABLED=1 go build ./app/... passes; go vet clean.

🤖 Generated with Claude Code

CombineWAVFiles discarded ResampleBuffer/ChangeChannelCount/
ChangeBitDepth errors and appended un-converted buffers, corrupting
combined output; it also returned nil after os.Create/encoder
failures. Now propagates these errors. Close each source file per
iteration instead of deferring in the loop (fd leak). Guard the beep
speaker init with sync.Once.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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