audios¶
- class janim.timeline.audios.PlayAudioInfo(audio: Audio, clip_range: TimeRange, range: TimeRange)¶
Bases:
objectParameter information corresponding to an audio played in the Timeline
- Parameters:
audio – The audio object
clip_range – Which segment of the audio object to clip
range – When to play the clipped audio in the Timeline
See
play_audio()
- class janim.timeline.audios.AudiosMixin(*args, **kwargs)¶
Bases:
TimelineCoreProvides audio playback functionality to
TimelineHint
All methods in this class can be used directly in
Timeline- play_audio(audio: Audio, *, delay: float = 0, begin: float = 0, end: float = -1, clip: tuple[float, float] | None = None) TimeRange¶
Play audio at the current position
- Parameters:
delay – The delay in seconds before starting playback
begin – The starting second for clipping
audioend – The ending second for clipping
audioclip – A shorthand for
(begin, end). If specified, it overridesstartandend
- Returns:
The playback time range
Example:
# Clip the 1.2~6.5s segment from 'test.mp3' and play it from the current time self.play_audio(Audio('test.mp3'), begin=1.2, end=6.5) # Equivalent to self.play_audio(Audio('test.mp3'), clip=(1.2, 6.5))
- has_audio() bool¶
Whether this Timeline itself has playable audio
- has_audio_for_all() bool¶
Considering all child Timelines, whether there is playable audio
Note
Does not include sub-Timelines constructed by
to_playback_control_item()