Timeline mixing

Arrange sounds on a beat grid, on tracks, with pumping and ducking.

On this page

Arrange sounds on a beat grid, on tracks, with pumping and ducking.

audioTimeline

Create a multi track timeline for mixing sounds

audioTimeline( bpm=120, beatsPerBar=4, sampleRate=44100, channels=2 )
ArgumentTypeDefault
bpmdouble120The tempo in beats per minute. Defaults to 120.
beatsPerBarinteger4Beats in one bar. Defaults to 4.
sampleRateinteger44100The sample rate of the mix in Hz. Defaults to 44100.
channelsinteger21 for mono or 2 for stereo. Defaults to 2.

Returns The timeline. Use timeline.beat( n ) and timeline.bar( n ) to turn beats and bars into seconds.

audioAdd

Place a sound on a timeline track

audioAdd( timeline, sound, at=0, track="main", db=0, pan=0 )
ArgumentTypeDefault
timelineanyrequiredThe timeline from audioTimeline().
soundanyrequiredThe audio buffer to place. A different sample rate is converted automatically, mono is panned in a stereo timeline.
atdouble0Where the sound starts, in seconds. Use timeline.beat( n ) or timeline.bar( n ) to place it on the grid. Defaults to 0.
trackstring"main"The track name, created on first use. Defaults to main.
dbdouble0Gain in decibels. Defaults to 0.
pandouble0From -1 (left) to 1 (right). Defaults to 0.

Returns The same timeline, so calls can be chained.

audioBeats

List moments on the beat grid of a timeline, in seconds

audioBeats( timeline, start=0, end, step=1 )
ArgumentTypeDefault
timelineanyrequiredThe timeline from audioTimeline().
startdouble0The first beat. Defaults to 0.
enddoublerequiredWhere to stop, in beats. The end itself is not included.
stepdouble1Beats between moments, for example 0.5 for eighth notes in 4/4. Defaults to 1.

Returns An array of times in seconds, ready for audioAdd( at= ) or audioPump( times= ).

audioTrackGain

Set the volume of a whole timeline track

audioTrackGain( timeline, track, db )
ArgumentTypeDefault
timelineanyrequiredThe timeline from audioTimeline().
trackstringrequiredThe track name, created if it does not exist yet.
dbdoublerequiredThe track gain in decibels, applied when the timeline is rendered.

Returns The same timeline, so calls can be chained.

audioPump

Duck a timeline track at given moments, like a kick drum sidechain

audioPump( timeline, track, times, amountDb=-5, recovery=0.18 )
ArgumentTypeDefault
timelineanyrequiredThe timeline from audioTimeline().
trackstringrequiredThe track to duck.
timesarrayrequiredAn array of start times in seconds, for example from audioBeats().
amountDbdouble-5How far the gain drops at each time, a negative number of decibels. Defaults to -5.
recoverydouble0.18Seconds the gain takes to return to normal. Defaults to 0.18.

Returns The same timeline, so calls can be chained.

audioDuck

Duck a timeline track while another track is loud, like music under a voice-over

audioDuck( timeline, track, trigger, amountDb=-12, thresholdDb=-40, attack=0.01, release=0.3 )
ArgumentTypeDefault
timelineanyrequiredThe timeline from audioTimeline().
trackstringrequiredThe track to lower, for example the music.
triggerstringrequiredThe track whose level controls the ducking, for example the voice. It must already have sound on it.
amountDbdouble-12How far to lower the track, a negative number of decibels. Defaults to -12.
thresholdDbdouble-40The trigger level above which ducking starts, relative to full scale. Defaults to -40.
attackdouble0.01Seconds taken to lower the track. Defaults to 0.01.
releasedouble0.3Seconds taken to bring the track back. Defaults to 0.3.

Returns The same timeline, so calls can be chained.

audioRender

Mix a timeline down to one audio buffer

audioRender( timeline, tail=0 )
ArgumentTypeDefault
timelineanyrequiredThe timeline from audioTimeline().
taildouble0Seconds of silence to leave after the last sound, for example for a fade out. Defaults to 0.

Returns The mixed audio buffer. The timeline is left as it was, so it can be changed and rendered again.

Edit this page Download Markdown Last updated Oct 16, 2026, 11:59:46 AM Report an issue