Skip to content

Add reverse smear toggle with dedicated reverse allpass chain#79

Merged
ovelhaaa merged 2 commits into
mainfrom
codex/add-reversesmear-parameter-to-orbitdelayparams
May 27, 2026
Merged

Add reverse smear toggle with dedicated reverse allpass chain#79
ovelhaaa merged 2 commits into
mainfrom
codex/add-reversesmear-parameter-to-orbitdelayparams

Conversation

@ovelhaaa

Copy link
Copy Markdown
Owner

Motivation

  • Provide an explicit boolean control for reverse-mode smear so reverse behavior can be enabled/disabled independently of shimmer/diffuser.
  • Avoid coupling the reverse-mode smear to the existing shimmer diffuser implementation by introducing a separate allpass chain for reverse reads.
  • Use fixed, Hydra-inspired allpass delays/gains to produce a predictable reverse-smear character for accidental-reverse reads.

Description

  • Added a new API on the core void setReverseSmearEnabled(bool enabled) and internal flags reverseSmearEnabled_ and pendingReverseSmearEnabled_ to integrate the parameter into the existing pending/applied parameter flow.
  • Implemented a dedicated 4-stage per-channel allpass chain (reverseSmearStagesL_ / reverseSmearStagesR_) with fixed delays and gains and helper functions initReverseSmearStages and processReverseSmear in core/src/orbit_delay_core.cpp.
  • Initialized reverse allpass stages on reset and applied the reverse chain only after obtaining the wet reverse signal and only when readMode == AccidentalReverse and reverseSmearEnabled_ is true; the shimmer diffuser remains unchanged and is not reused.
  • Exposed the control through the C API via bool orbit_set_reverse_smear_enabled(OrbitDelayHandle* handle, bool enabled) in core/include/orbit_delay_c_api.h / core/src/orbit_delay_c_api.cpp.

Testing

  • Built the project with cmake -S . -B build && cmake --build build -j2 which completed successfully.
  • Ran the test suite with ctest --test-dir build --output-on-failure and all tests passed (5/5 tests passed).

Codex Task

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@ovelhaaa, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 20 minutes and 53 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 249174fa-91ce-4aae-855f-bf04c2f50601

📥 Commits

Reviewing files that changed from the base of the PR and between c719063 and 5d2d8d2.

📒 Files selected for processing (4)
  • core/include/orbit_delay_c_api.h
  • core/include/orbit_delay_core.h
  • core/src/orbit_delay_c_api.cpp
  • core/src/orbit_delay_core.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/add-reversesmear-parameter-to-orbitdelayparams

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a "reverse smear" feature to the orbit delay effect, adding a C API wrapper, atomic parameter handling, and processing logic using four-stage allpass filters in the accidental reverse read mode. The feedback recommends refactoring the hardcoded array sizes using a static constexpr member to improve maintainability and avoid duplication. Additionally, it suggests resetting the reverse smear stages when the feature is toggled to prevent audible clicks or pops from stale audio buffers.

Comment thread core/include/orbit_delay_core.h Outdated
Comment on lines +290 to +291
AllpassStage reverseSmearStagesL_[4];
AllpassStage reverseSmearStagesR_[4];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using a hardcoded magic number 4 for the array size of reverseSmearStagesL_ and reverseSmearStagesR_ introduces a maintainability risk and code duplication.

We can define kReverseSmearStages as a static constexpr member of OrbitDelayCore and use it to declare the array sizes. This keeps the array sizes synchronized with the DSP implementation.

Suggested change
AllpassStage reverseSmearStagesL_[4];
AllpassStage reverseSmearStagesR_[4];
static constexpr uint32_t kReverseSmearStages = 4u;
AllpassStage reverseSmearStagesL_[kReverseSmearStages];
AllpassStage reverseSmearStagesR_[kReverseSmearStages];

Comment thread core/src/orbit_delay_core.cpp Outdated
}
};

constexpr uint32_t kReverseSmearStages = 4u;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Instead of hardcoding 4u here, we can reference the kReverseSmearStages constant defined in OrbitDelayCore to avoid duplication and ensure consistency across the header and source files.

Suggested change
constexpr uint32_t kReverseSmearStages = 4u;
constexpr uint32_t kReverseSmearStages = OrbitDelayCore::kReverseSmearStages;

Comment thread core/src/orbit_delay_core.cpp Outdated
diffuserDirty_ = true;
}
dcBlockEnabled_ = nextDcBlock;
reverseSmearEnabled_ = nextReverseSmearEnabled;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When reverseSmearEnabled_ is toggled, the internal reverseSmearStagesL_ and reverseSmearStagesR_ are not reset. This can cause stale audio samples remaining in the allpass buffers to be output as a sudden burst or cause audible clicks/pops when the reverse smear is re-enabled.

To ensure a smooth transition and consistent behavior (similar to how shimmerModeEnabled_ resets the diffusers), we should reset the reverse smear stages when reverseSmearEnabled_ is toggled.

    if (reverseSmearEnabled_ != nextReverseSmearEnabled) {
        reverseSmearEnabled_ = nextReverseSmearEnabled;
        for (uint32_t i = 0; i < kReverseSmearStages; ++i) {
            reverseSmearStagesL_[i].reset();
            reverseSmearStagesR_[i].reset();
        }
    }

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29381baccd

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +273 to +277
bool orbit_set_reverse_smear_enabled(OrbitDelayHandle* handle, bool enabled) {
if (handle == nullptr) {
return false;
}
handle->core.setReverseSmearEnabled(enabled);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose reverse smear control in WASM bindings

Add the corresponding WASM bridge/export for this new C API setter; currently only native C callers can toggle reverse smear. The WASM target uses explicit wrappers and an explicit EXPORTED_FUNCTIONS list (targets/wasm/orbit_delay_wasm.cpp, targets/wasm/CMakeLists.txt), and there is no orbit_wasm_set_reverse_smear_enabled entry, so web/demo/worklet clients cannot access the feature introduced here.

Useful? React with 👍 / 👎.

@ovelhaaa
ovelhaaa merged commit 49f4db6 into main May 27, 2026
1 check passed
@ovelhaaa
ovelhaaa deleted the codex/add-reversesmear-parameter-to-orbitdelayparams branch May 27, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant