unreal.MusicClockComponent

class unreal.MusicClockComponent(outer: Object | None = None, name: Name | str = 'None')

Bases: ActorComponent

Music Clock Component

C++ Source:

  • Plugin: Harmonix

  • Module: HarmonixMetasound

  • File: MusicClockComponent.h

Editor Properties: (see get_editor_property/set_editor_property)

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • asset_user_data_editor_only (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • bar_event (BarEvent): [Read-Write]

  • beat_event (BeatEvent): [Read-Write]

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_tags (Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • current_bar_duration_sec (float): [Read-Only]

  • current_beat_duration_sec (float): [Read-Only]

  • current_clock_advance_rate (float): [Read-Only]

  • current_player_experienced_song_pos (MidiSongPos): [Read-Write]

  • current_smoothed_audio_render_song_pos (MidiSongPos): [Read-Write] Don’t let C++ access these directly! They are a blueprint convenience and only work because they specify getter functions!

  • current_video_render_song_pos (MidiSongPos): [Read-Write]

  • drive_method (MusicClockDriveMethod): [Read-Write]

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • metasound_output_name (Name): [Read-Write]

  • metasounds_audio_component (AudioComponent): [Read-Write]

  • music_clock_connected_event (MusicClockConnected): [Read-Write]

  • music_clock_disconnected_event (MusicClockDisconnected): [Read-Write]

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • play_state_event (PlayStateEvent): [Read-Write]

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • replicate_using_registered_sub_object_list (bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

  • run_past_music_end (bool): [Read-Write]

  • section_event (SectionEvent): [Read-Write]

  • tempo (float): [Read-Write]

  • tempo_map (MidiFile): [Read-Write]

  • time_signature_denom (int32): [Read-Write]

  • time_signature_num (int32): [Read-Write]

  • timebase_for_bar_and_beat_events (CalibratedMusicTimebase): [Read-Write]

property bar_event: BarEvent

[Read-Write]

Type:

(BarEvent)

bar_to_ms(bar) float

Bar to Ms

Parameters:

bar (float) –

Return type:

float

property beat_event: BeatEvent

[Read-Write]

Type:

(BeatEvent)

beat_to_ms(beat) float

Beat to Ms

Parameters:

beat (float) –

Return type:

float

connect_to_metasound_on_audio_component(audio_component) bool

Connect to Metasound on Audio Component

Parameters:

audio_component (AudioComponent) –

Return type:

bool

connect_to_wall_clock_for_midi(tempo_map) None

Connect to Wall Clock for Midi

Parameters:

tempo_map (MidiFile) –

continue_() None

Continue

classmethod create_metasound_driven_music_clock(world_context_object, audio_component, metasound_ouput_pin_name='MIDI Clock', start=True) MusicClockComponent

Create Metasound Driven Music Clock

Parameters:
Return type:

MusicClockComponent

classmethod create_music_clock_component(world_context_object: Object, audio_component: AudioComponent, metasound_ouput_pin_name: Name = 'MIDI Clock', start: bool = True) MusicClockComponent

deprecated: ‘create_music_clock_component’ was renamed to ‘create_metasound_driven_music_clock’.

classmethod create_wall_clock_driven_music_clock(world_context_object, with_tempo_map, start=True) MusicClockComponent

Create Wall Clock Driven Music Clock

Parameters:
Return type:

MusicClockComponent

property current_bar_duration_sec: float

[Read-Only]

Type:

(float)

property current_beat_duration_sec: float

[Read-Only]

Type:

(float)

property current_clock_advance_rate: float

[Read-Only]

Type:

(float)

property current_player_experienced_song_pos: MidiSongPos

[Read-Only]

Type:

(MidiSongPos)

property current_smoothed_audio_render_song_pos: MidiSongPos

[Read-Only] Don’t let C++ access these directly! They are a blueprint convenience and only work because they specify getter functions!

Type:

(MidiSongPos)

property current_song_pos: MidiSongPos

‘current_song_pos’ was renamed to ‘current_smoothed_audio_render_song_pos’.

Type:

deprecated

property current_video_render_song_pos: MidiSongPos

[Read-Only]

Type:

(MidiSongPos)

get_bars_including_count_in(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Returns the fractional total bars from the beginning of the authored music content. NOTE: INCLUDES time for count-in and pickup bars. Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_beat_in_bar_at_ms(ms) float

Get Beat in Bar at Ms

Parameters:

ms (float) –

Return type:

float

get_beats_including_count_in(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Returns the fractional total beats from the beginning of the authored music content. NOTE: INCLUDES time for count-in and pickup bars. Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_count_in_seconds() float

Get Count in Seconds

Return type:

float

get_current_player_experienced_song_pos() MidiSongPos

Get Current Player Experienced Song Pos

Return type:

MidiSongPos

get_current_section_index(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) int32

Returns the index of the current section for the provided time base. [0, Num-1] // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

int32

get_current_section_length_ms(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Returns the length of the current section in milliseconds // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_current_section_name(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) str

Returns the name of the section that we’re currently in (intro, chorus, outro) // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

str

get_current_section_start_ms(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Returns the start time of the current section in milliseconds // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_current_smoothed_audio_render_song_pos() MidiSongPos

Getter functions for the Blueprint properties exposed above…

Return type:

MidiSongPos

get_current_timestamp(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) MusicTimestamp
Returns the “classic” musical timestamp in the form Bar (int) & Beat (float). In this form…
  • Bar 1, Beat 1.0 is the “beginning of the song” AFTER count-in/pickups

  • Bar 0, Beat 1.0 would be one bar BEFORE the “beginning of the song”… eg. a bar of count-in or pickup.

  • While Bar can be positive or negative, Beat is always >= 1.0 and is read as “beat in the bar”. Again… ‘1’ based!

Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

MusicTimestamp

get_current_video_render_song_pos() MidiSongPos

Get Current Video Render Song Pos

Return type:

MidiSongPos

get_delta_bar(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_delta_beat(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_distance_from_current_bar(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Gets a value expressed in bars between 0-1 that indicates how much progress we made towards the current bar to the next one. // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_distance_from_current_beat(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Gets a value expressed in beats between 0-1 that indicates how much progress we made in the current beat // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_distance_to_closest_bar(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Gets value expressed in bars between 0-1 that indicates how close we are to the closest bar (current bar or next bar). // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_distance_to_closest_beat(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Gets a value expressed in beats between 0-1 that indicates how close we are to the closest beat (current beat or next beat). // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_distance_to_next_bar(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Gets a value expressed in bars between 0-1 that indicates how close we are to the next bar. // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_distance_to_next_beat(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Gets a value expressed in beats between 0-1 that indicates how close we are to the next beat. // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_ms_per_bar_at_ms(ms) float

Get Ms Per Bar at Ms

Parameters:

ms (float) –

Return type:

float

get_ms_per_beat_at_ms(ms) float

Get Ms Per Beat at Ms

Parameters:

ms (float) –

Return type:

float

get_num_beats_in_bar_at_ms(ms) float

Get Num Beats in Bar at Ms

Parameters:

ms (float) –

Return type:

float

get_num_sections() int32

Get Num Sections

Return type:

int32

get_seconds_from_bar_one(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Time from Bar 1 Beat 1. The classic “start of the song”. NOTE: DOES NOT INCLUDE time for count-in and pickup bars. Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_seconds_including_count_in(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Time from the beginning of the authored music content. NOTE: INCLUDES time for count-in and pickup bars. Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_section_end_ms_at_ms(ms) float

Get Section End Ms at Ms

Parameters:

ms (float) –

Return type:

float

get_section_length_ms_at_ms(ms) float

Get Section Length Ms at Ms

Parameters:

ms (float) –

Return type:

float

get_section_name_at_ms(ms) str

Get Section Name at Ms

Parameters:

ms (float) –

Return type:

str

get_section_start_ms_at_ms(ms) float

Get Section Start Ms at Ms

Parameters:

ms (float) –

Return type:

float

get_song_length_bars() float

Get Song Length Bars

Return type:

float

get_song_length_beats() float

Get Song Length Beats

Return type:

float

get_song_length_ms() float

Get Song Length Ms

Return type:

float

get_song_pos(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) MidiSongPos

Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

MidiSongPos

get_song_remaining_ms(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Returns the remaining time until the end of the MIDI in milliseconds based on the timestamp corresponding to the passed Timebase // Note: Not const as it might cause the clock to update from its source.

Parameters:

timebase (CalibratedMusicTimebase) –

Return type:

float

get_song_remaining_time(timebase: CalibratedMusicTimebase = Ellipsis) float

deprecated: ‘get_song_remaining_time’ was renamed to ‘get_song_remaining_ms’.

get_song_sections() Array[SongSection]

Get Song Sections

Return type:

Array[SongSection]

get_state() MusicClockState

Get State

Return type:

MusicClockState

measure_span_progress(span, timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Note: Not const as it might cause the clock to update from its source.

Parameters:
Return type:

float

property metasounds_audio_component: AudioComponent

[Read-Write]

Type:

(AudioComponent)

property music_clock_connected_event: MusicClockConnected

[Read-Write]

Type:

(MusicClockConnected)

property music_clock_disconnected_event: MusicClockDisconnected

[Read-Write]

Type:

(MusicClockDisconnected)

pause() None

Pause

property play_state_event: PlayStateEvent

[Read-Write]

Type:

(PlayStateEvent)

property run_past_music_end: bool

[Read-Write]

Type:

(bool)

property section_event: SectionEvent

[Read-Write]

Type:

(SectionEvent)

start() None

Start

stop() None

Stop

property tempo: float

[Read-Write]

Type:

(float)

tick_to_ms(tick) float

Tick to Ms

Parameters:

tick (float) –

Return type:

float

property time_signature_denom: int

[Read-Write]

Type:

(int32)

property time_signature_num: int

[Read-Write]

Type:

(int32)

property timebase_for_bar_and_beat_events: CalibratedMusicTimebase

[Read-Write]

Type:

(CalibratedMusicTimebase)