Skip to content

Commit d0e57e3

Browse files
authored
Merge pull request #2979 from evoxf1/main
2 parents 1ca8f73 + 0b456a8 commit d0e57e3

18 files changed

Lines changed: 64 additions & 1 deletion

packages/core/src/CompositionManager.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export type TRenderAsset = {
133133
mediaFrame: number;
134134
playbackRate: number;
135135
allowAmplificationDuringRender: boolean;
136+
toneFrequency: number | null;
136137
};
137138

138139
export const compositionsRef = React.createRef<{

packages/core/src/audio/AudioForRendering.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const AudioForRenderingRefForwardingFunction: React.ForwardRefRenderFunction<
5151
playbackRate,
5252
allowAmplificationDuringRender,
5353
onDuration,
54+
toneFrequency,
5455
_remotionInternalNeedsDurationCalculation,
5556
acceptableTimeShiftInSeconds,
5657
...nativeProps
@@ -97,6 +98,7 @@ const AudioForRenderingRefForwardingFunction: React.ForwardRefRenderFunction<
9798
mediaFrame: frame,
9899
playbackRate: props.playbackRate ?? 1,
99100
allowAmplificationDuringRender: allowAmplificationDuringRender ?? false,
101+
toneFrequency: toneFrequency ?? null,
100102
});
101103
return () => unregisterRenderAsset(id);
102104
}, [
@@ -112,6 +114,7 @@ const AudioForRenderingRefForwardingFunction: React.ForwardRefRenderFunction<
112114
playbackRate,
113115
props.playbackRate,
114116
allowAmplificationDuringRender,
117+
toneFrequency,
115118
]);
116119

117120
const {src} = props;

packages/core/src/audio/props.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export type RemotionAudioProps = Omit<
1818
acceptableTimeShiftInSeconds?: number;
1919
allowAmplificationDuringRender?: boolean;
2020
_remotionInternalNeedsDurationCalculation?: boolean;
21+
toneFrequency?: number;
2122
};

packages/core/src/video/OffthreadVideoForRendering.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const OffthreadVideoForRendering: React.FC<OffthreadVideoProps> = ({
2626
muted,
2727
allowAmplificationDuringRender,
2828
transparent = false,
29+
toneFrequency,
2930
...props
3031
}) => {
3132
const absoluteFrame = useTimelinePosition();
@@ -95,6 +96,7 @@ export const OffthreadVideoForRendering: React.FC<OffthreadVideoProps> = ({
9596
mediaFrame: frame,
9697
playbackRate: playbackRate ?? 1,
9798
allowAmplificationDuringRender: allowAmplificationDuringRender ?? false,
99+
toneFrequency: toneFrequency ?? null,
98100
});
99101

100102
return () => unregisterRenderAsset(id);
@@ -109,6 +111,7 @@ export const OffthreadVideoForRendering: React.FC<OffthreadVideoProps> = ({
109111
absoluteFrame,
110112
playbackRate,
111113
allowAmplificationDuringRender,
114+
toneFrequency,
112115
]);
113116

114117
const currentTime = useMemo(() => {

packages/core/src/video/VideoForDevelopment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<
4949
// @ts-expect-error
5050
acceptableTimeShift,
5151
acceptableTimeShiftInSeconds,
52+
toneFrequency,
5253
...nativeProps
5354
} = props;
5455
if (typeof acceptableTimeShift !== 'undefined') {

packages/core/src/video/VideoForRendering.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const VideoForRenderingForwardFunction: React.ForwardRefRenderFunction<
4141
allowAmplificationDuringRender,
4242
playbackRate,
4343
onDuration,
44+
toneFrequency,
4445
...props
4546
},
4647
ref,
@@ -110,6 +111,7 @@ const VideoForRenderingForwardFunction: React.ForwardRefRenderFunction<
110111
mediaFrame: frame,
111112
playbackRate: playbackRate ?? 1,
112113
allowAmplificationDuringRender: allowAmplificationDuringRender ?? false,
114+
toneFrequency: toneFrequency ?? null,
113115
});
114116

115117
return () => unregisterRenderAsset(id);
@@ -124,6 +126,7 @@ const VideoForRenderingForwardFunction: React.ForwardRefRenderFunction<
124126
absoluteFrame,
125127
playbackRate,
126128
allowAmplificationDuringRender,
129+
toneFrequency,
127130
]);
128131

129132
useImperativeHandle(

packages/core/src/video/props.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type RemotionVideoProps = Omit<
1717
playbackRate?: number;
1818
acceptableTimeShiftInSeconds?: number;
1919
allowAmplificationDuringRender?: boolean;
20+
toneFrequency?: number;
2021
};
2122

2223
type DeprecatedOffthreadVideoProps = {
@@ -37,6 +38,7 @@ export type OffthreadVideoProps = {
3738
onError?: React.ReactEventHandler<HTMLVideoElement | HTMLImageElement>;
3839
acceptableTimeShiftInSeconds?: number;
3940
allowAmplificationDuringRender?: boolean;
41+
toneFrequency?: number;
4042
transparent?: boolean;
4143
} & RemotionMainVideoProps &
4244
DeprecatedOffthreadVideoProps;

packages/docs/docs/audio.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,19 @@ export const MyVideo = () => {
125125
};
126126
```
127127

128+
### `toneFrequency`<AvailableFrom v="4.0.47"/>
129+
130+
Allows you to adjust the pitch of the audio - will only be applied during rendering. 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.
131+
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%.
132+
`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.
133+
128134
## `acceptableTimeShiftInSeconds`<AvailableFrom v="3.2.42"/>
129135

130136
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.
131137

132138
## `allowAmplificationDuringRender`<AvailableFrom v="3.3.17"/>
133139

134-
Make values for [`volume`](#volume) greater than `1` result in amplification during renders.
140+
Make values for [`volume`](#volume) greater than `1` result in amplification during renders.
135141
In the Remotion Studio, the volume will be limited to `1`, since the browser cannot amplify audio.
136142

137143
## See also

packages/docs/docs/offthreadvideo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ With `png`, transparent videos (VP8, VP9, ProRes) can be displayed, however it i
6464
Make values for [`volume`](/docs/video#volume) greater than `1` result in amplification during renders.
6565
During Preview, the volume will be limited to `1`, since the browser cannot amplify audio.
6666

67+
### `toneFrequency`<AvailableFrom v="4.0.47"/>
68+
69+
Allows you to adjust the pitch of the audio - will only be applied during rendering. 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.
70+
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%.
71+
`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.
72+
6773
### `onError`
6874

6975
Handle an error playing the video. From v3.3.89, if you pass an `onError` callback, then no exception will be thrown. Previously, the error could not be caught.

packages/docs/docs/video.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ In the [Studio](/docs/terminology#remotion-studio) or in the [Remotion Player](/
187187
Make values for [`volume`](#volume) greater than `1` result in amplification during renders.
188188
During Preview, the volume will be limited to `1`, since the browser cannot amplify audio.
189189

190+
### `toneFrequency`<AvailableFrom v="4.0.47"/>
191+
192+
Allows you to adjust the pitch of the audio - will only be applied during rendering. 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.
193+
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%.
194+
`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.
195+
190196
### `onError`
191197

192198
Handle an error playing the video. From v3.3.89, if you pass an `onError` callback, then no exception will be thrown. Previously, the error could not be caught.

0 commit comments

Comments
 (0)