:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/AudioEffectCapture.xml. .. _class_AudioEffectCapture: AudioEffectCapture ================== **Inherits:** :ref:`AudioEffect` **<** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` Captures audio from an audio bus in real-time. .. rst-class:: classref-introduction-group Description ----------- AudioEffectCapture is an AudioEffect which copies all audio frames from the attached audio effect bus into its internal ring buffer. Application code should consume these audio frames from this ring buffer using :ref:`get_buffer` and process it as needed, for example to capture data from an :ref:`AudioStreamMicrophone`, implement application-defined effects, or to transmit audio over the network. When capturing audio data from a microphone, the format of the samples will be stereo 32-bit floating point PCM. \ **Note:** :ref:`ProjectSettings.audio/enable_audio_input` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Audio buses <../tutorials/audio/audio_buses>` - `Audio Mic Record Demo `__ .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------+-----------------------------------------------------------------------+---------+ | :ref:`float` | :ref:`buffer_length` | ``0.1`` | +---------------------------+-----------------------------------------------------------------------+---------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_get_buffer` **(** :ref:`int` frames **)** |const| | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_buffer` **(** **)** | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolVector2Array` | :ref:`get_buffer` **(** :ref:`int` frames **)** | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_buffer_length_frames` **(** **)** |const| | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_discarded_frames` **(** **)** |const| | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_frames_available` **(** **)** |const| | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_pushed_frames` **(** **)** |const| | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_AudioEffectCapture_property_buffer_length: .. rst-class:: classref-property :ref:`float` **buffer_length** = ``0.1`` .. rst-class:: classref-property-setget - void **set_buffer_length** **(** :ref:`float` value **)** - :ref:`float` **get_buffer_length** **(** **)** Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect if already initialized. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_AudioEffectCapture_method_can_get_buffer: .. rst-class:: classref-method :ref:`bool` **can_get_buffer** **(** :ref:`int` frames **)** |const| Returns ``true`` if at least ``frames`` audio frames are available to read in the internal ring buffer. .. rst-class:: classref-item-separator ---- .. _class_AudioEffectCapture_method_clear_buffer: .. rst-class:: classref-method void **clear_buffer** **(** **)** Clears the internal ring buffer. .. rst-class:: classref-item-separator ---- .. _class_AudioEffectCapture_method_get_buffer: .. rst-class:: classref-method :ref:`PoolVector2Array` **get_buffer** **(** :ref:`int` frames **)** Gets the next ``frames`` audio samples from the internal ring buffer. Returns a :ref:`PoolVector2Array` containing exactly ``frames`` audio samples if available, or an empty :ref:`PoolVector2Array` if insufficient data was available. .. rst-class:: classref-item-separator ---- .. _class_AudioEffectCapture_method_get_buffer_length_frames: .. rst-class:: classref-method :ref:`int` **get_buffer_length_frames** **(** **)** |const| Returns the total size of the internal ring buffer in frames. .. rst-class:: classref-item-separator ---- .. _class_AudioEffectCapture_method_get_discarded_frames: .. rst-class:: classref-method :ref:`int` **get_discarded_frames** **(** **)** |const| Returns the number of audio frames discarded from the audio bus due to full buffer. .. rst-class:: classref-item-separator ---- .. _class_AudioEffectCapture_method_get_frames_available: .. rst-class:: classref-method :ref:`int` **get_frames_available** **(** **)** |const| Returns the number of frames available to read using :ref:`get_buffer`. .. rst-class:: classref-item-separator ---- .. _class_AudioEffectCapture_method_get_pushed_frames: .. rst-class:: classref-method :ref:`int` **get_pushed_frames** **(** **)** |const| Returns the number of audio frames inserted from the audio bus. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |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.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`