remotion-dev/remotion · error

toneFrequency must be the same across the entire audio, got

Error message

toneFrequency must be the same across the entire audio, got ${asset.toneFrequency}, but before it was ${previousFrequency}

What it means

createAudioMixer builds an audio mixing graph for inline audio assets and requires that all assets sharing the same asset id use an identical toneFrequency, since a single mixing node per id cannot vary its playback frequency mid-stream. If a later asset with the same id carries a different toneFrequency than one seen earlier, this error is thrown naming both values.

Solutions

  1. Give each <Audio> asset with a different toneFrequency a unique id
  2. Use the same toneFrequency value for all assets sharing one id
  3. Split the audio into separate files/segments if you need per-segment pitch changes
  4. Audit generated sequences to ensure ids are unique per (src, toneFrequency) pair

Example fix

// before
<Audio src={s} id="voice" toneFrequency={1} />
<Audio src={s} id="voice" toneFrequency={1.5} /> // conflict
// after
<Audio src={s} id="voice-normal" toneFrequency={1} />
<Audio src={s} id="voice-pitched" toneFrequency={1.5} />
Defensive patterns

Strategy: validation

Validate before calling

const byId = new Map();
for (const a of inlineAudio) {
  const prev = byId.get(a.id);
  if (prev !== undefined && prev !== a.toneFrequency) {
    throw new Error(`Conflicting toneFrequency for asset ${a.id}`);
  }
  byId.set(a.id, a.toneFrequency);
}

Try / catch

try {
  const mixer = await createAudioMixer({inlineAudio, ...});
} catch (e) {
  if (e.message.includes('toneFrequency must be the same')) {
    // regenerate audio with unique ids per toneFrequency
  }
}

Prevention

When it happens

Trigger: Passing inlineAudio to createAudioMixer where two <Audio> assets with the same id have different toneFrequency props — e.g. the same audio file rendered twice with different pitch settings but the same implicit/explicit id.

Common situations: Reusing an audio asset id across multiple <Audio> tags with different toneFrequency values; dynamically generating audio sequences where toneFrequency changes per segment but ids collide; upgrading Remotion and combining previously independent audio tags.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18). Data as JSON: /api/errors/16be1e59a040ae63. Report an issue: GitHub.

Appendix: source

Thrown at packages/web-renderer/src/audio.ts:98

			// frame do not accumulate into audio/video drift.
			const numberOfFrames =
				Math.round(((frameIndex + 1) * sampleRate) / fps) -
				Math.round((frameIndex * sampleRate) / fps);
			frameIndex++;
			const frame: PendingAudioFrame = {
				timestamp,
				mixed: new Float64Array(numberOfFrames * TARGET_NUMBER_OF_CHANNELS),
				pendingAssets: 0,
			};
			pendingFrames.push(frame);

			for (const asset of inlineAudio) {
				const previousFrequency = toneFrequencies.get(asset.id);
				if (
					previousFrequency !== undefined &&
					previousFrequency !== asset.toneFrequency
				) {
					throw new Error(
						`toneFrequency must be the same across the entire audio, got ${asset.toneFrequency}, but before it was ${previousFrequency}`,
					);
				}

				toneFrequencies.set(asset.id, asset.toneFrequency);
				if (asset.toneFrequency === 1) {
					for (
						let i = 0;
						i < Math.min(asset.audio.length, frame.mixed.length);
						i++
					) {
						frame.mixed[i] += asset.audio[i];
					}

					continue;
				}

				let state = shifters.get(asset.id);

View on GitHub (pinned to 46a3a6bf13)