Skip to content

fix(audio-context): iOS panner routing, multi-output worklets, DelayNode cycles and channelCount - #288

Merged
triniwiz merged 1 commit into
masterfrom
feat/ios-audio-limits
Nov 25, 2026
Merged

triniwiz merged 1 commit into
masterfrom
feat/ios-audio-limits

Conversation

@triniwiz

Copy link
Copy Markdown
Member

This fixes the iOS @nativescript/audio-context gaps the specs still skipped or didn't cover.

PannerNode

  • Inputs mix in an NSCChannelMixerNode (clamped-max, at most two channels). Panning happens in the panner's own audio unit, using the spec's equal-power law for mono and stereo inputs, times the distance and cone gain.
  • Connecting into or out of a panner goes through the shared per-connection routing, so neither the source nor the panner loses its other connections.
  • 'HRTF' pans the same way as 'equalpower'.
  • A mono source at (1, 0, -1) renders L 0.2706 / R 0.6533, which matches Chrome.

Multi-output AudioWorkletNode

  • The worklet unit now has a single output bus. Each output plays from its own tap unit fed by that bus. AVAudioEngine drops a unit's other output-bus connections when one is connected, so this lets any number of outputs be connected at once.

DelayNode cycles

  • Before connecting, the source checks whether the new connection would close a cycle in the engine graph.
  • If it would, a DelayNode on the cycle is split:
    • a writer, pulled by the main mixer, fills the delay line by context frame
    • the delay unit reads only frames written by earlier render calls
  • The delay in a cycle is therefore at least one render call: one quantum offline, the device buffer in a realtime context (about 470 frames on the simulator).
  • A connection that would close a cycle without a DelayNode is not made.

channelCount / channelCountMode / channelInterpretation

  • AudioNode exposes all three on iOS, with the Web Audio defaults per node kind.
  • GainNode, DelayNode and BiquadFilterNode mix new connections to channelCount (up to 8) in 'clamped-max' and 'explicit' modes, with the speakers or discrete rules.

Specs (iOS simulator, audio suite: 62 passed, 0 failed, 0 skipped)

  • audio-graph's DelayNode feedback-loop spec and explicit channelCount gain spec now run on iOS.
  • New specs:
    • connecting to a PannerNode keeps the source's and the panner's other connections
    • a multi-output worklet plays both outputs at once

Only the specs and iOS files change; the new specs have not been run on Android yet.

…ode cycles and channelCount

- PannerNode mixes its inputs in an NSCChannelMixerNode (clamped-max, two channels) and pans in
  its own audio unit with the spec's equal-power law for mono and stereo inputs; connecting to or
  from it uses the shared per-connection routing, so neither end loses its other connections.
  'HRTF' pans the same way.
- A multi-output AudioWorkletNode plays each output from its own tap unit fed by the worklet's
  single output bus, since AVAudioEngine drops a unit's other output buses' connections.
- A connection that would close a cycle splits a DelayNode on it into a writer, pulled by the
  main mixer, and a reader that only reads earlier render calls (delay clamped to at least one
  call); a cycle without a DelayNode is not connected.
- AudioNode channelCount, channelCountMode and channelInterpretation on iOS; GainNode, DelayNode
  and BiquadFilterNode mix new connections to channelCount in clamped-max and explicit modes.
- Specs: audio-graph's feedback-loop and explicit channelCount specs run on iOS; new specs for
  connecting to a PannerNode and for playing both outputs of a worklet at once.
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bc3fe1fd-ec2d-4081-a5ef-484a6cae1a03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown

ℹ️ Note: npm publishing is disabled for pull requests.
Publishing is performed only from tag pushes via the npm Release workflow.
If you need a test publish, merge to master — pushes publish pr-tagged prereleases.

@triniwiz
triniwiz merged commit b051449 into master Nov 25, 2026
36 checks passed
@triniwiz
triniwiz deleted the feat/ios-audio-limits branch November 25, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant