unreal.AudioComponent
¶
-
class
unreal.
AudioComponent
(outer=None, name='None')¶ Bases:
unreal.SceneComponent
AudioComponent is used to play a Sound https://docs.unrealengine.com/latest/INT/Audio/Overview/index.html: USoundBase:
C++ Source:
Module: Engine
File: AudioComponent.h
Editor Properties: (see get_editor_property/set_editor_property)
absolute_location
(bool): [Read-Write] If RelativeLocation should be considered relative to the world, rather than the parentabsolute_rotation
(bool): [Read-Write] If RelativeRotation should be considered relative to the world, rather than the parentabsolute_scale
(bool): [Read-Write] If RelativeScale3D should be considered relative to the world, rather than the parentallow_spatialization
(bool): [Read-Write] Overrides spatialization enablement in either the attenuation asset or on this audio component’s attenuation settings override.asset_user_data
(Array(AssetUserData)): [Read-Write] Array of user data stored with the componentattenuation_overrides
(SoundAttenuationSettings): [Read-Write] If bOverrideSettings is true, the attenuation properties to use for sounds generated by this componentattenuation_settings
(SoundAttenuation): [Read-Write] If bOverrideSettings is false, the asset to use to determine attenuation properties for sounds generated by this componentauto_activate
(bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.auto_attach_location_rule
(AttachmentRule): [Read-Write] Options for how we handle our location when we attach to the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment, EAttachmentRule:auto_attach_parent
(SceneComponent): [Read-Only] Component we automatically attach to when activated, if bAutoManageAttachment is true. If null during registration, we assign the existing AttachParent and defer attachment until we activate. bAutoManageAttachment:auto_attach_rotation_rule
(AttachmentRule): [Read-Write] Options for how we handle our rotation when we attach to the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment, EAttachmentRule:auto_attach_scale_rule
(AttachmentRule): [Read-Write] Options for how we handle our scale when we attach to the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment, EAttachmentRule:auto_attach_socket_name
(Name): [Read-Write] Socket we automatically attach to on the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment:auto_manage_attachment
(bool): [Read-Write] True if we should automatically attach to AutoAttachParent when Played, and detach from our parent when playback is completed. This overrides any current attachment that may be present at the time of activation (deferring initial attachment until activation, if AutoAttachParent is null). If enabled, this AudioComponent’s WorldLocation will no longer be reliable when not currently playing audio, and any attach children will also be detached/attached along with it. When enabled, detachment occurs regardless of whether AutoAttachParent is assigned, and the relative transform from the time of activation is restored. This also disables attachment on dedicated servers, where we don’t actually activate even if bAutoActivate is true. AutoAttachParent, AutoAttachSocketName, AutoAttachLocationType:can_ever_affect_navigation
(bool): [Read-Write] Whether this component can potentially influence navigationcomponent_tags
(Array(Name)): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.concurrency_set
(Set(SoundConcurrency)): [Read-Write] What sound concurrency rules to use for sounds generated by this audio componentdetail_mode
(DetailMode): [Read-Write] If detail mode is >= system detail mode, primitive won’t be rendered.editable_when_inherited
(bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor classenable_low_pass_filter
(bool): [Read-Write] Whether or not to apply a low-pass filter to the sound that plays in this audio component.envelope_follower_attack_time
(int32): [Read-Write] The attack time in milliseconds for the envelope follower. Delegate callbacks can be registered to get the envelope value of sounds played with this audio component. Only used in audio mixer.envelope_follower_release_time
(int32): [Read-Write] The release time in milliseconds for the envelope follower. Delegate callbacks can be registered to get the envelope value of sounds played with this audio component. Only used in audio mixer.hidden_in_game
(bool): [Read-Write] Whether to hide the primitive in game, if the primitive is Visible.instance_parameters
(Array(AudioComponentParam)): [Read-Write] Array of per-instance parameters for this AudioComponent.is_editor_only
(bool): [Read-Write] If true, the component will be excluded from non-editor buildsis_ui_sound
(bool): [Read-Write] Whether or not this sound plays when the game is paused in the UIlow_pass_filter_frequency
(float): [Read-Write] The frequency of the lowpass filter (in hertz) to apply to this voice. A frequency of 0.0 is the device sample rate and will bypass the filter.mobility
(ComponentMobility): [Read-Write] How often this component is allowed to move, used to make various optimizations. Only safe to set in constructor.modulation_routing
(SoundModulationDefaultRoutingSettings): [Read-Write] Modulation Routingon_audio_finished
(OnAudioFinished): [Read-Write] called when we finish playing audio, either because it played to completion or because a Stop() call turned it off earlyon_audio_multi_envelope_value
(OnAudioMultiEnvelopeValue): [Read-Write] On Audio Multi Envelope Valueon_audio_play_state_changed
(OnAudioPlayStateChanged): [Read-Write] Called when PlayState changeson_audio_playback_percent
(OnAudioPlaybackPercent): [Read-Write] Called as a sound plays on the audio component to allow BP to perform actions based on playback percentage. Computed as samples played divided by total samples, taking into account pitch. Not currently implemented on all platforms.on_audio_single_envelope_value
(OnAudioSingleEnvelopeValue): [Read-Write] On Audio Single Envelope Valueon_audio_virtualization_changed
(OnAudioVirtualizationChanged): [Read-Write] Called when virtualization state changeson_component_activated
(ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reseton_component_deactivated
(ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivatedoverride_attenuation
(bool): [Read-Write] Allows defining attenuation settings directly on this audio component without using an attenuation settings asset.override_priority
(bool): [Read-Write] Override Priorityoverride_subtitle_priority
(bool): [Read-Write] Whether or not to override the sound’s subtitle priority.physics_volume_changed_delegate
(PhysicsVolumeChanged): [Read-Write] Delegate that will be called when PhysicsVolume has been changed *pitch_modulation_max
(float): [Read-Write] The upper bound to use when randomly determining a pitch multiplierpitch_modulation_min
(float): [Read-Write] The lower bound to use when randomly determining a pitch multiplierpitch_multiplier
(float): [Read-Write] A pitch multiplier to apply to sounds generated by this componentprimary_component_tick
(ActorComponentTickFunction): [Read-Write] Main tick function for the Componentpriority
(float): [Read-Write] A priority value that is used for sounds that play on this component that scales against final output volume.relative_location
(Vector): [Read-Write] Location of the component relative to its parentrelative_rotation
(Rotator): [Read-Write] Rotation of the component relative to its parentrelative_scale3d
(Vector): [Read-Write] Non-uniform scaling of the component relative to its parent. Note that scaling is always applied in local space (no shearing etc)replicates
(bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!should_update_physics_volume
(bool): [Read-Write] Whether or not the cached PhysicsVolume this component overlaps should be updated when the component is moved. GetPhysicsVolume():sound
(SoundBase): [Read-Write] The sound to be playedsound_class_override
(SoundClass): [Read-Write] Optional sound group this AudioComponent belongs tosource_effect_chain
(SoundEffectSourcePresetChain): [Read-Write] Source Effect Chainsubtitle_priority
(float): [Read-Write] Used by the subtitle manager to prioritize subtitles wave instances spawned by this component.suppress_subtitles
(bool): [Read-Write] If true, subtitles in the sound data will be ignored.use_attach_parent_bound
(bool): [Read-Write] If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together.visible
(bool): [Read-Write] Whether to completely draw the primitive; if false, the primitive is not drawn, does not cast a shadow.volume_modulation_max
(float): [Read-Write] The upper bound to use when randomly determining a volume multipliervolume_modulation_min
(float): [Read-Write] The lower bound to use when randomly determining a volume multipliervolume_multiplier
(float): [Read-Write] A volume multiplier to apply to sounds generated by this component
-
adjust_attenuation
(attenuation_settings) → None¶ Modify the attenuation settings of the audio component
- Parameters
attenuation_settings (SoundAttenuationSettings) –
-
adjust_volume
(adjust_volume_duration, adjust_volume_level, fade_curve=AudioFaderCurve.LINEAR) → None¶ This will allow one to adjust the volume of an AudioComponent on the fly
- Parameters
adjust_volume_duration (float) –
adjust_volume_level (float) –
fade_curve (AudioFaderCurve) –
-
property
allow_spatialization
¶ [Read-Write] Overrides spatialization enablement in either the attenuation asset or on this audio component’s attenuation settings override.
- Type
(bool)
-
property
attenuation_overrides
¶ [Read-Write] If bOverrideSettings is true, the attenuation properties to use for sounds generated by this component
- Type
-
property
attenuation_settings
¶ [Read-Write] If bOverrideSettings is false, the asset to use to determine attenuation properties for sounds generated by this component
- Type
-
property
auto_attach_location_rule
¶ [Read-Write] Options for how we handle our location when we attach to the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment, EAttachmentRule:
- Type
-
property
auto_attach_parent
¶ [Read-Only] Component we automatically attach to when activated, if bAutoManageAttachment is true. If null during registration, we assign the existing AttachParent and defer attachment until we activate. bAutoManageAttachment:
- Type
-
property
auto_attach_rotation_rule
¶ [Read-Write] Options for how we handle our rotation when we attach to the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment, EAttachmentRule:
- Type
-
property
auto_attach_scale_rule
¶ [Read-Write] Options for how we handle our scale when we attach to the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment, EAttachmentRule:
- Type
-
property
auto_attach_socket_name
¶ [Read-Write] Socket we automatically attach to on the AutoAttachParent, if bAutoManageAttachment is true. bAutoManageAttachment:
- Type
(Name)
-
property
auto_manage_attachment
¶ [Read-Only] True if we should automatically attach to AutoAttachParent when Played, and detach from our parent when playback is completed. This overrides any current attachment that may be present at the time of activation (deferring initial attachment until activation, if AutoAttachParent is null). If enabled, this AudioComponent’s WorldLocation will no longer be reliable when not currently playing audio, and any attach children will also be detached/attached along with it. When enabled, detachment occurs regardless of whether AutoAttachParent is assigned, and the relative transform from the time of activation is restored. This also disables attachment on dedicated servers, where we don’t actually activate even if bAutoActivate is true. AutoAttachParent, AutoAttachSocketName, AutoAttachLocationType:
- Type
(bool)
-
property
concurrency_set
¶ [Read-Write] What sound concurrency rules to use for sounds generated by this audio component
- Type
-
property
enable_low_pass_filter
¶ [Read-Write] Whether or not to apply a low-pass filter to the sound that plays in this audio component.
- Type
(bool)
-
property
envelope_follower_attack_time
¶ [Read-Write] The attack time in milliseconds for the envelope follower. Delegate callbacks can be registered to get the envelope value of sounds played with this audio component. Only used in audio mixer.
- Type
(int32)
-
property
envelope_follower_release_time
¶ [Read-Write] The release time in milliseconds for the envelope follower. Delegate callbacks can be registered to get the envelope value of sounds played with this audio component. Only used in audio mixer.
- Type
(int32)
-
fade_in
(fade_in_duration, fade_volume_level=1.0, start_time=0.0, fade_curve=AudioFaderCurve.LINEAR) → None¶ This can be used in place of “play” when it is desired to fade in the sound over time.
If FadeTime is 0.0, the change in volume is instant. If FadeTime is > 0.0, the multiplier will be increased from 0 to FadeVolumeLevel over FadeIn seconds.
- Parameters
fade_in_duration (float) – how long it should take to reach the FadeVolumeLevel
fade_volume_level (float) – the percentage of the AudioComponents’s calculated volume to fade to
start_time (float) –
fade_curve (AudioFaderCurve) –
-
fade_out
(fade_out_duration, fade_volume_level, fade_curve=AudioFaderCurve.LINEAR) → None¶ This is used in place of “stop” when it is desired to fade the volume of the sound before stopping.
If FadeTime is 0.0, this is the same as calling Stop(). If FadeTime is > 0.0, this will adjust the volume multiplier to FadeVolumeLevel over FadeInTime seconds and then stop the sound.
- Parameters
fade_out_duration (float) – how long it should take to reach the FadeVolumeLevel
fade_volume_level (float) – the percentage of the AudioComponents’s calculated volume in which to fade to
fade_curve (AudioFaderCurve) –
-
get_attenuation_settings_to_apply
() → SoundAttenuationSettings or None¶ BP Get Attenuation Settings to Apply
- Returns
out_attenuation_settings (SoundAttenuationSettings):
- Return type
-
get_cooked_envelope_data
() → float or None¶ Retrieves the current-time cooked envelope data of the playing audio component. Cooked data is interpolated and averaged across all playing sound waves. Returns true if there is data and the audio component is playing.
-
get_cooked_envelope_data_for_all_playing_sounds
() → Array(SoundWaveEnvelopeDataPerSound) or None¶ Retrieves the current-time envelope data of the sounds playing audio component. Envelope data is not averaged or interpolated. Instead an array of data with all playing sound waves with cooked data is returned. Returns true if there is data and the audio component is playing.
- Returns
out_envelope_data (Array(SoundWaveEnvelopeDataPerSound)):
- Return type
-
get_cooked_fft_data
(frequencies_to_get) → Array(SoundWaveSpectralData) or None¶ Retrieves the current-time cooked spectral data of the sounds playing on the audio component. Spectral data is averaged and interpolated for all playing sounds on this audio component. Returns true if there is data and the audio component is playing.
- Parameters
- Returns
out_sound_wave_spectral_data (Array(SoundWaveSpectralData)):
- Return type
-
get_cooked_fft_data_for_all_playing_sounds
() → Array(SoundWaveSpectralDataPerSound) or None¶ Retrieves the current-time cooked spectral data of the sounds playing audio component. Spectral data is not averaged or interpolated. Instead an array of data with all playing sound waves with cooked data is returned. Returns true if there is data and the audio component is playing.
- Returns
out_sound_wave_spectral_data (Array(SoundWaveSpectralDataPerSound)):
- Return type
-
get_play_state
() → AudioComponentPlayState¶ Returns the enumerated play states of the audio component.
- Returns
- Return type
-
has_cooked_amplitude_envelope_data
() → bool¶ Queries if the sound wave playing in this audio component has cooked amplitude analyses.
- Returns
- Return type
-
has_cooked_fft_data
() → bool¶ Queries if the sound wave playing in this audio component has cooked FFT data.
- Returns
- Return type
-
property
instance_parameters
¶ [Read-Write] Array of per-instance parameters for this AudioComponent.
- Type
-
is_playing
() → bool¶ Returns if the sound playing any audio. Doesn’t indicate the play state. Use GetPlayState() to get the actual play state.
- Returns
- Return type
-
property
is_ui_sound
¶ [Read-Write] Whether or not this sound plays when the game is paused in the UI
- Type
(bool)
-
property
low_pass_filter_frequency
¶ [Read-Write] The frequency of the lowpass filter (in hertz) to apply to this voice. A frequency of 0.0 is the device sample rate and will bypass the filter.
- Type
(float)
-
property
modulation_routing
¶ [Read-Write] Modulation Routing
-
property
on_audio_finished
¶ [Read-Write] called when we finish playing audio, either because it played to completion or because a Stop() call turned it off early
- Type
-
property
on_audio_multi_envelope_value
¶ [Read-Write] On Audio Multi Envelope Value
- Type
-
property
on_audio_play_state_changed
¶ [Read-Write] Called when PlayState changes
- Type
-
property
on_audio_playback_percent
¶ [Read-Write] Called as a sound plays on the audio component to allow BP to perform actions based on playback percentage. Computed as samples played divided by total samples, taking into account pitch. Not currently implemented on all platforms.
- Type
-
property
on_audio_single_envelope_value
¶ [Read-Write] On Audio Single Envelope Value
- Type
-
property
on_audio_virtualization_changed
¶ [Read-Write] Called when virtualization state changes
- Type
-
property
override_attenuation
¶ [Read-Write] Allows defining attenuation settings directly on this audio component without using an attenuation settings asset.
- Type
(bool)
-
property
override_subtitle_priority
¶ [Read-Write] Whether or not to override the sound’s subtitle priority.
- Type
(bool)
-
property
pitch_modulation_max
¶ [Read-Write] The upper bound to use when randomly determining a pitch multiplier
- Type
(float)
-
property
pitch_modulation_min
¶ [Read-Write] The lower bound to use when randomly determining a pitch multiplier
- Type
(float)
-
property
pitch_multiplier
¶ [Read-Write] A pitch multiplier to apply to sounds generated by this component
- Type
(float)
-
property
pitch_multiplier_max
¶ ‘pitch_multiplier_max’ was renamed to ‘pitch_modulation_max’.
- Type
deprecated
-
property
pitch_multiplier_min
¶ ‘pitch_multiplier_min’ was renamed to ‘pitch_modulation_min’.
- Type
deprecated
-
play
(start_time=0.0) → None¶ Start a sound playing on an audio component
- Parameters
start_time (float) –
-
play_quantized
(world_context_object, clock_handle, quantization_boundary, delegate, start_time=0.000000, fade_in_duration=0.000000, fade_volume_level=1.000000, fade_curve=AudioFaderCurve.LINEAR) -> (clock_handle=QuartzClockHandle, quantization_boundary=QuartzQuantizationBoundary)¶ Start a sound playing on an audio component on a given quantization boundary with the handle to an existing clock
- Parameters
world_context_object (Object) –
clock_handle (QuartzClockHandle) –
quantization_boundary (QuartzQuantizationBoundary) –
delegate (OnQuartzCommandEventBP) –
start_time (float) –
fade_in_duration (float) –
fade_volume_level (float) –
fade_curve (AudioFaderCurve) –
- Returns
clock_handle (QuartzClockHandle):
quantization_boundary (QuartzQuantizationBoundary):
- Return type
tuple
-
property
priority
¶ [Read-Write] A priority value that is used for sounds that play on this component that scales against final output volume.
- Type
(float)
-
set_audio_bus_send_post_effect
(audio_bus, source_bus_send_level) → None¶ - Sets how much audio the sound should send to the given Audio Bus (POST Source Effects).
if the Audio Bus Send doesn’t already exist, it will be added to the overrides on the active sound
-
set_audio_bus_send_pre_effect
(audio_bus, audio_bus_send_level) → None¶ - Sets how much audio the sound should send to the given Audio Bus (PRE Source Effects).
if the Bus Send doesn’t already exist, it will be added to the overrides on the active sound
-
set_bool_parameter
(name, bool) → None¶ Set a boolean instance parameter for use in sound cues played by this audio component
-
set_float_parameter
(name, float) → None¶ Set a float instance parameter for use in sound cues played by this audio component
-
set_int_parameter
(name, int) → None¶ Set an integer instance parameter for use in sound cues played by this audio component
- Parameters
name (Name) –
int (int32) –
-
set_low_pass_filter_enabled
(low_pass_filter_enabled) → None¶ Sets whether or not the low pass filter is enabled on the audio component.
- Parameters
low_pass_filter_enabled (bool) –
-
set_low_pass_filter_frequency
(low_pass_filter_frequency) → None¶ Sets lowpass filter frequency of the audio component.
- Parameters
low_pass_filter_frequency (float) –
-
set_paused
(pause) → None¶ Pause an audio component playing its sound cue, issue any delegates if needed
- Parameters
pause (bool) –
-
set_pitch_multiplier
(new_pitch_multiplier) → None¶ Set a new pitch multiplier
- Parameters
new_pitch_multiplier (float) –
-
set_sound
(new_sound) → None¶ Set what sound is played by this component
- Parameters
new_sound (SoundBase) –
-
set_source_bus_send_post_effect
(sound_source_bus, source_bus_send_level) → None¶ - Sets how much audio the sound should send to the given Source Bus (POST Source Effects).
if the Bus Send doesn’t already exist, it will be added to the overrides on the active sound
- Parameters
sound_source_bus (SoundSourceBus) –
source_bus_send_level (float) –
-
set_source_bus_send_pre_effect
(sound_source_bus, source_bus_send_level) → None¶ - Sets how much audio the sound should send to the given Source Bus (PRE Source Effects).
if the Bus Send doesn’t already exist, it will be added to the overrides on the active sound
- Parameters
sound_source_bus (SoundSourceBus) –
source_bus_send_level (float) –
-
set_submix_send
(submix, send_level) → None¶ Sets how much audio the sound should send to the given submix.
- Parameters
submix (SoundSubmixBase) –
send_level (float) –
-
set_ui_sound
(ui_sound) → None¶ Set whether sounds generated by this audio component should be considered UI sounds
- Parameters
ui_sound (bool) –
-
set_volume_multiplier
(new_volume_multiplier) → None¶ Set a new volume multiplier
- Parameters
new_volume_multiplier (float) –
-
set_wave_parameter
(name, wave) → None¶ Set a sound wave instance parameter for use in sound cues played by this audio component
-
property
source_effect_chain
¶ [Read-Write] Source Effect Chain
- Type
-
stop_delayed
(delay_time) → None¶ Cues request to stop sound after the provided delay (In Seconds), stopping immediately if delay is zero or negative
- Parameters
delay_time (float) –
-
property
subtitle_priority
¶ [Read-Write] Used by the subtitle manager to prioritize subtitles wave instances spawned by this component.
- Type
(float)
-
property
suppress_subtitles
¶ [Read-Write] If true, subtitles in the sound data will be ignored.
- Type
(bool)
-
property
volume_modulation_max
¶ [Read-Write] The upper bound to use when randomly determining a volume multiplier
- Type
(float)
-
property
volume_modulation_min
¶ [Read-Write] The lower bound to use when randomly determining a volume multiplier
- Type
(float)
-
property
volume_multiplier
¶ [Read-Write] A volume multiplier to apply to sounds generated by this component
- Type
(float)
-
property
volume_multiplier_max
¶ ‘volume_multiplier_max’ was renamed to ‘volume_modulation_max’.
- Type
deprecated
-
property
volume_multiplier_min
¶ ‘volume_multiplier_min’ was renamed to ‘volume_modulation_min’.
- Type
deprecated