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

  • audio_render_music_time_discontinuity_event (MusicTimeDiscontinuityEvent): [Read-Write]

  • 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.

  • default_clock_advance_rate (float): [Read-Write] Default Clock Advance Rate used for Wall clock with no tempo map

    NOT THE CURRENT RUNNING TEMPO

  • default_tempo (float): [Read-Write] Default Tempo (BPM) used for Wall clock with no tempo map

    NOT THE CURRENT RUNNING TEMPO

  • default_time_signature_denom (int32): [Read-Write] Default Time Signature (Denominator) used for the Wall clock with no tempo map

    NOT THE CURRENT RUNNING TIME SIG

  • default_time_signature_num (int32): [Read-Write] Default Time Signature (Numerator) used for the Wall Clock with no tempo map

    NOT THE CURRENT RUNNING TIME SIG

  • 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-Only]

  • music_clock_connected_event (MusicClockConnected): [Read-Write]

  • music_clock_disconnected_event (MusicClockDisconnected): [Read-Write]

  • music_clock_settings (InstancedStruct): [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]

  • player_experience_music_time_discontinuity_event (MusicTimeDiscontinuityEvent): [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_map (MidiFile): [Read-Write]

  • timebase_for_bar_and_beat_events (CalibratedMusicTimebase): [Read-Write]

  • video_render_music_time_discontinuity_event (MusicTimeDiscontinuityEvent): [Read-Write]

property audio_render_music_time_discontinuity_event: MusicTimeDiscontinuityEvent

[Read-Write]

Type:

(MusicTimeDiscontinuityEvent)

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_custom_clock_with_settings(music_clock_settings) None

Connect to Custom Clock with Settings

Parameters:

music_clock_settings (InstancedStruct)

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 the clock from paused

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 default_clock_advance_rate: float

[Read-Write] Default Clock Advance Rate used for Wall clock with no tempo map

NOT THE CURRENT RUNNING TEMPO

Type:

(float)

property default_tempo: float

[Read-Write] Default Tempo (BPM) used for Wall clock with no tempo map

NOT THE CURRENT RUNNING TEMPO

Type:

(float)

property default_time_signature_denom: int

[Read-Write] Default Time Signature (Denominator) used for the Wall clock with no tempo map

NOT THE CURRENT RUNNING TIME SIG

Type:

(int32)

property default_time_signature_num: int

[Read-Write] Default Time Signature (Numerator) used for the Wall Clock with no tempo map

NOT THE CURRENT RUNNING TIME SIG

Type:

(int32)

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.

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.

Parameters:

timebase (CalibratedMusicTimebase)

Return type:

float

get_count_in_seconds() float

Get Count in Seconds

Return type:

float

get_current_bar_beat() -> (bar=float, beat_in_bar=float)

Get Current Bar Beat

Returns:

bar (float):

beat_in_bar (float):

Return type:

tuple

get_current_bars_per_second() float

Get The Current Bars per Second. Based on the current tempo, advance rate and time signature

0 if the clock is stopped.

Return type:

float

get_current_beats_per_minute() float

Get The Current BPM of the running clock 0 if the clock is stopped This is in units of our Beats, not Quarter notes. This does not consider the advance rate, if you want that, use GetBeats|BarsPerSecond.

Return type:

float

get_current_beats_per_second() float

Get The Current Beats per Second. Based on the current tempo, advance rate and time signature

0 if the clock is stopped.

Return type:

float

get_current_clock_advance_rate() float

Get The Current Clock advance rate

0 if the clock is stopped

Return type:

float

get_current_player_experienced_song_pos() MidiSongPos

Get Current Player Experienced Song Pos

Return type:

MidiSongPos

get_current_raw_audio_render_song_pos() MidiSongPos

Get Current Raw Audio Render Song Pos

Return type:

MidiSongPos

get_current_seconds_per_bar() float

Get The Current Seconds per Bar Based on the current tempo, advance rate and time signature

0 if the clock is stopped Don’t use this method, use GetCurrentBarsPerSecond instead if possible because this method returns zero when the clock is stopped rather than inf, which is what it should be.

Return type:

float

get_current_seconds_per_beat() float

Get The Current Seconds per Beat Based on the current tempo, advance rate and time signature

0 if the clock is stopped. Don’t use this method, use GetCurrentBeatsPerSecond instead if possible because this method returns zero when the clock is stopped rather than inf, which is what it should be.

Return type:

float

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]

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

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)

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

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_tempo() float

Get The Current Tempo of the running clock 0 if the clock is stopped This is Midi Tempo, which is QuarterNotesPerMinute. This does not consider the advance rate, if you want that, use GetBeats|BarsPerSecond.

Return type:

float

get_current_time_signature() -> (out_numerator=int32, out_denominator=int32)

Get The Current Time Signature

0 if the clock is stopped

Returns:

out_numerator (int32):

out_denominator (int32):

Return type:

tuple

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!

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

Get Delta Bar

Parameters:

timebase (CalibratedMusicTimebase)

Return type:

float

get_delta_beat(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Get Delta Beat

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.

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

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).

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).

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.

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.

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_previous_player_experienced_song_pos() MidiSongPos

Get Previous Player Experienced Song Pos

Return type:

MidiSongPos

get_previous_smoothed_audio_render_song_pos() MidiSongPos

Get Previous Smoothed Audio Render Song Pos

Return type:

MidiSongPos

get_previous_song_pos(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) MidiSongPos

Get Previous Song Pos

Parameters:

timebase (CalibratedMusicTimebase)

Return type:

MidiSongPos

get_previous_video_render_song_pos() MidiSongPos

Get Previous Video Render Song Pos

Return type:

MidiSongPos

get_run_past_music_end() bool

Get Run Past Music End

Return type:

bool

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.

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.

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

Get Song Pos

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

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

looped_this_frame(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) bool

Returns true if there was a seek in the specified timebase

Parameters:

timebase (CalibratedMusicTimebase)

Return type:

bool

measure_span_progress(span, timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) float

Measure Span Progress

Parameters:
Return type:

float

property metasounds_audio_component: AudioComponent

[Read-Only]

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 the clock at the current running time

property play_state_event: PlayStateEvent

[Read-Write]

Type:

(PlayStateEvent)

property player_experience_music_time_discontinuity_event: MusicTimeDiscontinuityEvent

[Read-Write]

Type:

(MusicTimeDiscontinuityEvent)

property run_past_music_end: bool

[Read-Write]

Type:

(bool)

property section_event: SectionEvent

[Read-Write]

Type:

(SectionEvent)

seeked_this_frame(timebase=CalibratedMusicTimebase.VIDEO_RENDER_TIME) bool

Returns true if there was a seek in the specified timebase

Parameters:

timebase (CalibratedMusicTimebase)

Return type:

bool

set_run_past_music_end(run_past_music_end) None

Set Run Past Music End

Parameters:

run_past_music_end (bool)

set_tempo_map_for_wall_clock(tempo_map) None

Set the tempo map when running off of wall clock

Parameters:

tempo_map (MidiFile)

start() None

Start the clock ticking and tracking music time Same as “Activate”

stop() None

Stop this clock ticking and no longer track music time Same as “Deactivate”

tick_to_ms(tick) float

Tick to Ms

Parameters:

tick (float)

Return type:

float

property timebase_for_bar_and_beat_events: CalibratedMusicTimebase

[Read-Write]

Type:

(CalibratedMusicTimebase)

property video_render_music_time_discontinuity_event: MusicTimeDiscontinuityEvent

[Read-Write]

Type:

(MusicTimeDiscontinuityEvent)