unreal.OffsetMusicSource

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

Bases: Object

An IMusicSource that reads from a parent IMusicSource and applies a millisecond offset. This is how calibrated time clocks (experienced, video render) are created:

UMetasoundMusicSource (audio render)

-> UOffsetMusicSource (-30ms) -> UMusicClock (video render) -> UOffsetMusicSource (-50ms) -> UMusicClock (experienced)

Offset sources can also chain: SourceA -> OffsetB -> OffsetC, where each offset reads directly from the previous IMusicSource.

Loop handling: when the parent source is looping, the offset time is wrapped around the loop boundary. On the first pass through the loop (before the parent has ever looped), negative offsets are NOT wrapped — the offset time stays negative until the parent advances past the threshold.

C++ Source:

  • Plugin: Harmonix

  • Module: HarmonixMetasound

  • File: OffsetMusicSource.h

continue_() None

Continue

get_offset_ms() float

Get the current offset.

Return type:

float

get_parent_source() MusicSource

Get the parent source.

Return type:

MusicSource

is_playing() bool

Whether the source is currently producing musical time.

Return type:

bool

is_preparing() bool

Whether the source intends to run but is waiting for data (e.g., Metasound not yet connected).

Return type:

bool

is_stopped() bool

Whether the source is stopped (not producing time, position at zero).

Return type:

bool

pause() None

Pause

seek(timestamp) None

Seek to a musical position. For RuntimeMusicSource: converts the timestamp to seconds via song maps and seeks the time source. For MetasoundMusicSource: requires Metasound interface support (future work).

Parameters:

timestamp (MusicTimestamp)

set_offset_ms(offset_ms) None

Set the offset in milliseconds. Positive = ahead, negative = behind.

Parameters:

offset_ms (float)

set_parent_source(parent_source) None

Set the parent source this offset reads from.

Parameters:

parent_source (MusicSource)

set_speed(speed) None

Set the playback speed multiplier (1.0 = normal speed). For RuntimeMusicSource: sets the speed on the underlying ITimeSource. For MetasoundMusicSource: requires Metasound interface support (future work).

Parameters:

speed (float)

set_tempo(bpm) None

Set the tempo in BPM. For RuntimeMusicSource: modifies the underlying song maps directly. For MetasoundMusicSource: requires Metasound interface support (future work).

Parameters:

bpm (float)

set_time_signature(numerator, denominator) None

Set the time signature. For RuntimeMusicSource: modifies the underlying song maps directly. For MetasoundMusicSource: requires Metasound interface support (future work).

Parameters:
  • numerator (int32)

  • denominator (int32)

start() None

—- Transport Controls —- The source owns playback. Consumers (UMusicClock) are read-only views.

stop() None

Stop