Skip to content

🎥 Make videos programmatically with React

update

Jonny Burger59fd0d48936b
diff --git a/packages/docs/docs/audio.md b/packages/docs/docs/audio.md
index bf26e91c19..b40bb23cef 100644
--- a/packages/docs/docs/audio.md
+++ b/packages/docs/docs/audio.md
@@ -127,22 +127,10 @@ export const MyVideo = () => {
### `toneFrequency`<AvailableFrom v="4.0.47"/>
-The `toneFrequency` property allows you to adjust the pitch of the audio. It 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.
-For example, a `toneFrequency` of 0.5 would lower the pitch by half, and a `toneFrequency` of `1.5` would increase the pitch by `50%`.
+Allows you to adjust the pitch of the audio. It 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.
+For example, a `toneFrequency` of 0.5 would lower the pitch by half, and a `toneFrequency` of `1.5` would increase the pitch by 50%.
`toneFrequency` should be a positive number between `0.01` (representing the lowest assignable pitch) and `2` (representing the highest assignable pitch). If `toneFrequency` is not specified or null, it defaults to `1`, maintaining the original pitch.
-```tsx twoslash
-import { AbsoluteFill, Audio, staticFile } from "remotion";
-
-export const MyVideo = () => {
- return (
- <AbsoluteFill>
- <Audio src={staticFile("audio.mp3")} toneFrequency={0.5} />
- </AbsoluteFill>
- );
-};
-```
-
## `acceptableTimeShiftInSeconds`<AvailableFrom v="3.2.42"/>
In the [Remotion Studio](/docs/terminology#remotion-studio) or in the [Remotion Player](/docs/player), Remotion will seek the audio if it gets too much out of sync with Remotion's internal time - be it due to the audio loading or the page being too slow to keep up in real-time. By default, a seek is triggered if `0.45` seconds of time shift is encountered. Using this prop, you can customize the threshold.
diff --git a/packages/renderer/src/stringify-ffmpeg-filter.ts b/packages/renderer/src/stringify-ffmpeg-filter.ts
index b1585ac135..f1cd04e6ef 100644
--- a/packages/renderer/src/stringify-ffmpeg-filter.ts
+++ b/packages/renderer/src/stringify-ffmpeg-filter.ts
@@ -84,7 +84,7 @@ export const stringifyFfmpegFilter = ({
volumeFilter.value === '1'
? null
: `volume=${volumeFilter.value}:eval=${volumeFilter.eval}`,
- toneFrequency
+ toneFrequency && toneFrequency !== 1
? `asetrate=${DEFAULT_SAMPLE_RATE}*${toneFrequency},aresample=${DEFAULT_SAMPLE_RATE},atempo=1/${toneFrequency}`
: null,
// For n channels, we delay n + 1 channels.