Skip to content

🎥 Make videos programmatically with React

explain

Jonny Burger0b834aa2add0
diff --git a/packages/docs/docs/using-audio.md b/packages/docs/docs/using-audio.md
index c4312751f6..e28a716e5e 100644
--- a/packages/docs/docs/using-audio.md
+++ b/packages/docs/docs/using-audio.md
@@ -283,6 +283,26 @@ npx remotion lambda render --codec=mp3 https://remotionlambda-qg35eyp1s1.s3.eu-c
</TabItem>
</Tabs>
+## Order of operations<AvailableFrom v="4.0.141"/>
+
+Before Remotion v4.0.141, it was not defined in which order audio operations would be applied and behavior in preview and render could deviate.
+
+Since Remotion v4.0.141, the order of operations is guaranteed to be the following:
+
+1. Trim audio (using [`startFrom`](/docs/audio#startfrom--endat)).
+2. Offset audio (by putting it in a [sequence](/docs/terminology/sequence)).
+3. Stretch audio (by adding a [`playbackRate`](/docs/audio#playbackrate)).
+
+Example for a 30 FPS composition which is 60 frames long:
+
+1. An [`<Audio>`](/docs/audio) tag has a [`startFrom`](/docs/audio#startfrom--endat) value of 45. The first 1.5 seconds of the audio get trimmed off.
+2. The [`<Audio>`](/docs/audio) tag is in a [`<Sequence>`](/docs/sequence) which starts at `30`. The audio only begins playing at the 1.0 second timeline mark at the 1.5 second audio position.
+3. The [`<Audio>`](/docs/audio) has a [`playbackRate`](/docs/audio#playbackrate) of `2`. The audio gets sped up by 2x, but the starting position and start offset is not affected.
+4. The composition is 60 frames long, so the audio must stop at the 3.5 second mark:
+ > (comp_duration - offset) \* playback_rate + start_from
+ > (60 - 30) \* 2 + 45 => frame 105 or the 3.5 second mark
+5. Result: The section of 1.5sec - 3.5sec gets cut out of the audio and is played in the Remotion timeline between frames 30 and 59 at 2x speed.
+
## See also
- [Importing assets](/docs/assets)