Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ResourceImporterMP3

Наследует: ResourceImporter < RefCounted < Object

Импортирует аудиофайл MP3 для воспроизведения.

Описание

MP3 — это формат аудио с потерями, с худшим качеством звука по сравнению с ResourceImporterOggVorbis при заданном битрейте.

В большинстве случаев рекомендуется использовать Ogg Vorbis вместо MP3. Однако, если вы используете источник звука MP3 без более качественного источника, рекомендуется использовать файл MP3 напрямую, чтобы избежать двойного сжатия с потерями.

MP3 требует больше ресурсов ЦП для декодирования, чем ResourceImporterWAV. Если вам нужно воспроизводить много одновременных звуков, рекомендуется использовать для этих звуков WAV, особенно если вы ориентируетесь на бюджетные устройства.

Обучающие материалы

Свойства

int

bar_beats

4

int

beat_count

0

float

bpm

0

bool

loop

false

float

loop_offset

0


Описания свойств

int bar_beats = 4 🔗

The number of beats within a single bar in the audio track. This is only relevant for music that wishes to make use of interactive music functionality, not sound effects.

A more convenient editor for bar_beats is provided in the Advanced Import Settings dialog, as it lets you preview your changes without having to reimport the audio.


int beat_count = 0 🔗

The length of the audio track, in beats. The actual duration of the audio file might be longer than what is indicated by this property. This is only relevant for music that wishes to make use of interactive music functionality, not sound effects.

A more convenient editor for beat_count is provided in the Advanced Import Settings dialog, as it lets you preview your changes without having to reimport the audio.


float bpm = 0 🔗

The tempo of the audio track, measured in beats per minute. This should match the BPM measure that was used to compose the track. This is only relevant for music that wishes to make use of interactive music functionality, not sound effects.

A more convenient editor for bpm is provided in the Advanced Import Settings dialog, as it lets you preview your changes without having to reimport the audio.


bool loop = false 🔗

If enabled, the audio will begin playing either from the beginning or from loop_offset, after playback ends by either reaching the end of the audio or reaching the end of the last beat according to the amount specified in beat_count.

Note: In AudioStreamPlayer, the AudioStreamPlayer.finished signal won't be emitted for looping audio when it reaches the end of the audio file, as the audio will keep playing indefinitely.


float loop_offset = 0 🔗

Определяет, где аудио начнет цикл после того, как воспроизведение достигнет конца аудио. Это можно использовать для циклического воспроизведения только части аудиофайла, что полезно для некоторых окружающих звуков или музыки. Значение определяется в секундах относительно начала аудио. Значение 0.0 зациклит весь аудиофайл.

Действует только в том случае, если loop равно true.

Более удобный редактор для loop_offset представлен в диалоговом окне Расширенные параметры импорта, поскольку он позволяет предварительно просматривать изменения без необходимости повторного импорта аудио.