feat: align stereo recording via RecorderIO and link calls to the room sid#5
Merged
Merged
Conversation
Channel alignment is now delegated to livekit-agents' own RecorderIO, subclassed as RoarkRecorderIO, which places each turn on the timeline, splices real silence between turns, and keeps a faster-than-real-time TTS burst at its true duration instead of collapsing it. The previous mixer wrote each frame at its wall-clock arrival offset, which overlapped bursty TTS into a sped-up, clipped channel and turned a jittery mic into a buzz. audio.py is now purely the upload side (AudioCapture): it buffers the interleaved PCM the recorder emits and ships it to Roark in chunks. The recording sample rate is adopted from the negotiated stream rather than fixed at 24 kHz, and reported on call-ended as recordingSampleRate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both the webhook and chunk-upload lanes now resolve against a single https://api.roark.ai base instead of the dev stage and a localhost upload service used during development. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This version has not shipped yet, so fold the prior Unreleased notes into a single initial 0.1.0 entry that describes the integration as it actually behaves on first release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
observe_session now derives the call id from ctx.room.sid (the RM_… id LiveKit Agents tags its OpenTelemetry spans with as room_id), falling back to ctx.job.id then a random UUID. This lets Roark link a call to its trace the same way the LiveKit Cloud integration does. Resolve the sid by calling observe_session after ctx.connect(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Prefer ctx.job.room.sid (available pre-connect) for the call id, falling back to the async ctx.room.sid, then job id, then a random UUID. - Switch webhook and chunk-upload lanes to https://api.roark.ai. - Example: wire OpenTelemetry export so LiveKit traces reach Roark. - Changelog: keep entries under [Unreleased] (not a release yet). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Removes the OTLP tracer setup, its dependencies, and the related docs from the example. The room sid -> livekit_call_id mapping is kept (it's the id Roark keys the call on); only the trace-export demonstration is removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e4d89d8 to
89d77ef
Compare
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.
Core improvements to the LiveKit → Roark integration. Not a release — changelog
entries stay under
[Unreleased].What's in here
RecorderIO— channel alignment (each turn placed on the timeline, real silence spliced between turns, faster-than-real-time TTS bursts kept at their true duration) now reuses livekit-agents' ownRecorderIO, so the recording matches what LiveKit would write to disk and transcript/tool markers (placed ataudioOffsetMs) land correctly on the waveform. Sample rate is adopted from the negotiated stream (8 kHz telephony, 16/24/48 kHz WebRTC, …) and reported oncall-endedasrecordingSampleRate. Adds_recorder.pyand reworksaudio.py/session.py.livekit_call_idnow defaults to the LiveKit room sid so Roark can link the call to its OpenTelemetry trace. Prefersctx.job.room.sid(available beforectx.connect()), falling back to the asyncctx.room.sid, then the job id, then a random UUID.api.roark.aiendpoints (both the webhook and chunk-upload lanes).setup_roark_tracer, with the supporting deps).Notes for the reviewer
CHANGELOG.mdentries live under[Unreleased]; this PR does not cut a release.pyproject.tomlis at0.1.0with nov0.1.0tag yet, and the Release workflow still fires on push tomain, so squash-merging will trigger a publish attempt. It will no-op/fail unless a PyPI publisher is configured for the project.test_recorder.py(new),test_audio.py,test_session.py.🤖 Generated with Claude Code