add_audio_keyframes
Adds keyframes to audio levels for dynamic volume changes in Adobe Premiere Pro clips, enabling precise control over audio transitions.
Instructions
Adds keyframes to audio levels for dynamic volume changes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clipId | Yes | The ID of the audio clip | |
| keyframes | Yes | Array of keyframe data |
Implementation Reference
- src/tools/index.ts:1419-1470 (handler)Handler function that implements the tool logic by constructing an ExtendScript to add keyframes to the Volume property of an audio clip's component in Premiere Pro.private async addAudioKeyframes(clipId: string, keyframes: Array<{time: number, level: number}>): Promise<any> { const script = ` try { var clip = app.project.getClipByID("${clipId}"); if (!clip) { JSON.stringify({ success: false, error: "Clip not found" }); return; } var audioComponent = clip.components[0]; if (!audioComponent || !audioComponent.properties["Volume"]) { JSON.stringify({ success: false, error: "Audio component not found or clip has no audio" }); return; } var volumeProperty = audioComponent.properties["Volume"]; var addedKeyframes = []; ${keyframes.map(kf => ` try { volumeProperty.addKey(new Time("${kf.time}s")); volumeProperty.setValueAtKey(new Time("${kf.time}s"), ${kf.level}); addedKeyframes.push({ time: ${kf.time}, level: ${kf.level} }); } catch (e) { // Keyframe already exists or invalid time } `).join('\n')} JSON.stringify({ success: true, message: "Audio keyframes added successfully", clipId: "${clipId}", addedKeyframes: addedKeyframes, totalKeyframes: addedKeyframes.length }); } catch (e) { JSON.stringify({ success: false, error: e.toString() }); } `; return await this.bridge.executeScript(script); }
- src/tools/index.ts:239-248 (schema)Input schema using Zod for validating the tool's parameters: clipId and keyframes array.name: 'add_audio_keyframes', description: 'Adds keyframes to audio levels for dynamic volume changes.', inputSchema: z.object({ clipId: z.string().describe('The ID of the audio clip'), keyframes: z.array(z.object({ time: z.number().describe('Time in seconds'), level: z.number().describe('Audio level in dB') })).describe('Array of keyframe data') }) },
- src/tools/index.ts:486-487 (registration)Registration in the executeTool method's switch statement, dispatching to the handler.case 'add_audio_keyframes': return await this.addAudioKeyframes(args.clipId, args.keyframes);
- dist/tools/index.d.ts:44-44 (registration)TypeScript declaration of the handler method.private addAudioKeyframes;