Repository navigation
feat(audio-context): Android non-uniform convolution, HRTF panning and Web Audio spec coverage - #289
Merged
Merged
Conversation
…d Web Audio spec coverage - ConvolverNode: non-uniformly partitioned convolution like Chromium's ReverbConvolver. A 128-frame head (first 4096 frames) runs on the render thread with no latency; 2048- and 16384-frame partitions run on a background thread for realtime contexts, inline offline. - PannerNode 'HRTF': per-ear kernels and interaural delays from the MIT KEMAR compact set (free use with attribution), interpolated by azimuth and elevation, resampled to the context rate, crossfaded on direction changes; stereo input pans left/right per ear. Replaces the unused custom-HRIR path and the non-spec distance low-pass on panners. - StereoPannerNode pans by pan alone (no listener, distance or cone). - AudioParam: native exponentialRamp, setTarget and setValueCurve; ramps with no prior event start from the call time and current value. - OscillatorNode.detune; AudioBufferSourceNode detune, loopStart and loopEnd (k-rate rate). - PeriodicWave: DC ignored, normalized to peak 1 unless disableNormalization. - WaveShaperNode '2x'/'4x' oversampling; DynamicsCompressorNode linked detection, 6 ms look-ahead, makeup gain and a readable reduction; AnalyserNode Blackman window, magnitude smoothing and spec byte conversion; currentTime never negative. - TS: numberOfInputs/Outputs, per-node channel constraints, start/stop and ended rules, OfflineAudioContext validation and complete event, createBuffer signature, AudioBuffer validation, closed-context errors, getOutputTimestamp, setSinkId errors and sinkchange, node validation, Biquad getFrequencyResponse, AudioParam default/min/max and fixed rates. - Specs: audio.api and audio.dsp suites.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
ℹ️ Note: npm publishing is disabled for pull requests. |
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.
Brings the Android
@nativescript/audio-contextgraph much closer to the Web Audio spec. The DSP is native (audio_graph.cpp,convolver.cpp,hrtf.cpp), and audio data stays in native memory.ConvolverNode: non-uniform partitioning. The design follows Chromium's ReverbConvolver.
PannerNode
panningModel = 'HRTF'. This is real HRIR convolution.hrtf_kemar.h). Licence: "This data is Copyright 1994 by the MIT Media Laboratory. It is provided free with no restrictions on use, provided the authors are cited when the data is used in any research or commercial application." Citation: Gardner & Martin, HRTF Measurements of a KEMAR Dummy-Head Microphone, MIT Media Lab Technical Report feat(audio-context): Android OfflineAudioContext on the realtime mixer, with suspend/resume and DelayNode #280 (1994). The citation is also in the header.setHRTFandsetHRTFPartitionSize), and a non-spec distance low-pass that every PannerNode had.Other native fixes
panalone. The listener position, distance and cone no longer affect it.exponentialRampToValueAtTime,setTargetAtTimeandsetValueCurveAtTimeare now evaluated natively. They used to be approximated with linear ramps. A ramp with no event before it now starts at the time it was called, from the current value.OscillatorNode.detuneis added.detune,loopStartandloopEnd.loopcan change during playback.playbackRate×detuneis k-rate.disableNormalizationis set.oversample'2x'and'4x'with half-band FIR up- and down-sampling.reductionis a number metered by the render thread.floor(128·(1+x)).currentTimeis never negative.TypeScript (
index.android.tsonly;common.tsandindex.d.tsare unchanged)numberOfInputsandnumberOfOutputson every node.channelCount,channelCountModeandchannelInterpretationrules for splitter, merger, panners, convolver, compressor and destination.destination.maxChannelCountis added.start()andstop()validate their arguments and call order;endedfires once, asynchronously, and only afterstart();endedstill fires when the listener was attached before.bufferwas set.oncompleteand thecompleteevent;createBuffer(numberOfChannels, length, sampleRate)works on both context types;getOutputTimestamp()is added;setSinkIdrejects with NotFoundError or InvalidStateError and firessinkchange;decodeAudioDatarejects with EncodingError.'custom'only through a PeriodicWave).getFrequencyResponseis added.defaultValue,minValueandmaxValue. The compressor params and the buffer source'splaybackRateanddetuneare fixed at'k-rate'.Specs: two new suites,
audio.api(29 tests) andaudio.dsp(22 tests). They use an Android-only wrapper and are skipped on other platforms. Among them:Pixel 9 Pro emulator,
audiosuite: 117/117 passing.Not done
ScriptProcessorNodeand theMediaStream*nodes: NativeScript has no MediaStream / getUserMedia, and ScriptProcessorNode is deprecated in favour of AudioWorklet.suspend()andresume()still act on the shared realtime engine, so they affect every realtime context.setSinkId({type: 'none'})is not supported.AudioParam.valuestill reads back the last value that was set, not the value computed by automation. That getter is incommon.ts.