:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStream.xml. .. _class_AudioStream: AudioStream =========== **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` **Inherited By:** :ref:`AudioStreamGenerator`, :ref:`AudioStreamInteractive`, :ref:`AudioStreamMicrophone`, :ref:`AudioStreamMP3`, :ref:`AudioStreamOggVorbis`, :ref:`AudioStreamPlaylist`, :ref:`AudioStreamPolyphonic`, :ref:`AudioStreamRandomizer`, :ref:`AudioStreamSynchronized`, :ref:`AudioStreamWAV` Base class for audio streams. .. rst-class:: classref-introduction-group Description ----------- Base class for audio streams. Audio streams are used for sound effects and music playback, and support WAV (via :ref:`AudioStreamWAV`) and Ogg (via :ref:`AudioStreamOggVorbis`) file formats. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Audio streams <../tutorials/audio/audio_streams>` - `Audio Generator Demo `__ - `Audio Microphone Record Demo `__ - `Audio Spectrum Visualizer Demo `__ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`_get_bar_beats`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`_get_beat_count`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_get_bpm`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_get_length`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`Dictionary`\] | :ref:`_get_parameter_list`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`_get_stream_name`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`_get_tags`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_has_loop`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`AudioStreamPlayback` | :ref:`_instantiate_playback`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_is_monophonic`\ (\ ) |virtual| |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_be_sampled`\ (\ ) |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`AudioSample` | :ref:`generate_sample`\ (\ ) |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_length`\ (\ ) |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`AudioStreamPlayback` | :ref:`instantiate_playback`\ (\ ) | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_meta_stream`\ (\ ) |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_monophonic`\ (\ ) |const| | +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_AudioStream_signal_parameter_list_changed: .. rst-class:: classref-signal **parameter_list_changed**\ (\ ) :ref:`🔗` Signal to be emitted to notify when the parameter list changed. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_AudioStream_private_method__get_bar_beats: .. rst-class:: classref-method :ref:`int` **_get_bar_beats**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to return the bar beats of this stream. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__get_beat_count: .. rst-class:: classref-method :ref:`int` **_get_beat_count**\ (\ ) |virtual| |const| :ref:`🔗` Overridable method. Should return the total number of beats of this audio stream. Used by the engine to determine the position of every beat. Ideally, the returned value should be based off the stream's sample rate (:ref:`AudioStreamWAV.mix_rate`, for example). .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__get_bpm: .. rst-class:: classref-method :ref:`float` **_get_bpm**\ (\ ) |virtual| |const| :ref:`🔗` Overridable method. Should return the tempo of this audio stream, in beats per minute (BPM). Used by the engine to determine the position of every beat. Ideally, the returned value should be based off the stream's sample rate (:ref:`AudioStreamWAV.mix_rate`, for example). .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__get_length: .. rst-class:: classref-method :ref:`float` **_get_length**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to customize the returned value of :ref:`get_length()`. Should return the length of this audio stream, in seconds. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__get_parameter_list: .. rst-class:: classref-method :ref:`Array`\[:ref:`Dictionary`\] **_get_parameter_list**\ (\ ) |virtual| |const| :ref:`🔗` Return the controllable parameters of this stream. This array contains dictionaries with a property info description format (see :ref:`Object.get_property_list()`). Additionally, the default value for this parameter must be added tho each dictionary in "default_value" field. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__get_stream_name: .. rst-class:: classref-method :ref:`String` **_get_stream_name**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to customize the name assigned to this audio stream. Unused by the engine. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__get_tags: .. rst-class:: classref-method :ref:`Dictionary` **_get_tags**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to customize the tags for this audio stream. Should return a :ref:`Dictionary` of strings with the tag as the key and its content as the value. Commonly used tags include ``title``, ``artist``, ``album``, ``tracknumber``, and ``date``. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__has_loop: .. rst-class:: classref-method :ref:`bool` **_has_loop**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to return ``true`` if this stream has a loop. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__instantiate_playback: .. rst-class:: classref-method :ref:`AudioStreamPlayback` **_instantiate_playback**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to customize the returned value of :ref:`instantiate_playback()`. Should return a new :ref:`AudioStreamPlayback` created when the stream is played (such as by an :ref:`AudioStreamPlayer`). .. rst-class:: classref-item-separator ---- .. _class_AudioStream_private_method__is_monophonic: .. rst-class:: classref-method :ref:`bool` **_is_monophonic**\ (\ ) |virtual| |const| :ref:`🔗` Override this method to customize the returned value of :ref:`is_monophonic()`. Should return ``true`` if this audio stream only supports one channel. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_method_can_be_sampled: .. rst-class:: classref-method :ref:`bool` **can_be_sampled**\ (\ ) |const| :ref:`🔗` **Experimental:** This method may be changed or removed in future versions. Returns if the current **AudioStream** can be used as a sample. Only static streams can be sampled. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_method_generate_sample: .. rst-class:: classref-method :ref:`AudioSample` **generate_sample**\ (\ ) |const| :ref:`🔗` **Experimental:** This method may be changed or removed in future versions. Generates an :ref:`AudioSample` based on the current stream. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_method_get_length: .. rst-class:: classref-method :ref:`float` **get_length**\ (\ ) |const| :ref:`🔗` Returns the length of the audio stream in seconds. If this stream is an :ref:`AudioStreamRandomizer`, returns the length of the last played stream. If this stream has an indefinite length (such as for :ref:`AudioStreamGenerator` and :ref:`AudioStreamMicrophone`), returns ``0.0``. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_method_instantiate_playback: .. rst-class:: classref-method :ref:`AudioStreamPlayback` **instantiate_playback**\ (\ ) :ref:`🔗` Returns a newly created :ref:`AudioStreamPlayback` intended to play this audio stream. Useful for when you want to extend :ref:`_instantiate_playback()` but call :ref:`instantiate_playback()` from an internally held AudioStream subresource. An example of this can be found in the source code for ``AudioStreamRandomPitch::instantiate_playback``. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_method_is_meta_stream: .. rst-class:: classref-method :ref:`bool` **is_meta_stream**\ (\ ) |const| :ref:`🔗` Returns ``true`` if the stream is a collection of other streams, ``false`` otherwise. .. rst-class:: classref-item-separator ---- .. _class_AudioStream_method_is_monophonic: .. rst-class:: classref-method :ref:`bool` **is_monophonic**\ (\ ) |const| :ref:`🔗` Returns ``true`` if this audio stream only supports one channel (*monophony*), or ``false`` if the audio stream supports two or more channels (*polyphony*). .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`