Skip to content

feat: expose optional audio visualization snapshots - #267

Merged
1Lucas1apk merged 13 commits into
PerformanC:devfrom
SebasLoadJs:feat/audio-visualization
Nov 29, 2026
Merged

1Lucas1apk merged 13 commits into
PerformanC:devfrom
SebasLoadJs:feat/audio-visualization

Conversation

@SebasLoadJs

@SebasLoadJs SebasLoadJs commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • Add an opt-in PCM observer before Opus encoding, after output processing.

  • Expose stereo RMS and sample peaks, a 32-bin amplitude envelope, eight frequency-probe magnitudes and an output frame counter through player JSON.

  • Bound retained audio samples and snapshot lifetime; leave the feature disabled by default.

  • Compute RMS, peaks and envelope over the complete reporting interval, retaining a bounded spectral window.

  • Validate playback.audio.visualization as an optional boolean in the central configuration schema.

Why

Clients can build audio-reactive interfaces from compact numerical data without opening a second audio stream or receiving raw PCM.

Checkmarks

  • The modified endpoints have been tested.
  • Used the same indentation as the rest of the project.
  • Still compatible with LavaLink clients.

Additional information

Updated against upstream dev at 86c6a00. The README is unchanged from upstream. Formatting, type-check, build and regression tests passed on the earlier commit 4693b4a (fork CI job).

Runtime Passed Failed Skipped
Node.js 22 31 0 3
Node.js 24 31 0 3
Bun 29 0 —

The five Node HTTP adapter tests run on Node, not Bun. A separate native Bun server suite runs in Bun. These are fork CI results, not independent maintainer validation.

The current HEAD e84a0a3 removes only the review-requested test files; production code and generated output are unchanged from its parent. No new test files or workflow remain in the PR.

Exact-HEAD fork validation passed on e84a0a3: type-check, build, generated-output verification and clean-checkout verification. Node.js 22 and 24 each passed 31 tests (0 failures, 3 skipped); Bun passed 29 tests (0 failures). Regression harnesses were restored only into a temporary directory outside the checkout, not into the submission. The earlier results above remain historical. These are contributor-fork checks, not independent maintainer validation.

Validation limitations: The frame counter represents processed output rather than the audible media timestamp. Synthetic PCM tests and benchmarks do not establish real Discord output timing, production load or end-to-end Lavalink compatibility.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

All Contributors have signed the CLA. The PR is now allowed to be merged.
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor Author

recheck

@1Lucas1apk 1Lucas1apk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The observer implementation and its synthetic coverage look focused, and the PR keeps the feature opt-in. I found one concrete integration gap in the configuration path: visualization is added to the public config type and read by the runtime, but the central ConfigValidationManager schema still only declares playback.audio.processingMode. Please add explicit boolean validation for the new option. I could not run the full NodeLink type-check/build locally because this runtime cannot resolve GitHub to obtain a checkout; the fork's CI claims are not independent verification, and no status run for this exact HEAD was returned by the GitHub status endpoint.

/** Audio processing path; defaults to the unchanged legacy pipeline. */
processingMode?: AudioProcessingMode
/** Optional bounded PCM visualization snapshots. */
visualization?: boolean

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This new visualization setting is consumed by streamProcessor.ts, but ConfigValidationManager still has no playback.audio.visualization schema entry. A non-boolean value can therefore pass central config validation and then silently disable the observer because the runtime checks === true. Please add it as an optional boolean to the central audio schema.

@1Lucas1apk 1Lucas1apk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I rechecked the submitted source at c6e991c. The configuration gap from my earlier review is now fixed: playback.audio.visualization is declared as an optional boolean in ConfigValidationManager, matching the public type and runtime gate. The observer also has regression coverage for chunk boundaries, retained peaks and byte-for-byte PCM pass-through. I am not repeating the schema request.

I have not independently run NodeLink's type-check, build or tests in this environment. The CI result in the description refers to 4693b4a, not this final SHA, and the status/workflow endpoints returned no run for c6e991c. This is a code-level acknowledgement, not an approval; please ensure the checks are run against the exact current commit.

@1Lucas1apk 1Lucas1apk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I reviewed the current diff against the repository's explicit contribution constraints. The implementation itself is not the reason for this request: the PR adds committed test files (and, in #270, a dedicated regression workflow) despite NodeLink having no authorized test structure or test infrastructure. Please remove the listed files from the PR rather than relocating them into a new test directory or adding a runner. I have not changed your branch or created commits. Build, type-check and runtime validation were not independently executed here; this review is limited to the clear repository-structure requirement.

@@ -0,0 +1,80 @@
import assert from 'node:assert/strict'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please remove this newly added test file. NodeLink has no authorized test structure, so a *.test.ts file inside the production source tree cannot be introduced. Do not replace it with another committed runner or test directory.

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Removed the added visualization test file; the central configuration validation and observer implementation remain unchanged.

Fork CI on e84a0a3: type-check and build passed, generated output matched, and Node.js 22/24 each passed 31 tests (3 skipped), with 29 passing in Bun and no failures. Regression harnesses ran in a temporary directory outside the checkout; no test infrastructure was added to the PR. Validation log. These results do not establish independent upstream validation or live Discord playback.

@1Lucas1apk 1Lucas1apk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I checked the exact current diff at e84a0a3: AudioVisualization.test.ts is gone and the production change remains opt-in. The observer uses fixed-size PCM buffers, emits the original chunk unchanged, and only returns a recent snapshot. The reported Node/Bun checks are contributor-fork CI; the connected status/workflow lookup did not return a run for this SHA, and I could not independently build or exercise Discord output. No approval is implied.

@TheFrogEcliptia TheFrogEcliptia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I reviewed the current diff at e84a0a3. The visualization observer is opt-in, operates on the processed PCM path, retains only bounded snapshots and passes each input chunk through unchanged. The central configuration schema now validates the public option, and the added output fields are appropriately optional. I found no blocking issue in the reviewed diff. Contributor-reported fork CI covers type-check, build and the Node/Bun checks; live Discord client behavior was not independently exercised here. Approved.

@1Lucas1apk
1Lucas1apk merged commit e7a7b16 into PerformanC:dev Nov 29, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants