|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +--- |
| 4 | + |
| 5 | +import { Optional, ReadOnly } from '@site/src/components/Badges'; |
| 6 | + |
| 7 | +# AudioNode |
| 8 | + |
| 9 | +`AudioNode` interface serves as a versatile interface for constructing an audio processing graph, representing individual units of audio processing functionality. |
| 10 | +Each `AudioNode` is associated with a certain number of audio channels that facilitate the transfer of audio data through processing graph. |
| 11 | + |
| 12 | +We usually represent the channels with the standard abbreviations detailed in the table below: |
| 13 | + |
| 14 | +| Name | Number of channels | Channels | |
| 15 | +| :----: | :------: | :-------- | |
| 16 | +| Mono | 1 | 0: M - mono | |
| 17 | +| Stereo | 2 | 0: L - left <br /> 1: R - right | |
| 18 | +| Quad | 4 | 0: L - left <br /> 1: R - right <br /> 2: SL - surround left <br /> 3: SR - surround right | |
| 19 | +| Stereo | 6 | 0: L - left <br /> 1: R - right <br /> 2: C - center <br /> 3: LFE - subwoofer <br /> 4: SL - surround left <br /> 5: SR - surround right | |
| 20 | + |
| 21 | +## Read-only properties |
| 22 | + |
| 23 | +| Name | Type | Description | |
| 24 | +| :----: | :----: | :-------- | |
| 25 | +| `context` | [`BaseAudioContext`](/core/base-audio-context) | Returns the associated context. | |
| 26 | +| `numberOfInputs` | `number` | Returns value representing the number of input connections for the node. Source nodes are characterized by having a `numberOfInputs` value of 0. | |
| 27 | +| `numberOfOutputs` | `number` | Returns value representing the number of output connections for the node. Destination nodes are characterized by having a `numberOfOutputs` value of 0. | |
| 28 | +| `channelCount` | `number` | Returns value representing the number of channels utilized to decide how many channels are engaged during up-mixing or down-mixing with the node's inputs. | |
| 29 | +| `channelCountMode` | [`ChannelCountMode`](/types/channel-count-mode) | Returns an enumerated value that specifies the method by which channels are mixed between the node's inputs and outputs. | |
| 30 | +| `channelInterpretation` | [`ChannelInterpretation`](/types/channel-interpretation) | Returns an enumerated value that specifies how input channels are mapped to output channels when number of them is different. | |
| 31 | + |
| 32 | +## Methods |
| 33 | + |
| 34 | +### `connect` |
| 35 | + |
| 36 | +The `connect` method lets you connect one of the node's outputs to a destination. |
| 37 | + |
| 38 | +| Parameters | Type | Description | |
| 39 | +| :---: | :---: | :---- | |
| 40 | +| `destination` | [`AudioNode`](/core/audio-node) | Audio node to which to connect. | |
| 41 | + |
| 42 | +**Returns** `undefined`. |
| 43 | + |
| 44 | +### `disconnect` |
| 45 | + |
| 46 | +The `disconnect` method lets you disconnect one or more nodes from the node. |
| 47 | + |
| 48 | +| Parameters | Type | Description | |
| 49 | +| :---: | :---: | :---- | |
| 50 | +| `destination` <Optional /> | [`AudioNode`](/core/audio-node) | Audio node to which to connect. | |
| 51 | + |
| 52 | +If no arguments provided node disconnects from all outgoing connections. |
| 53 | + |
| 54 | +**Returns** `undefined`. |
0 commit comments