π₯ Make videos programmatically with React
Docs: Clarify audio pitch support across renderers
JonnyBurger1c9d6b8dd868
diff --git a/packages/docs/docs/audio/pitch.mdx b/packages/docs/docs/audio/pitch.mdxindex da52bec9c0..85e80150a0 100644--- a/packages/docs/docs/audio/pitch.mdx+++ b/packages/docs/docs/audio/pitch.mdx@@ -6,16 +6,13 @@ id: pitchcrumb: 'Audio'----import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';+Use the `toneFrequency` prop to control the pitch of audio during [server-side rendering](/docs/ssr). It is supported by [`<Audio>`](/docs/media/audio), [`<Video>`](/docs/media/video), [`<Html5Audio>`](/docs/html5-audio), [`<Html5Video>`](/docs/html5-video), and [`<OffthreadVideo>`](/docs/offthreadvideo).-Pitch correction is currently only supported for [`<Html5Audio>`](/docs/html5-audio), [`<Html5Video>`](/docs/html5-video) and [`<OffthreadVideo>`](/docs/offthreadvideo) and during rendering.--You can use the [`toneFrequency`](/docs/html5-audio#tonefrequency) prop to control the pitch of the audio during rendering.+`toneFrequency` is not supported during preview or [client-side rendering](/docs/client-side-rendering).Values between `0.01` and `2` are accepted, where `1` represents the original pitch. Values less than `1` will decrease the pitch, while values greater than `1` will increase it.-A [`toneFrequency`](/docs/html5-audio#tonefrequency) of 0.5 would lower the pitch by half, and a [`toneFrequency`](/docs/html5-audio#tonefrequency) of `1.5` would increase the pitch by 50%.+A `toneFrequency` of 0.5 would lower the pitch by half, and a `toneFrequency` of `1.5` would increase the pitch by 50%.```tsx twoslash {7} title="MyComp.tsx"import {Html5Audio, staticFile, AbsoluteFill} from 'remotion';diff --git a/packages/docs/docs/html5-audio.mdx b/packages/docs/docs/html5-audio.mdxindex fe53c93c2d..c5c4878ccd 100644--- a/packages/docs/docs/html5-audio.mdx+++ b/packages/docs/docs/html5-audio.mdx@@ -129,7 +129,7 @@ Controls whether the audio pitch is preserved when [`playbackRate`](#playbackratAccepts `true`, `false`, or `undefined`. Default: `true`, matching the browser default for [`HTMLMediaElement.preservesPitch`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/preservesPitch).-Note: `preservePitch` only affects preview playback. During render, audio is processed via [`toneFrequency`](/docs/audio/pitch) for render-time pitch control.+`preservePitch` only affects preview playback. During server-side rendering, [`playbackRate`](#playbackrate) always preserves the audio pitch, regardless of this prop. Use [`toneFrequency`](/docs/audio/pitch) to change the pitch during server-side rendering.### `muted?`<AvailableFrom v="2.0.0"/>@@ -171,7 +171,7 @@ export const MyVideo = () => {### `toneFrequency?`<AvailableFrom v="4.0.47"/>-Adjust the pitch of the audio - will only be applied during rendering.+Adjust the pitch of the audio during server-side rendering. This prop is not supported during preview.Accepts a number between `0.01` and `2`, where `1` represents the original pitch. Values less than `1` will decrease the pitch, while values greater than `1` will increase it.diff --git a/packages/docs/docs/html5-video.mdx b/packages/docs/docs/html5-video.mdxindex aa7fba3bf8..9dd38782d9 100644--- a/packages/docs/docs/html5-video.mdx+++ b/packages/docs/docs/html5-video.mdx@@ -185,7 +185,7 @@ Controls whether the audio pitch is preserved when [`playbackRate`](#playbackratAccepts `true`, `false`, or `undefined`. Default: `true`, matching the browser default for [`HTMLMediaElement.preservesPitch`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/preservesPitch).-Note: `preservePitch` only affects preview playback. During render, audio is processed via [`toneFrequency`](/docs/audio/pitch) for render-time pitch control.+`preservePitch` only affects preview playback. During server-side rendering, [`playbackRate`](#playbackrate) always preserves the audio pitch, regardless of this prop. Use [`toneFrequency`](/docs/audio/pitch) to change the pitch during server-side rendering.### `muted?`@@ -232,7 +232,7 @@ In the [Studio](/docs/terminology/studio) or in the [Remotion Player](/docs/play### `toneFrequency?`<AvailableFrom v="4.0.47"/>-Adjust the pitch of the audio - will only be applied during rendering.+Adjust the pitch of the audio during server-side rendering. This prop is not supported during preview.Accepts a number between `0.01` and `2`, where `1` represents the original pitch. Values less than `1` will decrease the pitch, while values greater than `1` will increase it.diff --git a/packages/docs/docs/media/audio.mdx b/packages/docs/docs/media/audio.mdxindex 60873fc655..595996819d 100644--- a/packages/docs/docs/media/audio.mdx+++ b/packages/docs/docs/media/audio.mdx@@ -193,7 +193,9 @@ export const MyComposition = () => {```:::note-Playing a audio in reverse is not supported.+Playing audio in reverse is not supported.++Changing `playbackRate` also changes the audio pitch. Pitch-preserving speed changes are not supported by the Mediabunny and WebCodecs path. If the audio [falls back to `<Html5Audio>`](/docs/media/fallback) during preview or server-side rendering, audio pitch is preserved by default.:::### `loop?`<AvailableFrom v="3.2.29" />diff --git a/packages/docs/docs/media/video.mdx b/packages/docs/docs/media/video.mdxindex 6a19448090..bc02a143cf 100644--- a/packages/docs/docs/media/video.mdx+++ b/packages/docs/docs/media/video.mdx@@ -244,6 +244,8 @@ export const MyComposition = () => {:::notePlaying a video in reverse is not supported.++Changing `playbackRate` also changes the pitch of the video's audio. Pitch-preserving speed changes are not supported by the Mediabunny and WebCodecs path. If the video [falls back to `<OffthreadVideo>`](/docs/media/fallback) during preview or server-side rendering, audio pitch is preserved by default.:::### `muted?`diff --git a/packages/docs/docs/offthreadvideo.mdx b/packages/docs/docs/offthreadvideo.mdxindex ebd854e94b..b77284ee3b 100644--- a/packages/docs/docs/offthreadvideo.mdx+++ b/packages/docs/docs/offthreadvideo.mdx@@ -160,7 +160,7 @@ A name and that will be shown as the label of the sequence in the timeline of th### `toneFrequency?`<AvailableFrom v="4.0.47"/>-Adjust the pitch of the audio - will only be applied during rendering.+Adjust the pitch of the audio during server-side rendering. This prop is not supported during preview.Accepts a number between `0.01` and `2`, where `1` represents the original pitch. Values less than `1` will decrease the pitch, while values greater than `1` will increase it.@@ -199,7 +199,7 @@ Controls whether the audio pitch is preserved when [`playbackRate`](#playbackratAccepts `true`, `false`, or `undefined`. Default: `true`, matching the browser default for [`HTMLMediaElement.preservesPitch`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/preservesPitch).-Note: `preservePitch` only affects preview playback. During render, audio is processed via [`toneFrequency`](/docs/audio/pitch) for render-time pitch control.+`preservePitch` only affects preview playback. During server-side rendering, [`playbackRate`](#playbackrate) always preserves the audio pitch, regardless of this prop. Use [`toneFrequency`](/docs/audio/pitch) to change the pitch during server-side rendering.### `muted?`@@ -223,7 +223,7 @@ In the [Studio](/docs/terminology/studio) or in the [Remotion Player](/docs/play### `toneFrequency?`<AvailableFrom v="4.0.47"/>-Adjust the pitch of the audio - will only be applied during rendering.+Adjust the pitch of the audio during server-side rendering. This prop is not supported during preview.Accepts a number between `0.01` and `2`, where `1` represents the original pitch. Values less than `1` will decrease the pitch, while values greater than `1` will increase it.diff --git a/packages/docs/docs/video-tags.mdx b/packages/docs/docs/video-tags.mdxindex 28fcc973ba..6be1c24ecf 100644--- a/packages/docs/docs/video-tags.mdx+++ b/packages/docs/docs/video-tags.mdx@@ -29,11 +29,15 @@ The comparison below shows when a fallback or alternative may be relevant.| **HLS Support** | [β Supported](/docs/hls) | [Chrome v142+, only during preview](/docs/hls) | [Only during preview](/docs/hls) || **CORS required** | Yes | No | No || **Loopable** | β | β | β |-| **`playbackRate`** <br/> (Speed Change) | β | β | β |-| **`toneFrequency`** <br/> (Pitch Change) | Only during rendering | Only during rendering | Only during rendering |+| **`playbackRate`** <br/> (Speed Change) | β , but audio pitch changes with the speed | β , audio pitch is preserved by default | β , audio pitch is preserved by default |+| **`toneFrequency`** <br/> (Pitch Change) | Only during server-side rendering | Only during server-side rendering | Only during server-side rendering || **[Three.js texture](/docs/videos/as-threejs-texture)** | [Snippet](/docs/videos/as-threejs-texture) - works best | [`useOffthreadVideoTexture()`](/docs/use-offthread-video-texture) | [ `useVideoTexture()` ](/docs/use-video-texture) || **[Client-side rendering](/docs/client-side-rendering)** | β | β | β |+`playbackRate` changes the media speed with all three components. In the Mediabunny and WebCodecs path used by `<Video>` and `<Audio>` from `@remotion/media`, it also changes the audio pitch. Pitch-preserving speed changes are not currently supported by this path during preview, [server-side rendering](/docs/ssr), or [client-side rendering](/docs/client-side-rendering).++`<OffthreadVideo>`, `<Html5Video>`, and `<Html5Audio>` preserve audio pitch by default during preview and server-side rendering. If `@remotion/media` falls back to one of these components, the fallback component's behavior applies.+## Using a different tag in preview and renderingUse the [`useRemotionEnvironment()`](/docs/use-remotion-environment) hook to render a different component in preview and rendering.