JSPM

robinwood

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q31620F
  • License MIT

A pure JavaScript library to cut silence and speed up audio - no external dependencies required!

Package Exports

  • robinwood
  • robinwood/package.json

Readme

RobinWood

A library to cut silence and speed up audio before sending to Whisper.

Installation

npm install robinwood

Usage

import RobinWood from "robinwood";

(async () => {
  await RobinWood.Steal("input.wav", "output.wav", 1.25, 0.7);
  console.log("Audio processed to output.wav");
})();

API

RobinWood.Steal(inputFile, outputFile, speed, temperature)

Process an audio file by removing silence and speeding up speech.

Parameters

  • inputFile (string): Path to input audio file
  • outputFile (string): Path where the processed file will be saved
  • speed (number): Speed factor (e.g., 1.25 = 25% faster)
    • Must be between 0 and 4
  • temperature (number): Silence cutting aggressiveness control (0-1)
    • 0.0 → very aggressive (threshold ~ -10 dB)
    • 0.5 → moderate (threshold ~ -25 dB)
    • 1.0 → gentle (threshold ~ -40 dB)

Returns

  • Promise<string>: Path to the final processed file

Silence Threshold Formula

silenceDb = -40 + (30 * (1 - temperature))

Examples:

  • temperature = 0.0silenceDb = -10 dB (very aggressive)
  • temperature = 0.5silenceDb = -25 dB (moderate)
  • temperature = 0.7silenceDb = -31 dB
  • temperature = 1.0silenceDb = -40 dB (gentle)

Examples

Basic Example

import RobinWood from "robinwood";

(async () => {
  try {
    await RobinWood.Steal("my_audio.wav", "my_processed.wav", 1.25, 0.7);
    console.log("Audio processed successfully!");
  } catch (error) {
    console.error("Error:", error.message);
  }
})();

Example with Different Configurations

import RobinWood from "robinwood";

async function processAudios() {
  // Aggressive cutting + moderate speed
  await RobinWood.Steal("audio1.wav", "audio1_processed.wav", 1.5, 0.2);
  
  // Gentle cutting + high speed
  await RobinWood.Steal("audio2.wav", "audio2_processed.wav", 2.0, 0.9);
  
  // Moderate cutting + low speed
  await RobinWood.Steal("audio3.wav", "audio3_processed.wav", 1.1, 0.5);
}

processAudios().catch(console.error);

Requirements

  • Node.js >= 14.0.0
  • No external dependencies required! 🎉

Features

  • Zero external dependencies - No FFmpeg needed!
  • Pure JavaScript implementation - Works everywhere
  • Custom algorithms - Built from scratch
  • Cross-platform - Works on any system

How It Works

  1. Silence Detection: Custom algorithm that analyzes audio amplitude and detects periods of silence based on the temperature threshold.

  2. Silence Removal: Removes detected silence periods while preserving audio quality.

  3. Speed Processing: Uses linear interpolation to speed up audio while maintaining pitch.

  4. Pure JavaScript: All processing is done in JavaScript without external dependencies.

License

MIT