Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d74dee6
feat: gain impl
mdydek Nov 13, 2025
62ae75f
feat: better consistency
mdydek Nov 13, 2025
5790ce5
docs: docs proposition
mdydek Nov 14, 2025
4fd5487
feat: stereo panner options
mdydek Nov 16, 2025
5d7cc69
feat: added web
mdydek Nov 16, 2025
add1958
feat: convolver options
mdydek Nov 16, 2025
022683b
test: tests
mdydek Nov 17, 2025
0a539d1
feat: constant source options
mdydek Nov 17, 2025
a90f428
Merge branch 'main' into feat/audio-node-options-in-ctor
mdydek Nov 18, 2025
a052c45
feat: web for convolver
mdydek Nov 18, 2025
a47447b
feat: periodic wave
mdydek Nov 19, 2025
1aa6443
feat: analyser node
mdydek Nov 19, 2025
3b0b1b7
feat: biquad filter
mdydek Nov 19, 2025
1dcdaa6
feat: oscillator
mdydek Nov 20, 2025
1f62ba8
feat: mobile audio buffer sources
mdydek Nov 24, 2025
f80292a
feat: streamer node options
mdydek Nov 26, 2025
67df87d
feat: recorder adapter
mdydek Nov 26, 2025
617188a
feat: worklets
mdydek Dec 2, 2025
0a6f8d8
feat: audiobuffer
mdydek Dec 2, 2025
f074c12
feat: audiobuffer on web
mdydek Dec 2, 2025
4617720
docs: documentation for new constructors
mdydek Dec 2, 2025
002b5c3
feat: absn on web
mdydek Dec 3, 2025
25c9327
Merge branch 'main' into feat/audio-node-options-in-ctor
mdydek Dec 3, 2025
829c019
feat: delay node
mdydek Dec 3, 2025
2c6a512
feat: iirfilter
mdydek Dec 3, 2025
e487709
test: test fix
mdydek Dec 3, 2025
bf1ad3d
feat: better absn for web
mdydek Dec 3, 2025
5632d68
feat: reverted pitch correction option in factory method for absn
mdydek Dec 3, 2025
97eb239
feat: slowly removing shared ptr in options
mdydek Dec 4, 2025
7a99505
feat: removed options as shared ptr
mdydek Dec 4, 2025
b19e1fd
test: test fix
mdydek Dec 4, 2025
e12c3da
feat: changes after review
mdydek Dec 5, 2025
7cd2f04
Merge branch 'main' into feat/audio-node-options-in-ctor
mdydek Dec 16, 2025
a162143
Merge branch 'main' into feat/audio-node-options-in-ctor
mdydek Dec 16, 2025
d2019dd
fix: tests
mdydek Dec 16, 2025
953c4e5
fix: playback speed app
mdydek Dec 16, 2025
ba4fea6
Merge branch 'main' into feat/audio-node-options-in-ctor
mdydek Jan 7, 2026
97d464e
feat: options in wave shaper
mdydek Jan 7, 2026
234ec6e
feat: options as references
mdydek Jan 8, 2026
96c7181
feat: removed default options in c++
mdydek Jan 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions apps/common-app/src/demos/PedalBoard/EchoPedal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useRef, useState, useEffect } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
import { VerticalSlider } from '../../components';
import { ConvolverNode, AudioNode, AudioContext, GainNode } from 'react-native-audio-api';
import { ConvolverNode, AudioNode, AudioContext } from 'react-native-audio-api';
import { makeEchoCurve } from './curves';

interface EchoPedalProps {
Expand All @@ -17,7 +16,6 @@ export default function EchoPedal({
outputNode,
}: EchoPedalProps) {
const [isActive, setIsActive] = useState(false);
const [time, setTime] = useState(0.5); // Echo delay time (0-1 mapped to actual delay)

const convolverNodeRef = useRef<ConvolverNode | null>(null);

Expand All @@ -32,23 +30,15 @@ export default function EchoPedal({
}
}, [isActive, inputNode, outputNode]);

useEffect(() => {
if (isActive && inputNode && outputNode) {
applyEffect(context, inputNode, outputNode);
}
}, [time]);

const applyEffect = (context: AudioContext, inputNode: AudioNode, outputNode: AudioNode) => {
if (convolverNodeRef.current) {
inputNode.disconnect(convolverNodeRef.current);
convolverNodeRef.current.disconnect();
}
// Map slider value (0-1) to delay time (0.1s - 2.0s)
const delayTime = 0.1 + time * 1.9;

// Create new convolver with echo curve
const convolver = context.createConvolver({ disableNormalization: true});
convolver.buffer = makeEchoCurve(delayTime, context);
const convolver = new ConvolverNode(context, { disableNormalization: true})
convolver.buffer = makeEchoCurve(0.7, context);
convolverNodeRef.current = convolver;

// Reconnect audio graph
Expand Down
4 changes: 1 addition & 3 deletions apps/common-app/src/examples/AudioFile/AudioPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ class AudioPlayer {
await this.audioContext.resume();
}

this.sourceNode = this.audioContext.createBufferSource({
pitchCorrection: true,
});
this.sourceNode = this.audioContext.createBufferSource(true);
this.sourceNode.buffer = this.audioBuffer;
this.sourceNode.playbackRate.value = this.playbackRate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ const AudioVisualizer: React.FC = () => {
}

if (!analyserRef.current) {
analyserRef.current = audioContextRef.current.createAnalyser();
analyserRef.current.fftSize = FFT_SIZE;
analyserRef.current.smoothingTimeConstant = 0.2;

analyserRef.current = new AnalyserNode(audioContextRef.current, { fftSize: FFT_SIZE, smoothingTimeConstant: 0.2 });
analyserRef.current.connect(audioContextRef.current.destination);
}

Expand Down
6 changes: 1 addition & 5 deletions apps/common-app/src/examples/PlaybackSpeed/PlaybackSpeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ const PlaybackSpeed: FC = () => {
)
);

const source = audioContext.createBufferSource({
pitchCorrection: audioSettings.PSOLA
? false
: audioSettings.pitchCorrection,
});
const source = audioContext.createBufferSource(audioSettings.PSOLA ? false : audioSettings.pitchCorrection);

source.buffer = buffer;
source.playbackRate.value = audioSettings.PSOLA ? 1 : playbackSpeed;
Expand Down
24 changes: 18 additions & 6 deletions packages/audiodocs/docs/analysis/analyser-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 1
---

import AudioNodePropsTable from "@site/src/components/AudioNodePropsTable"
import { ReadOnly } from '@site/src/components/Badges';
import { Optional, ReadOnly } from '@site/src/components/Badges';

# AnalyserNode

Expand All @@ -23,7 +23,23 @@ In contrast, a frequency-domain graph reveals how the signal's energy or power i

## Constructor

[`BaseAudioContext.createAnalyser()`](/docs/core/base-audio-context#createanalyser)
```tsx
constructor(context: BaseAudioContext, options?: AnalyserOptions)
```

### `AnalyserOptions`

Inherits all properties from [`AudioNodeOptions`](/docs/core/audio-node#audionodeoptions)

| Parameter | Type | Default | |
| :---: | :---: | :----: | :---- |
| `fftSize` <Optional /> | `number` | 2048 | Number representing size of fast fourier transform |
| `minDecibels` <Optional /> | `number` | -100 | Initial minimum power in dB for FFT analysis |
| `maxDecibels` <Optional /> | `number` | -30 | Initial maximum power in dB for FFT analysis |
| `smoothingTimeConstant` <Optional /> | `number` | 0.8 | Initial smoothing constant for the FFT analysis |

Or by using `BaseAudioContext` factory method:
[`BaseAudioContext.createAnalyser()`](/docs/core/base-audio-context#createanalyser) that creates node with default values.

## Properties

Expand Down Expand Up @@ -95,24 +111,20 @@ Each value in the array is within the range 0 to 255, where value of 127 indicat
## Remarks

#### `fftSize`
- Default value is 2048.
- Must be a power of 2 between 32 and 32768.
- Throws `IndexSizeError` if set value is not power of 2, or is outside the allowed range.

#### `minDecibels`
- Default value is -100 dB.
- 0 dB([decibel](https://en.wikipedia.org/wiki/Decibel)) is the loudest possible sound, -10 dB is a 10th of that.
- When getting data from [`getByteFrequencyData()`](/docs/analysis/analyser-node#getbytefrequencydata), any frequency with amplitude lower then `minDecibels` will be returned as 0.
- Throws `IndexSizeError` if set value is greater than or equal to `maxDecibels`.

#### `maxDecibels`
- Default value is -30 dB.
- 0 dB([decibel](https://en.wikipedia.org/wiki/Decibel)) is the loudest possible sound, -10 dB is a 10th of that.
- When getting data from [`getByteFrequencyData()`](/docs/analysis/analyser-node#getbytefrequencydata), any frequency with amplitude higher then `maxDecibels` will be returned as 255.
- Throws `IndexSizeError` if set value is less then or equal to `minDecibels`.

#### `smoothingTimeConstant`
- Default value is 0.8.
- Nominal range is 0 to 1.
- 0 means no averaging, 1 means "overlap the previous and current buffer quite a lot while computing the value".
- Throws `IndexSizeError` if set value is outside the allowed range.
Expand Down
12 changes: 12 additions & 0 deletions packages/audiodocs/docs/core/audio-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ If no arguments provided node disconnects from all outgoing connections.

#### Returns `undefined`.

### `AudioNodeOptions`

It is used to constructing majority of all `AudioNodes`.

| Parameter | Type | Default | Description |
| :---: | :---: | :----: | :---- |
| `channelCount` <Optional /> | `number` | 2 | Indicates number of channels used in mixing of node. |
| `channelCountMode` <Optional /> | [`ChannelCountMode`](/docs/types/channel-count-mode) | `max` | Determines how the number of input channels affects the number of output channels in an audio node. |
| `channelInterpretation` <Optional /> | [`ChannelInterpretation`](/docs/types/channel-interpretation) | `speakers` | Specifies how input channels are mapped out to output channels when the number of them are different. |

If any of these values are not provided, default values are used.

## Remarks

#### `numberOfInputs`
Expand Down
25 changes: 2 additions & 23 deletions packages/audiodocs/docs/core/base-audio-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Creates [`AudioBufferSourceNode`](/docs/sources/audio-buffer-source-node).

| Parameter | Type | Description |
| :---: | :---: | :---- |
| `options` <Optional /> | [`AudioBufferBaseSourceNodeOptions`](/docs/sources/audio-buffer-source-node#constructor) | Dictionary object that specifies if pitch correction has to be available. |
| `pitchCorrection` <Optional /> | `boolean` | Boolean that specifies if pitch correction has to be available. |

#### Returns `AudioBufferSourceNode`.

Expand All @@ -94,7 +94,7 @@ Creates [`AudioBufferQueueSourceNode`](/docs/sources/audio-buffer-queue-source-n

| Parameter | Type | Description |
| :---: | :---: | :---- |
| `options` <Optional /> | [`AudioBufferBaseSourceNodeOptions`](/docs/sources/audio-buffer-queue-source-node#constructor) | Dictionary object that specifies if pitch correction has to be available. |
| `pitchCorrection` <Optional /> | `boolean` | Boolean that specifies if pitch correction has to be available. |

#### Returns `AudioBufferQueueSourceNode`.

Expand All @@ -108,16 +108,6 @@ Creates [`ConstantSourceNode`](/docs/sources/constant-source-node).

Creates [`ConvolverNode`](/docs/effects/convolver-node).

| Parameter | Type | Description |
| :---: | :---: | :---- |
| `options` <Optional /> | [`ConvolverNodeOptions`](/docs/effects/convolver-node#constructor) | Dictionary object that specifies associated buffer and normalization. |

#### Errors

| Error type | Description |
| :---: | :---- |
| `NotSupportedError` | `numOfChannels` of buffer is not 1, 2 or 4. |

#### Returns `ConvolverNode`.

### `createDelay`
Expand All @@ -140,17 +130,6 @@ Creates [`GainNode`](/docs/effects/gain-node).

Creates [`IIRFilterNode`](/docs/effects/iir-filter-node).

| Parameter | Type | Description |
| :---: | :---: | :---- |
| `options` | [`IIRFilterNodeOptions`](/docs/effects/iir-filter-node#constructor) | Dictionary object that specifies the feedforward (numerator) and feedback (denominator) coefficients for the transfer function of the IIR filter. |

#### Errors

| Error type | Description |
| :---: | :---- |
| `NotSupportedError` | One or both of the input arrays exceeds 20 members. |
| `InvalidStateError` | All of the feedforward coefficients are 0, or the first feedback coefficient is 0. |

#### Returns `IIRFilterNode`.

### `createOscillator`
Expand Down
30 changes: 19 additions & 11 deletions packages/audiodocs/docs/effects/biquad-filter-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 1
---

import AudioNodePropsTable from "@site/src/components/AudioNodePropsTable"
import { ReadOnly } from '@site/src/components/Badges';
import { Optional, ReadOnly } from '@site/src/components/Badges';
import InteractiveExample from '@site/src/components/InteractiveExample';
import AudioApiExample from '@site/src/components/AudioApiExample'
import VinylPlayer from '@site/src/components/RecordPlayerExample/VinylAnimation';
Expand All @@ -23,7 +23,24 @@ Multiple `BiquadFilterNode` instances can be combined to create more complex fil

## Constructor

[`BaseAudioContext.createBiquadFilter()`](/docs/core/base-audio-context#createbiquadfilter)
```tsx
constructor(context: BaseAudioContext, options?: BiquadFilterOptions)
```

### `BiquadFilterOptions`

Inherits all properties from [`AudioNodeOptions`](/docs/core/audio-node#audionodeoptions)

| Parameter | Type | Default | |
| :---: | :---: | :----: | :---- |
| `Q` <Optional /> | `number` | 1 | Initial value for [`Q`](/docs/effects/biquad-filter-node#properties) |
| `detune` <Optional /> | `number` | 0 | Initial value for [`detune`](/docs/effects/biquad-filter-node#properties) |
| `frequency` <Optional /> | `number` | 350 | Initial value for [`frequency`](/docs/effects/biquad-filter-node#properties) |
| `gain` <Optional /> | `number` | 0 | Initial value for [`gain`](/docs/effects/biquad-filter-node#properties) |
| `type` <Optional /> | `BiquadFilterType` | `lowpass` | Initial value for [`type`](/docs/effects/biquad-filter-node#properties) |

Or by using `BaseAudioContext` factory method:
[`BaseAudioContext.createBiquadFilter()`](/docs/core/base-audio-context#createbiquadfilter) that creates node with default values.

## Properties

Expand Down Expand Up @@ -72,24 +89,15 @@ It inherits all methods from [`AudioNode`](/docs/core/audio-node#methods).
## Remarks

#### `frequency`
- Float. Default: 350.
- Range: [10, $\frac{sampleRate}{2}$].

#### `detune`
- Float. Default: 0.

#### `Q`
- Float. Default: 1.
- Range:
- For `lowpass` and `highpass` is [-Q, Q], where Q is the largest value for which $10^{Q/20}$ does not overflow the single-precision floating-point representation.
Numerically: Q ≈ 770.63678.
- For `bandpass`, `notch`, `allpass`, and `peaking`: Q is related to the filter’s bandwidth and should be positive.
- Not used for `lowshelf` and `highshelf`.

#### `gain`
- Float. Default: 0.
- Range: [-40, 40].
- Positive values correspond to amplification; negative to attenuation.

#### `type`
- [`BiquadFilterType`](#biquadfiltertype-enumeration-description). Default: `"lowpass"`.
29 changes: 21 additions & 8 deletions packages/audiodocs/docs/effects/convolver-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sidebar_position: 2
---

import AudioNodePropsTable from "@site/src/components/AudioNodePropsTable"
import { Optional } from '@site/src/components/Badges';

# ConvolverNode

Expand All @@ -19,18 +20,30 @@ Convolver is a node with tail-time, which means, that it continues to output non

## Constructor

[`BaseAudioContext.createConvolver(options: ConvolverNodeOptions)`](/docs/core/base-audio-context#createconvolver)

```jsx
interface ConvolverNodeOptions {
buffer?: AudioBuffer | null; // impulse response
disableNormalization?: boolean; // if normalization of output should be applied, true by default
}
```tsx
constructor(context: BaseAudioContext, options?: ConvolverOptions)
```

### `ConvolverOptions`

Inherits all properties from [`AudioNodeOptions`](/docs/core/audio-node#audionodeoptions)

| Parameter | Type | Default | |
| :---: | :---: | :----: | :---- |
| `buffer` <Optional /> | `number` | | Initial value for [`buffer`](/docs/effects/convolver-node#properties). |
| `normalize` <Optional /> | `boolean` | true | Initial value for [`normalize`](/docs/effects/convolver-node#properties). |

Or by using `BaseAudioContext` factory method:
[`BaseAudioContext.createConvolver()`](/docs/core/base-audio-context#createconvolver)

## Properties

It inherits all properties from [`AudioNode`](/docs/core/audio-node#properties) and has no individual ones.
It inherits all properties from [`AudioNode`](/docs/core/audio-node#properties).

| Name | Type | Description |
| :----: | :----: | :-------- |
| `buffer` | [`AudioBuffer`](/docs/sources/audio-buffer) | Associated AudioBuffer. |
| `normalize` | `boolean` | Whether the impulse response from the buffer will be scaled by an equal-power normalization when the buffer attribute is set. |

:::caution
Linear convolution is a heavy computational process, so if your audio has some weird artefacts that should not be there, try to decrease the duration of impulse response buffer.
Expand Down
18 changes: 15 additions & 3 deletions packages/audiodocs/docs/effects/gain-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 3
---

import AudioNodePropsTable from "@site/src/components/AudioNodePropsTable"
import { ReadOnly } from '@site/src/components/Badges';
import { Optional, ReadOnly } from '@site/src/components/Badges';
import { useGainAdsrPlayground } from '@site/src/components/InteractivePlayground/GainAdsrExample/useGainAdsrPlayground';
import InteractivePlayground from '@site/src/components/InteractivePlayground';

Expand Down Expand Up @@ -43,7 +43,20 @@ You can read more about envelopes and ADSR on [Wikipedia](<https://en.wikipedia.

## Constructor

[`BaseAudioContext.createGain()`](/docs/core/base-audio-context#creategain)
```tsx
constructor(context: BaseAudioContext, options?: GainOptions)
```

### `GainOptions`

Inherits all properties from [`AudioNodeOptions`](/docs/core/audio-node#audionodeoptions)

| Parameter | Type | Default | |
| :---: | :---: | :----: | :---- |
| `gain` <Optional /> | `number` | 1.0 | Initial value for [`gain`](/docs/effects/gain-node#properties) |

Or by using `BaseAudioContext` factory method:
[`BaseAudioContext.createGain()`](/docs/core/base-audio-context#creategain) that creates node with default values.

## Properties

Expand All @@ -61,5 +74,4 @@ It inherits all methods from [`AudioNode`](/docs/core/audio-node#methods).
## Remarks

#### `gain`
- Default value is 1.0.
- Nominal range is -∞ to ∞.
7 changes: 7 additions & 0 deletions packages/audiodocs/docs/effects/iir-filter-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ interface IIRFilterNodeOptions {
}
```

#### Errors

| Error type | Description |
| :---: | :---- |
| `NotSupportedError` | One or both of the input arrays exceeds 20 members. |
| `InvalidStateError` | All of the feedforward coefficients are 0, or the first feedback coefficient is 0. |

## Properties
It inherits all properties from [`AudioNode`](/docs/core/audio-node#properties).

Expand Down
Loading