unreal.MetasoundMusicSource¶
- class unreal.MetasoundMusicSource(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
ObjectA music source driven by a Metasound’s MIDI clock output.
Connects to a Metasound via UAudioComponent, reads the MIDI clock history ring buffer produced by the audio render thread, and smooths it into a game-thread-rate position suitable for gameplay.
Produces a single time stream: the smoothed audio render position. Calibration offsets (experienced time, video render time) should be applied externally via UOffsetMusicSource.
State is derived from the Metasound’s actual transport state, not from explicit Start/Stop calls. If the AudioComponent starts playing externally, the source detects it and reports Running. Transport methods on IMusicSource are no-ops — control the Metasound through its AudioComponent or Metasound interfaces directly.
Reports Preparing when connected to an AudioComponent but the generator is not yet attached or no clock history is available.
C++ Source:
Plugin: Harmonix
Module: HarmonixMetasound
File: MetasoundMusicSource.h
- is_preparing() bool¶
Whether the source intends to run but is waiting for data (e.g., Metasound not yet connected).
- Return type:
- is_stopped() bool¶
Whether the source is stopped (not producing time, position at zero).
- Return type:
- 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_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)