Tone.UserMedia
↳ EXTENDS Tone.AudioNodeTone.UserMedia uses MediaDevices.getUserMedia to open up and external microphone or audio input. Check MediaDevices API Support to see which browsers are supported. Access to an external input is limited to secure (HTTPS) connections.
DEFAULTS
EXAMPLE
Members
.deviceId
↝ String READONLY #Returns an identifier for the represented device that is persisted across sessions. It is un-guessable by other applications and unique to the origin of the calling application. It is reset when the user clears cookies (for Private Browsing, a different identifier is used that is not persisted across sessions). Returns undefined when the device is not open.
.groupId
↝ String READONLY #Returns a group identifier. Two devices have the same group identifier if they belong to the same physical device. Returns undefined when the device is not open.
.groupId
↝ String READONLY #Returns a label describing this device (for example “Built-in Microphone”). Returns undefined when the device is not open or label is not available because of permissions.
.state
↝ Tone.State READONLY #Returns the playback state of the source, “started” when the microphone is open and “stopped” when the mic is closed.
.channelCountMode
↝ String READONLY #channelCountMode determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node. The default value is “max”. This attribute has no effect for nodes with no inputs.
.channelInterpretation
↝ String READONLY #channelInterpretation determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. The default value is “speakers”.
.context
↝ Tone.Context READONLY #Get the audio context belonging to this instance.
.channelCount
↝ Number READONLY #channelCount is the number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined.
.numberOfInputs
↝ Number READONLY #The number of inputs feeding into the AudioNode. For source nodes, this will be 0.
.numberOfOutputs
↝ Number READONLY #The number of outputs coming out of the AudioNode.
Methods
.open ( )
#The label or id of the audio input media device. With no argument, the default stream is opened.
The promise is resolved when the stream is open.
Open the media stream. If a string is passed in, it is assumed to be the label or id of the stream, if a number is passed in, it is the input number of the stream.
.chain ( )
#this
Connect the output of this node to the rest of the nodes in series.
EXAMPLE
.toMaster ( )
#this
Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)
EXAMPLE
.connect ( )
#optionally which output to connect from
optionally which input to connect to
this
connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode
.disconnect ( )
#Either the output index to disconnect if the output is an array, or the node to disconnect from.
this
disconnect the output
.fan ( )
#this
connect the output of this node to the rest of the nodes in parallel.