DelayNode: signals connected to delayTime are ignored, and delayTime = 0 delays by maxDelayTime

未关闭
#1,491 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@mdydek 已经在做这个了。

开始于 2026年11月23日。

  • #1492 来自 @mdydek —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp, react-native, typescript

调研方向

Start with DelayNodeHostObject, where delayTimeParam_ is created with node_ as its owner, then read AudioParamHostObject and how it links bridgeNode_ to ownerNode_. Next, check DelayWriter's write-index calculation and how DelayWriterHostNode and DelayReaderHostNode are ordered. Done when a signal connected to delayTime modulates the delay and delayTime 0 gives no delay, matching the four-row table in the issue.

由索引模型根据 Issue 内容生成。

描述

bug
Description

In react-native-audio-api 1.0.1, DelayNode has two related delayTime bugs:

  1. A signal connected to delayTime has no effect, so an LFO can't modulate a delay (chorus, flanger, vibrato).
  2. With delayTime at 0, the output is delayed by maxDelayTime instead of 0.

Nothing is logged and no error is thrown.

Repro repository: https://github.com/wwrinkle/rnaa-delaytime-repro

Repro

Each case renders a one-sample click through createDelay(1) in an OfflineAudioContext and measures when it comes out:

const delay = ctx.createDelay(1);
delay.delayTime.value = 0;
source.connect(delay);
delay.connect(ctx.destination);

const control = ctx.createConstantSource();
control.offset.value = 0.25;
control.connect(delay.delayTime);
control.start(0);
delayTime.value Connected signal Expected, and Chrome 1.0.1 on Pixel 10
0.25 none 0.250 s 0.250 s
0 0.25 0.250 s 1.000 s
0.25 0.25 0.500 s 0.250 s
0 none 0.000 s 1.000 s

The Pixel gave the same results in repeated runs, each in a fresh app process, including a build from a clean clone of the repro repository. iOS is not tested, but the code involved is shared C++.

Cause (as far as I can tell)

Connected signals: DelayNodeHostObject creates the param with node_, the outer DelayNode, as its owner:

delayTimeParam_ =
    std::make_shared<AudioParamHostObject>(graph_, node_, delayNode_->getDelayTimeParam());

AudioParamHostObject then adds bridgeNode_ -> ownerNode_. Audio actually flows through DelayWriterHostNode and DelayReaderHostNode, and DelayWriter is what reads the param. The outer node's processNode is a no-op and it has no path to the destination, so the bridge's input never seems to reach the param the writer reads.

Zero delay: DelayWriter computes (readForWrite + delayTime * sampleRate) % size. At 0, the write index equals the read index. If the reader has already read that slot in the quantum, the new sample isn't read until the ring comes back around, which is maxDelayTime later.

The same code is on main today.

Possible fixes
  • Make the writer the param's owner, so the bridge is ordered before the node that reads it.
  • Handle a delay shorter than one quantum explicitly, for example by making sure the writer runs before the reader when there is no cycle.
Steps to reproduce
  1. Clone https://github.com/wwrinkle/rnaa-delaytime-repro and run npm install.
  2. Run npx expo prebuild --platform android, then npx expo run:android --variant release with a device connected.
  3. Run adb logcat ReactNativeJS:V '*:S' | grep '\[repro\]', or read the results on screen.
Snack or a link to a repository

https://github.com/wwrinkle/rnaa-delaytime-repro

React Native Audio API version

1.0.1

React Native version

0.86.3

Platforms

Android

JavaScript runtime

Hermes

Workflow

Expo Dev Client

Architecture

Fabric (New Architecture)

Build type

Release app & production bundle

Device

Real device

Device model

Pixel 10, Android 17

Acknowledgements

Yes


Investigated and drafted with an AI coding assistant. The reproduction in the linked repository was built from a clean clone and verified on a Pixel 10 before filing.

主要语言
C++
星标
864
派生
103
平均合并
1 天 16 小时
30 天内合并 PR
77

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

software-mansion/react-native-audio-api 的其他 Issue

查看 software-mansion/react-native-audio-api 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。