Recording with microphone¶
Godot supports in-game audio recording for Windows, macOS, Linux, Android and iOS.
A simple demo is included in the official demo projects and will be used as support for this tutorial: https://github.com/godotengine/godot-demo-projects/tree/master/audio/mic_record.
The structure of the demo¶
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
Record with the
Record is created to handle the audio recording.
AudioStreamRecord is used for recording.
The audio recording is handled by the class_AudioEffectRecord resource which has three methods: get_recording(), is_recording_active(), and set_recording_active().
At the start of the demo, the recording effect is not active. When the user
RecordButton, the effect is enabled with
On the next button press, as
the recorded stream can be stored into the
recording variable by calling
To playback the recording, you assign the recording as the stream of the
AudioStreamPlayer and call
To save the recording, you call
save_to_wav() with the path to a file.
In this demo, the path is defined by the user via a
LineEdit input box.