Fluxos de áudio

Introdução

Como você já deve ter lido em Barramentos de áudio, um som é enviado para cada barramento a partir de um nó AudioStreamPlayer. Existem diferentes tipos de AudioStreamPlayers. Cada um carrega um AudioStream e o reproduz.

AudioStream

An audio stream is an abstract object that emits sound. The sound can come from many places, but is most commonly loaded from the filesystem. Audio files can be loaded as AudioStreams and placed inside an AudioStreamPlayer. You can find information on supported formats and differences in Importando amostras de áudio.

There are other types of AudioStreams, such as AudioStreamRandomPitch. This one makes a random adjustment to the sound's pitch every time it's played back. This can be helpful for adding variation to sounds that are played back often.

AudioStreamPlayer

../../_images/audio_stream_player.png

Este é o reprodutor de stream padrão não posicional. Pode tocar em qualquer ônibus. Em configurações de som 5.1, ele pode enviar áudio para mixagem estéreo ou alto-falantes frontais.

AudioStreamPlayer2D

../../_images/audio_stream_2d.png

This is a variant of AudioStreamPlayer, but emits sound in a 2D positional environment. When close to the left of the screen, the panning will go left. When close to the right side, it will go right.

Nota

Area2Ds can be used to divert sound from any AudioStreamPlayer2Ds they contain to specific buses. This makes it possible to create buses with different reverb or sound qualities to handle action happening in a particular parts of your game world.

../../_images/audio_stream_2d_area.png

AudioStreamPlayer3D

../../_images/audio_stream_3d.png

Esta é uma variante do AudioStreamPlayer, mas emite som em um ambiente posicional 3D. Dependendo da localização do reprodutor em relação à tela, ele pode posicionar o som em estéreo 5.1 ou 7.1 dependendo da configuração de áudio escolhida.

Similar to AudioStreamPlayer2D, an Area can divert the sound to an audio bus.

../../_images/audio_stream_3d_area.png

Unlike for 2D, the 3D version of AudioStreamPlayer has a few more advanced options:

Reverb buses

Godot allows for 3D audio streams that enter a specific Area node to send dry and wet audio to separate buses. This is useful when you have several reverb configurations for different types of rooms. This is done by enabling this type of reverb in the Reverb Bus section of the Area's properties:

../../_images/audio_stream_reverb_bus.png

Ao mesmo tempo, um layout de barramento especial é criado, onde cada área recebe as informações de reverberação de cada área. Um efeito de reverberação precisa ser criado e configurado em cada barramento de reverberação para completar a configuração do efeito desejado:

../../_images/audio_stream_reverb_bus2.png

The Area's Reverb Bus section also has a parameter named Uniformity. Some types of rooms bounce sounds more than others (like a warehouse), so reverberation can be heard almost uniformly across the room even though the source may be far away. Playing around with this parameter can simulate that effect.

Doppler

When the relative velocity between an emitter and listener changes, this is perceived as an increase or decrease in the pitch of the emitted sound. Godot can track velocity changes in the AudioStreamPlayer3D and Camera nodes. Both nodes have this property, which must be enabled manually:

../../_images/audio_stream_doppler.png

Basta habilitá-lo, definindo-o dependendo de como os objetos serão movidos : Use idle para objetos movidos usando``_process``, ou Physics para objetos movidos usando _physics_process. O rastreamento ocorrerá automaticamente.