AudioEffect

Qualified name: algan.sound.audio\_effect.AudioEffect

class AudioEffect(audio_clip, start_time)[source]

Bases: object

One sound placed at one moment on a Scene’s timeline.

A Scene collects these as it is authored and mixes them into a single track when save_video() runs – each clip is offset to its own start time, so overlapping effects simply play over each other.

You do not usually build one: the Audio and Speech contexts add one for you, at the time the block opens, and take the block’s runtime from the clip’s own duration so the animations inside are fitted to the sound.

Parameters:
  • audio_clip – A moviepy AudioClip – what AudioFileClip(path) returns, or the clip a speech generator produced.

  • start_time – A zero-argument callable returning the scene time, in seconds, at which the clip should begin. It is a callable rather than a number because a context’s start is only final once the block it sits in has been rescaled, which happens after the effect is registered.

audio_clip

The clip, as supplied.

start_time_func

The callable supplied as start_time.

See also

Audio

Play a sound file over a block of animation.

Speech

Narrate a block, generating the audio from text.

Examples

Reach for the context rather than the class:

from algan import *

square = Square().spawn()
with Audio("chime.wav"):
    square.rotate(90)

Scene.save_video("chimed")

Methods