Work in progress
The content of this page was not yet updated for Godot
4.6
and may be outdated. If you know how to improve this page or you can confirm
that it's up to date, feel free to open a pull request.
Corriente de Audio
Introducción
Como ya habrán leído en Buses de audio, el sonido se envía a cada bus a través de un nodo AudioStreamPlayer. Hay diferentes tipos de AudioStreamPlayer. Cada uno carga un AudioStream y lo reproduce.
AudioStream
Un flujo de audio es un objeto abstracto que emite sonido. El sonido puede provenir de muchos lugares, pero generalmente se carga desde el sistema de archivos. Los archivos de audio se pueden cargar como AudioStreams y colocarse dentro de un AudioStreamPlayer. Puedes encontrar información sobre formatos compatibles y diferencias en Importar muestras de audio.
There are other types of AudioStreams, such as AudioStreamRandomizer. This one picks a different audio stream from a list of streams each time it's played back, and applies random pitch and volume shifting. This can be helpful for adding variation to sounds that are played back often.
AudioStreamPlayer
Este es el reproductor de stream estándar, no posicional. Puedes reproducirse en cualquier bus. En configuraciones de sonido 5.1, puede enviar audio a la mezcla estéreo o a los altavoces frontales.
Playback Type is an experimental setting, and could change in future versions of Godot. It exists so Web exports use Web Audio-API based samples instead of streaming all sounds to the browser, unlike most platforms. This prevents the audio from being garbled in single-threaded Web exports. By default, only the Web platform will use samples. Changing this setting is not recommended, unless you have an explicit reason to. You can change the default playback type for the web and other platforms in the project settings under Audio > General (advanced settings must be turned on to see the setting).
AudioStreamPlayer2D
Es una variante del AudioStreamPlayer, pero emite sonido en un entorno de posición 2D. Cuando esté cerca de la izquierda de la pantalla, la panorámica irá hacia la izquierda. Cuando esté cerca del lado derecho, irá a la derecha.
Nota
Area2Ds puede utilizarse para desviar el sonido de cualquier AudioStreamPlayer2Ds que contengan a buses específicos. Esto permite crear buses con diferentes calidades de reverberación o sonido para manejar la acción que ocurre en una parte determinada del mundo del juego.
AudioStreamPlayer3D
Es una variante del AudioStreamPlayer, pero emite sonido en un entorno posicional 3D. Dependiendo de la ubicación del reproductor con respecto a la pantalla, puede posicionar el sonido en estéreo, 5.1 o 7.1 dependiendo de la configuración de audio elegida.
Similar to AudioStreamPlayer2D, an Area3D can divert the sound to an audio bus.
A diferencia de la 2D, la versión 3D de AudioStreamPlayer tiene algunas opciones más avanzadas:
Buses de reverberación
Advertencia
This feature is not supported on the web platform if the AudioStreamPlayer's playback mode is set to Sample, which is the default. It will only work if the playback mode is set to Stream, at the cost of increased latency if threads are not enabled.
See Audio playback in the Exporting for the Web documentation for details.
Godot allows for 3D audio streams that enter a specific Area3D 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 Area3D's properties:
At the same time, a special bus layout is created where each Area3D receives the reverb info from each Area3D. A Reverb effect needs to be created and configured in each reverb bus to complete the setup for the desired effect:
The Area3D'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
Advertencia
This feature is not supported on the web platform if the AudioStreamPlayer's playback mode is set to Sample, which is the default. It will only work if the playback mode is set to Stream, at the cost of increased latency if threads are not enabled.
See Audio playback in the Exporting for the Web documentation for details.
Cuando la velocidad relativa entre un emisor y un oyente cambia, esto se percibe como un aumento o disminución del tono del sonido emitido. Godot puede rastrear los cambios de velocidad en los nodos AudioStreamPlayer3D y Camera. Ambos nodos tienen esta propiedad, que debe ser activada manualmente:
Habilítalo configurándolo en función de cómo se moverán los objetos: usa Idle para los objetos movidos mediante _process, o Physics para los objetos movidos mediante _physics_process. El rastreo ocurrirá automáticamente.