remove dead audio accumulation - #198
Merged
raghavm243512 merged 3 commits intoAug 4, 2026
Merged
Conversation
JosephMarinier
left a comment
Collaborator
There was a problem hiding this comment.
We can accumulate the user_clean_audio chunks in a contiguous bytearray with .extend() to avoid the list[bytes]'s per-chunk pointer overhead and the final b"".join(). This is already used for the equivalent buffers in base_server.py and its subclasses.
|
|
||
| self._user_audio_chunks: list[bytes] = [] | ||
| self._assistant_audio_chunks: list[bytes] = [] | ||
| self._user_clean_audio_chunks: list[bytes] = [] |
Collaborator
There was a problem hiding this comment.
Suggested change
| self._user_clean_audio_chunks: list[bytes] = [] | |
| self._user_clean_audio = bytearray() |
| self._assistant_audio_chunks.append(audio_data) | ||
| elif source == "user_clean": | ||
| if source == "user_clean": | ||
| self._user_clean_audio_chunks.append(audio_data) |
Collaborator
There was a problem hiding this comment.
Suggested change
| self._user_clean_audio_chunks.append(audio_data) | |
| self._user_clean_audio.extend(audio_data) |
Comment on lines
+181
to
+185
| if save_audio_track( | ||
| self._user_clean_audio_chunks, | ||
| self.output_dir / "audio_user_clean.wav", | ||
| sample_rate, | ||
| ): |
Collaborator
There was a problem hiding this comment.
Suggested change
| if save_audio_track( | |
| self._user_clean_audio_chunks, | |
| self.output_dir / "audio_user_clean.wav", | |
| sample_rate, | |
| ): | |
| if save_audio_track(bytes(self._user_clean_audio), self.output_dir / "audio_user_clean.wav", sample_rate): |
|
|
||
|
|
||
| def save_audio_track( | ||
| data: bytes | list[bytes], |
Collaborator
There was a problem hiding this comment.
Suggested change
| data: bytes | list[bytes], | |
| audio_bytes: bytes, |
| ) -> bool: | ||
| """Save a single-track PCM recording to a WAV file, skipping empty audio. | ||
|
|
||
| Accepts either raw PCM bytes or a list of PCM chunks (which are joined). |
Collaborator
There was a problem hiding this comment.
Suggested change
| Accepts either raw PCM bytes or a list of PCM chunks (which are joined). |
| This is the shared entry point for both the assistant server's deferred | ||
| audio saving and the user simulator's clean-track saving. | ||
| """ | ||
| audio_bytes = b"".join(data) if isinstance(data, list) else data |
Collaborator
There was a problem hiding this comment.
Suggested change
| audio_bytes = b"".join(data) if isinstance(data, list) else data |
| user_audio, assistant_audio = sim.get_recorded_audio() | ||
| assert user_audio == b"\x01\x02\x03" | ||
| assert assistant_audio == b"\xaa\xbb\xcc" | ||
| assert sim._user_clean_audio_chunks == [b"\x03\x04", b"\x05\x06"] |
Collaborator
There was a problem hiding this comment.
Suggested change
| assert sim._user_clean_audio_chunks == [b"\x03\x04", b"\x05\x06"] | |
| assert sim._user_clean_audio == b"\x03\x04\x05\x06" |
JosephMarinier
approved these changes
Aug 4, 2026
JosephMarinier
left a comment
Collaborator
There was a problem hiding this comment.
Nice cleanup! Thank you very much!
…idation' into refactor/phase2_recording_consolidation # Conflicts: # src/eva/assistant/base_server.py
raghavm243512
merged commit Aug 4, 2026
08e32bd
into
refactor/phase1_code_path_consolidation
2 checks passed
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.
Removed some duplicate implementations of saving audio
Removed buffers being tracked but unused
Remove duplicate saving of audio
Tested end to end locally, net change in behavior is none