AudioStreamPlayer

Inherits: Node < Object Plays back audio non-positionally.

Description

Plays an audio stream non-positionally. AudioStreamPlayer2D or AudioStreamPlayer3D instead of AudioStreamPlayer.

Tutorials

  • Audio streams
  • 2D Dodge The Creeps Demo
  • Audio Device Changer Demo
  • Audio Generator Demo
  • Audio Mic Record Demo
  • Audio Spectrum Demo

    Properties

    Methods

    Signals

  • finished ( ) Emitted when the audio stops playing.

    Enumerations

    MixTarget:
  • MIX_TARGET_STEREO = 0 —- The audio will be played only on the first channel.
  • MIX_TARGET_SURROUND = 1 —- The audio will be played on all surround channels.
  • MIX_TARGET_CENTER = 2 —- The audio will be played on the second channel, which is usually the center.

    Property Descriptions

  • bool autoplay true, audio plays when added to scene tree.

  • String bus Bus on which this audio is playing. Note: When setting this property, keep in mind that no validation is performed to see if the given name matches an existing bus. This is because audio bus layouts might be loaded after this property is set. If this given name can’t be resolved at runtime, it will fall back to "Master".

  • MixTarget mix_target MixTarget constants.

  • float pitch_scale The pitch and the tempo of the audio, as a multiplier of the audio sample’s sample rate.

  • bool playing true, audio is playing.

  • AudioStream stream AudioStream object to be played.

  • bool stream_paused true, the playback is paused. You can resume it by setting stream_paused to false.

  • float volume_db Volume of sound, in dB.

    Method Descriptions

  • float get_playback_position ( ) AudioStream in seconds.

  • AudioStreamPlayback get_stream_playback ( ) AudioStreamPlayback object associated with this AudioStreamPlayer.

  • play ( float from_position=0.0 ) from_position, in seconds.

  • seek ( float to_position ) Sets the position from which audio will be played, in seconds.

  • stop ( ) Stops the audio.