Capítulo 837 de 988

Chapter 837: Experiments

Core Idea

This page aims to collect experiments and hacks that were made to the Remotion Recorder

Key Concepts

  • Swear word detection
  • AI audio enhancement
  • Code Hike integration

Code Examples

const API_URL = 'https://api.ai-coustics.com/v1';
const API_KEY = process.env.AI_COUSTICS_API_KEY;

if (!API_KEY) {
  console.error('AI_COUSTICS_API_KEY environment variable is required');
  process.exit(1);
}

async function uploadAndEnhance(
  audioBuffer: ArrayBuffer,
  fileName: string,
  options: {
    loudness_target_level?: number;
    loudness_peak_limit?: number;
    enhancement_level?: number;
    transcode_kind?: string;
  } = {},
) {
  const {loudness_target_level = -14, loudness_peak_limit = -1, enhancement_level = 0.7, transcode_kind = 'MP3'} = options;

  const formData = new FormData();
  formData.append('loudness_target_level', loudness_target_level.toString());
  formData.append('loudness_peak_limit', loudness_peak_limit.toString());
  formData.append('enhancement_level', enhancement_level.toString());
  formData.append('transcode_kind', transcode_kind);
  formData.append('model_arch', 'FINCH');

  const audioBlob = new Blob([audioBuffer], {
    type: 'application/octet-stream',
  });
  formData.append('file', audioBlob, fileName);

  if (!API_KEY) {
    throw new Error('API_KEY is undefined');
  }

  try {
    const response = await fetch(`${API_URL}/media/enhance`, {
      method: 'POST',
      headers: {
        'X-API-Key': API_KEY,
      },
      body: formData,
    });

    if (response.status !== 201) {
      const responseText = await response.text();

// ...(truncated)
  • What it demonstrates: Usage pattern for Experiments from the official docs.

Key Takeaways

  1. Understand swear word detection when working with Experiments.
  2. Understand ai audio enhancement when working with Experiments.
  3. Understand code hike integration when working with Experiments.

Connects To

  • Captions: related page in the Recorder (@remotion/recorder) section.
  • Create: related page in the Recorder (@remotion/recorder) section.
  • Demo: related page in the Recorder (@remotion/recorder) section.