Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interface docs #6

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Changes from all commits
Commits
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
37 changes: 29 additions & 8 deletions internal-docs/basic-interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ The document introduces the basic interfaces that we want to recreate.

1. [AudioContext](#audiocontext)
2. [AudioNode](#audionode)
3. [AudioParam](#audioparam)
4. [OscillatorNode](#oscillatornode)
5. [GainNode](#gainnode)
6. [StereoPannerNode](#stereopannernode)
3. [AudioScheduledSourceNode](#audioscheduledsourcenode)
4. [AudioDestinationNode](#audiodestinationnode)
5. [AudioParam](#audioparam)
6. [OscillatorNode](#oscillatornode)
7. [GainNode](#gainnode)
8. [StereoPannerNode](#stereopannernode)

### AudioContext

The `AudioContext` interface is the underlying audio context that manages the state of the entire audio application.

#### Attributes

- **`currentTime`**: Representing an ever-increasing hardware time in seconds. It starts at 0.
- **`destination`**: Output node that is typically connected to speakers.
- **`sampleRate`**: Audio sampling rate in hertz.

Expand All @@ -35,11 +38,29 @@ The `AudioContext` interface is the underlying audio context that manages the st

The `AudioNode` interface is the base interface for all audio nodes in the audio processing graph.

#### Attributes

- **`context`**: Context associated with AudioNode.
- **`numberOfInputs`**: Number of inputs feeding the node. Source nodes are defined as nodes having value 0 for this attribute
- **`numberOfOutputs`**: Number of outputs coming out of the node. Destination nodes are defined as nodes having value 0 for this attribute

#### Methods

- **`connect(destination, output, input)`**: Connects the current audio node to another audio node or parameter.
- **`disconnect(destination, output, input)`**: Disconnects the current audio node from another audio node or parameter.
- **`process()`**: process node base on setup attributes.

### AudioScheduledSourceNode

The `AudioScheduledSourceNode` is an interface representing several types of audio source node. Inherits from `AudioNode`.

#### Methods

- **`start(time)`**: Schedules the node to begin playback at specified time. If no time is given, starts immediately.
- **`stop(time)`**: Schedules the node to stop playing at specified time. If no time is given, stops immediately.

### AudioDestinationNode

The `AudioDestinationNode` is an interface representing end destination of audio graph. Inherits from `AudioNode`.

### AudioParam

Expand All @@ -57,7 +78,7 @@ The `AudioParam` interface represents audio parameters that can be time-modulate

### OscillatorNode

The `OscillatorNode` interface represents an oscillator node that generates sounds at a specific frequency and waveform.
The `OscillatorNode` interface represents an oscillator node that generates sounds at a specific frequency and waveform. Inherits from `AudioScheduledSourceNode`.

#### Attributes

Expand All @@ -67,15 +88,15 @@ The `OscillatorNode` interface represents an oscillator node that generates soun

### GainNode

The `GainNode` interface represents a gain node that allows you to control the volume of the audio signal.
The `GainNode` interface represents a gain node that allows you to control the volume of the audio signal. Inherits from `AudioNode`.

#### Attributes

- **`gain`**: `AudioParam` - gain parameter.

### StereoPannerNode

The `StereoPannerNode` interface represents a stereo panning node that allows you to control the position of sound in stereo space.
The `StereoPannerNode` interface represents a stereo panning node that allows you to control the position of sound in stereo space. Inherits from `AudioNode`.

#### Attributes

Expand Down
Loading