🎥 Make videos programmatically with React
Limiting toneFrequency Value and updating the docs
evoxf111c778b76b3f
diff --git a/packages/docs/docs/audio.md b/packages/docs/docs/audio.mdindex 6c2ceeecc6..bf26e91c19 100644--- a/packages/docs/docs/audio.md+++ b/packages/docs/docs/audio.md@@ -127,7 +127,9 @@ export const MyVideo = () => {### `toneFrequency`<AvailableFrom v="4.0.47"/>-The `toneFrequency` prop allows you to adjust the pitch of the audio. It accepts a number between 0 and 1, where 0 represents the lowest pitch and 1 represents the highest pitch. For example, a toneFrequency of 0.5 would lower the pitch by half. The valid range for toneFrequency is from 0 (lowest pitch) to 1 (highest pitch).+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%`.+`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 twoslashimport { AbsoluteFill, Audio, staticFile } from "remotion";diff --git a/packages/renderer/src/stringify-ffmpeg-filter.ts b/packages/renderer/src/stringify-ffmpeg-filter.tsindex ba9ac40840..fa3ee3dd1d 100644--- a/packages/renderer/src/stringify-ffmpeg-filter.ts+++ b/packages/renderer/src/stringify-ffmpeg-filter.ts@@ -44,6 +44,20 @@ export const stringifyFfmpegFilter = ({return null;}+ if (+ toneFrequency === null ||+ toneFrequency <= 0 ||+ toneFrequency > 2 ||+ toneFrequency % 0.01 !== 0+ ) {+ throw new Error(+ 'toneFrequency must be a positive number between 0.01 and 2 with up to two decimal places & if toneFrequency is null, it will be set to 1 (default pitch)',+ );+ }++ // If toneFrequency is null, set it to 1 (default pitch)+ toneFrequency = parseFloat(toneFrequency.toFixed(2)) || 1;+const volumeFilter = ffmpegVolumeExpression({volume,fps,