Class

org.scalajs.dom.raw

AudioContext

Related Doc: package raw

Permalink

class AudioContext extends EventTarget

The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context.

An AudioContext can be a target of events, therefore it implements the EventTarget interface.

Annotations
@RawJSType() @native() @JSGlobal()
Linear Supertypes
EventTarget, Object, Any, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AudioContext
  2. EventTarget
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AudioContext()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addEventListener[T <: Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    Permalink

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

    MDN

    Definition Classes
    EventTarget
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def close(): scala.scalajs.js.Promise[Unit]

    Permalink

    Closes the audio context, releasing any system audio resources that it uses.

  8. def createAnalyser(): AnalyserNode

    Permalink

    Creates an AnalyserNode, which can be used to expose audio time and frequency data and for example to create data visualisations.

  9. def createBiquadFilter(): BiquadFilterNode

    Permalink

    Creates a BiquadFilterNode, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc.

  10. def createBuffer(numOfChannels: Int, length: Int, sampleRate: Int): AudioBuffer

    Permalink

    Creates a new, empty AudioBuffer object, which can then be populated by data and played via an AudioBufferSourceNode.

    Creates a new, empty AudioBuffer object, which can then be populated by data and played via an AudioBufferSourceNode.

    numOfChannels

    An integer representing the number of channels this buffer should have. Implementations must support a minimum 32 channels.

    length

    An integer representing the size of the buffer in sample-frames.

    sampleRate

    The sample-rate of the linear audio data in sample-frames per second. An implementation must support sample-rates in at least the range 22050 to 96000.

  11. def createBufferSource(): AudioBufferSourceNode

    Permalink

    Creates an AudioBufferSourceNode, which can be used to play and manipulate audio data contained within an AudioBuffer object.

    Creates an AudioBufferSourceNode, which can be used to play and manipulate audio data contained within an AudioBuffer object. AudioBuffers are created using AudioContext.createBuffer or returned by AudioContext.decodeAudioData when it successfully decodes an audio track.

  12. def createChannelMerger(numberOfInputs: Int = 6): ChannelMergerNode

    Permalink

    Creates a ChannelMergerNode, which is used to combine channels from multiple audio streams into a single audio stream.

    Creates a ChannelMergerNode, which is used to combine channels from multiple audio streams into a single audio stream.

    numberOfInputs

    The number of channels in the input audio streams, which the output stream will contain; the default is 6 is this parameter is not specified.

  13. def createChannelSplitter(numberOfOutputs: Int = 6): ChannelSplitterNode

    Permalink

    Creates a ChannelSplitterNode, which is used to access the individual channels of an audio stream and process them separately.

    Creates a ChannelSplitterNode, which is used to access the individual channels of an audio stream and process them separately.

    numberOfOutputs

    The number of channels in the input audio stream that you want to output separately; the default is 6 is this parameter is not specified.

  14. def createConvolver(): ConvolverNode

    Permalink

    Creates a ConvolverNode, which can be used to apply convolution effects to your audio graph, for example a reverberation effect.

  15. def createDelay(maxDelayTime: Int): DelayNode

    Permalink

    Creates a DelayNode, which is used to delay the incoming audio signal by a certain amount.

    Creates a DelayNode, which is used to delay the incoming audio signal by a certain amount. This node is also useful to create feedback loops in a Web Audio API graph.

    maxDelayTime

    The maximum amount of time, in seconds, that the audio signal can be delayed by. The default value is 0.

  16. def createDynamicsCompressor(): DynamicsCompressorNode

    Permalink

    Creates a DynamicsCompressorNode, which can be used to apply acoustic compression to an audio signal.

  17. def createGain(): GainNode

    Permalink

    Creates a GainNode, which can be used to control the overall volume of the audio graph.

  18. def createMediaElementSource(myMediaElement: HTMLMediaElement): MediaElementAudioSourceNode

    Permalink

    Creates a MediaElementAudioSourceNode associated with an HTMLMediaElement.

    Creates a MediaElementAudioSourceNode associated with an HTMLMediaElement. This can be used to play and manipulate audio from <video> or <audio> elements.

    myMediaElement

    An HTMLMediaElement object that you want to feed into an audio processing graph to manipulate.

  19. def createMediaStreamDestination(): MediaStreamAudioDestinationNode

    Permalink

    Creates a MediaStreamAudioDestinationNode associated with a MediaStream representing an audio stream which may be stored in a local file or sent to another computer.

  20. def createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode

    Permalink

    Creates a MediaStreamAudioSourceNode associated with a MediaStream representing an audio stream which may come from the local computer microphone or other sources.

    Creates a MediaStreamAudioSourceNode associated with a MediaStream representing an audio stream which may come from the local computer microphone or other sources.

    stream

    A MediaStream object that you want to feed into an audio processing graph to manipulate.

  21. def createOscillator(): OscillatorNode

    Permalink

    Creates an OscillatorNode, a source representing a periodic waveform.

    Creates an OscillatorNode, a source representing a periodic waveform. It basically generates a tone.

  22. def createPanner(): PannerNode

    Permalink

    Creates a PannerNode, which is used to spatialise an incoming audio stream in 3D space.

  23. def createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave

    Permalink

    Creates a PeriodicWave, used to define a periodic waveform that can be used to determine the output of an OscillatorNode.

  24. def createStereoPanner(): StereoPannerNode

    Permalink

    Creates a StereoPannerNode, which can be used to apply stereo panning to an audio source.

  25. def createWaveShaper(): WaveShaperNode

    Permalink

    Creates a WaveShaperNode, which is used to implement non-linear distortion effects.

  26. def currentTime: Double

    Permalink

    Returns a double representing an ever-increasing hardware time in seconds used for scheduling.

    Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at 0 and cannot be stopped, paused or reset.

  27. def decodeAudioData(audioData: ArrayBuffer, successCallback: Function1[AudioBuffer, _] = js.native, errorCallback: Function0[_] = js.native): scala.scalajs.js.Promise[AudioBuffer]

    Permalink

    Asynchronously decodes audio file data contained in an ArrayBuffer.

    Asynchronously decodes audio file data contained in an ArrayBuffer. In this case, the ArrayBuffer is usually loaded from an XMLHttpRequest's response attribute after setting the responseType to arraybuffer. This method only works on complete files, not fragments of audio files.

    audioData

    An ArrayBuffer containing the audio data to be decoded, usually grabbed from an XMLHttpRequest's response attribute after setting the responseType to arraybuffer.

    successCallback

    A callback function to be invoked when the decoding successfully finishes. The single argument to this callback is an AudioBuffer representing the decoded PCM audio data. Usually you'll want to put the decoded data into an AudioBufferSourceNode, from which it can be played and manipulated how you want.

    errorCallback

    An optional error callback, to be invoked if an error occurs when the audio data is being decoded.

  28. val destination: AudioDestinationNode

    Permalink

    Returns an AudioDestinationNode representing the final destination of all audio in the context.

    Returns an AudioDestinationNode representing the final destination of all audio in the context. It can be thought of as the audio-rendering device.

  29. def dispatchEvent(evt: Event): Boolean

    Permalink

    Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order.

    Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

    MDN

    Definition Classes
    EventTarget
  30. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  32. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  33. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  34. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  35. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  36. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  37. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  38. val listener: AudioListener

    Permalink

    Returns the AudioListener object, used for 3D spatialization.

  39. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  40. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  41. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  42. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  43. def removeEventListener[T <: Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    Permalink

    Removes the event listener previously registered with EventTarget.addEventListener.

    Removes the event listener previously registered with EventTarget.addEventListener.

    MDN

    Definition Classes
    EventTarget
  44. def resume(): scala.scalajs.js.Promise[Unit]

    Permalink

    Resumes the progression of time in an audio context that has previously been suspended.

  45. val sampleRate: Double

    Permalink

    Returns a float representing the sample rate (in samples per second) used by all nodes in this context.

    Returns a float representing the sample rate (in samples per second) used by all nodes in this context. The sample-rate of an AudioContext cannot be changed.

  46. def state: String

    Permalink

    Returns the current state of the AudioContext.

  47. def suspend(): scala.scalajs.js.Promise[Unit]

    Permalink

    Suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing CPU/battery usage in the process.

  48. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  49. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  50. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  51. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  52. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from EventTarget

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped