BB.AudioStream

A module for streaming user audio ( getUserMedia )

Index

Properties

Constructor

BB.AudioStream
(
  • config
)

Parameters:

  • config Object

    An optional config object to initialize the Stream, can contain the following:  {
        context: BB.Audio.context[2], // choose specific context
        connect: fft, // overide default destination
        autostart: true // will automatically start the stream
     }

Example:


 BB.Audio.init();

 var mic = new BB.AudioStream();


BB.AudioStream ( represented by Gain below ) connects to BB.Audio.context by default

Properties

ctx AudioContext default:BB.Audio.context

the Audio Context this derived from

gain GainNode private

the "output" gain node ( use .volume, .setGain() to interface with this )

stream LocalMEdiaStream default:null

the Audio Stream

volume Number default:1

the master volume (of output gain node)

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

connect
(
  • destination
  • output
  • input
)

connects the Noise to a particular AudioNode or AudioDestinationNode

Parameters:

  • destination AudioNode

    the AudioNode or AudioDestinationNode to connect to

  • output Number

    which output of the the Noise do you want to connect to the destination

  • input Number

    which input of the destination you want to connect the Noise to

Example:


 BB.Audio.init();

 var node = new BB.AudioBase({
    volume: 0.75,
 });

  node.connect( exampleNode );
  // connected to both default BB.Audio.context && exampleNode
  // so if exampleNode is also connected to BB.Audio.context by default,
  // ...then you've got node connected to BB.Audio.context twice

...which looks like this ( where the first Gain is the Noise and the second is the exampleNode )

disconnect
(
  • destination
  • output
  • input
)

diconnects the Noise from the node it's connected to

Parameters:

  • destination AudioNode

    what it's connected to

  • output Number

    the particular output number

  • input Number

    the particular input number
     BB.Audio.init();

     var node = new BB.AudioBase({
        volume: 0.75,
     });

     node.disconnect(); // disconnected from default BB.Audio.context
     node.connect( exampleNode ); // connected to exampleNode only

    ...which looks like this ( where the first Gain is the node and the second is the exampleNode )

setGain
(
  • num
  • ramp
)

sets the gain level of the node ( in a sense, master volume control )

Parameters:

  • num Number

    a float value, 1 being the default volume, below 1 decreses the volume, above one pushes the gain

  • ramp Number

    value in seconds for how quickly/slowly to ramp to the new value (num) specified

Example:


 BB.Audio.init();

 var node = new BB.AudioBase({
    volume: 0.75
 });

  node.setGain( 0.25, 2 ); // lower's volume from 0.75 to 0.25 in 2 seconds
// if no ramp value is needed, you could alternatively do
  node.volume = 0.5; // immediately jumps from 0.25 to 0.5

start ()

starts the stream

Example:

 // assuming "mic" is an instanceof BB.AudioStream
 if(!mic.stream) mic.open();

start ()

stops the stream

Example:

 // assuming "mic" is an instanceof BB.AudioStream
 if(mic.stream) mic.close();

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index