Recording with microphone
A simple demo is included in the official demo projects and will be used as support for this tutorial: .
The demo consists of a single scene. This scene includes two major parts: the GUI and the audio.
We will focus on the audio part. In this demo, a bus named with the effect Record
is created to handle the audio recording. An AudioStreamPlayer
named AudioStreamRecord
is used for recording.
GDScript
The audio recording is handled by the AudioEffectRecord resource which has three methods: , is_recording_active(), and .
GDScript
On the next button press, as effect.is_recording_active()
is true
, the recorded stream can be stored into the variable by calling effect.get_recording()
.
GDScript
To playback the recording, you assign the recording as the stream of the AudioStreamPlayer
and call play()
.
To save the recording, you call with the path to a file. In this demo, the path is defined by the user via a LineEdit
input box.