r-audio
exports a number of React Components falling into the following categories:
RAudioContext
.Component classes listed as (private) are not exported, but may be adding props to the descendant classes which are useful to document.
Initialises an AudioContext
and encapsulates one audio graph.
debug
: enables debug mode. In debug mode, all contained RComponents
will render debug HTML.onInit
: a function which is called when the AudioContext
is initialised. The context is passed to it as the first argument. Useful for inspecting the context/decoding audio on demand.Base class for all components requiring an AudioContext
. If a RComponent
is placed outside an RAudioContext
, a ReferenceError
is thrown.
Inherits from RComponent
and manages the lifecycle, connections and updates to an audio node.
connectToParam
: specifies a parameter of the destination node which the current node should connect to. If not specified, the node connects to the destination's input.connectFromChannel
: specifies the channel of the node's output signal which should connect to the destination.connectToChannel
: specifies the input channel of the destination which the node should connect to.transitionTime
: if specified, updates to params will be executed as a ramp over the specified time (in seconds). Use an object to specify different times for different params, like so:<RBiquadFilter frequency={220} gain={1.1} transitionTime={ { frequency: 0.5, gain: 0.3 } } />
transitionCurve
: sets the curve used for ramps an be set either to linear
or exponential
. Use an object to specify different curves for different params.disconnected
: a boolean attribute determining whether the node should connect to its destination or not.Inherits from RAudioNode
. Represents any RAudioNode
that can be connected to. Handles disconnection from parent nodes in a pipeline.
Inherits from RAudioNode
. Components which wrap nodes inheriting from the AudioScheduledSourceNode
class in Web Audio inherit from RScheduledSource
.
start
: time when playback should be scheduled (in seconds). If not specified, playback will not start.stop
: time when playback end should be scheduled (in seconds). If not specified, playback will either stop automatically (in case of a non-looped buffer source node) or will not stop until the node is removed, or a new stop time specified (in case of an oscillator, or a constant source node).Connects its children in a series, i.e. for a list of children [A,B,C] the connections will be A -> B -> C.
In a RPipeline
, if a non-connectable node appears between two other nodes, an inbound branch must be created. Consider the following graph configuration:
<RPipeline> <ROscillator start={0} frequency={440} /> <RBiquadFilter frequency={5000} /> <ROscillator start={0} frequency={2} connectToParam="gain" /> <RGain gain={0.5} /> </RPipeline>
The pipeline is resolved from the end, so RGain
will be connected to the nearest preceding connectable node – RBiquadFilter
. The second oscillator will constitute an in- bound branch and connect to the gain
parameter of RGain
. The resulting graph is depicted below:
Connects its children in parallel, i.e. the input will be connected to each child, and each child will be connected to the destination.
Connects every child to the child itself, as well as the destination.
A composite component which connects children in parallel (like RSplit
), and distributes the input signal channels to individual children.
channelCount
: maximum number of channels to distributeAn "abstract" component which can be subclassed to create custom reusable r-audio components (subgraphs). The reason for its existence is the fact that r-audio can only work with components which are subclassing RComponent
.
The subgraph is declared by overriding the renderGraph
method. Under the hood, it's essentially just a pipeline which renders custom content instead of its children.
The props can be set arbitrarily and mapped onto various props within the subgraph.
First, you need to create a subclass of RExtensible
and override the renderGraph
method, returning your subgraph.
class DelayLine extends RExtensible { renderGraph() { return ( <RCycle> <RPipeline> <RGain gain={this.props.gain}/> <RDelay delayTime={this.props.delayTime}/> </RPipeline> </RCycle> ); } }
You can then use the custom component in a r-audio graph, passing custom props as desired:
render() { return ( <RAudioContext> <RPipeline> <DelayLine gain={0.7} delayTime={0.3} /> </RPipeline> </RAudioContext> ); }
These components correspond to non-deprecated AudioNode
s in Web Audio. Unless specified otherwise, their props are inherited from ancestor classes + identical to properties of the Web Audio objects.
extends RConnectableNode
Corresponds to Web Audio AnalyserNode
.
If the child is a function, it will be called every time the component is rendered. The first argument will be a proxy object with the following methods:
getFloatFrequencyData
getByteFrequencyData
getFloatTimeDomainData
getByteTimeDomainData
extends RConnectableNode
Corresponds to Web Audio AudioWorkletNode
.
worklet
(String): the name of an instantiated AudioWorklet
module.AudioParam
s specified by the workletextends RConnectableNode
Corresponds to Web Audio AnalyserNode
.
If the child is a function, it will be called every time the component is rendered. The first argument will be a proxy object with the following methods:
getFrequencyResponse
extends RScheduledSource
Corresponds to Web Audio BufferSourceNode
.
extends RConnectableNode
Corresponds to Web Audio ChannelMerger
. Note: if multiple nodes connect to RChannelMerger
, each incoming connection is connected to a different channel
extends RConnectableNode
Corresponds to Web Audio ChannelSplitter
. Note: if RChannelSplitter
connects to multiple nodes, each outgoing connection is connected from a different channel
extends RScheduledSource
Corresponds to Web Audio ConstantSourceNode
.
extends RConnectableNode
Corresponds to Web Audio ConvolverNode
.
extends RConnectableNode
Corresponds to Web Audio DelayNode
.
extends RConnectableNode
Corresponds to Web Audio DynamicsCompressorNode
.
extends RConnectableNode
Corresponds to Web Audio GainNode
.
extends RConnectableNode
Corresponds to Web Audio IIRFilterNode
.
If the child is a function, it will be called every time the component is rendered. The first argument will be a proxy object with the following methods:
getFrequencyResponse
extends RAudioNode
Corresponds to Web Audio MediaElementSourceNode
.
element
: a HTMLMediaElement
used to construct the nodeextends RAudioNode
Corresponds to Web Audio MediaStreamSourceNode
.
stream
: a MediaStream
used to construct the nodeextends RScheduledSource
Corresponds to Web Audio OscillatorNode
.
extends RConnectableNode
Corresponds to Web Audio StereoPannerNode
.
extends RConnectableNode
Corresponds to Web Audio PannerNode
.
extends RConnectableNode
Corresponds to Web Audio WaveShaperNode
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4