{"record":{"id":"16be1e59a040ae63","repo":"remotion-dev/remotion","slug":"tonefrequency-must-be-the-same-across-the-entire-audio-got","errorCode":null,"errorMessage":"toneFrequency must be the same across the entire audio, got ${asset.toneFrequency}, but before it was ${previousFrequency}","messagePattern":"toneFrequency must be the same across the entire audio, got (.+?), but before it was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/web-renderer/src/audio.ts","lineNumber":98,"sourceCode":"\t\t\t// frame do not accumulate into audio/video drift.\n\t\t\tconst numberOfFrames =\n\t\t\t\tMath.round(((frameIndex + 1) * sampleRate) / fps) -\n\t\t\t\tMath.round((frameIndex * sampleRate) / fps);\n\t\t\tframeIndex++;\n\t\t\tconst frame: PendingAudioFrame = {\n\t\t\t\ttimestamp,\n\t\t\t\tmixed: new Float64Array(numberOfFrames * TARGET_NUMBER_OF_CHANNELS),\n\t\t\t\tpendingAssets: 0,\n\t\t\t};\n\t\t\tpendingFrames.push(frame);\n\n\t\t\tfor (const asset of inlineAudio) {\n\t\t\t\tconst previousFrequency = toneFrequencies.get(asset.id);\n\t\t\t\tif (\n\t\t\t\t\tpreviousFrequency !== undefined &&\n\t\t\t\t\tpreviousFrequency !== asset.toneFrequency\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`toneFrequency must be the same across the entire audio, got ${asset.toneFrequency}, but before it was ${previousFrequency}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\ttoneFrequencies.set(asset.id, asset.toneFrequency);\n\t\t\t\tif (asset.toneFrequency === 1) {\n\t\t\t\t\tfor (\n\t\t\t\t\t\tlet i = 0;\n\t\t\t\t\t\ti < Math.min(asset.audio.length, frame.mixed.length);\n\t\t\t\t\t\ti++\n\t\t\t\t\t) {\n\t\t\t\t\t\tframe.mixed[i] += asset.audio[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tlet state = shifters.get(asset.id);","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/web-renderer/src/audio.ts#L80-L116","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Give each <Audio> asset with a different toneFrequency a unique id","Use the same toneFrequency value for all assets sharing one id","Split the audio into separate files/segments if you need per-segment pitch changes","Audit generated sequences to ensure ids are unique per (src, toneFrequency) pair"],"exampleFix":"// before\n<Audio src={s} id=\"voice\" toneFrequency={1} />\n<Audio src={s} id=\"voice\" toneFrequency={1.5} /> // conflict\n// after\n<Audio src={s} id=\"voice-normal\" toneFrequency={1} />\n<Audio src={s} id=\"voice-pitched\" toneFrequency={1.5} />","handlingStrategy":"validation","validationCode":"const byId = new Map();\nfor (const a of inlineAudio) {\n  const prev = byId.get(a.id);\n  if (prev !== undefined && prev !== a.toneFrequency) {\n    throw new Error(`Conflicting toneFrequency for asset ${a.id}`);\n  }\n  byId.set(a.id, a.toneFrequency);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const mixer = await createAudioMixer({inlineAudio, ...});\n} catch (e) {\n  if (e.message.includes('toneFrequency must be the same')) {\n    // regenerate audio with unique ids per toneFrequency\n  }\n}","preventionTips":["Assign unique ids to <Audio> assets with different toneFrequency values","Keep toneFrequency uniform across all copies of the same asset id","Validate generated sequences for id collisions before rendering"],"tags":["audio","web-renderer","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}