Package Exports
- robinwood
- robinwood/package.json
Readme
RobinWood
A library to cut silence and speed up audio before sending to Whisper.
Installation
npm install robinwoodUsage
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 fileoutputFile(string): Path where the processed file will be savedspeed(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.0→silenceDb = -10 dB(very aggressive)temperature = 0.5→silenceDb = -25 dB(moderate)temperature = 0.7→silenceDb = -31 dBtemperature = 1.0→silenceDb = -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
Silence Detection: Custom algorithm that analyzes audio amplitude and detects periods of silence based on the temperature threshold.
Silence Removal: Removes detected silence periods while preserving audio quality.
Speed Processing: Uses linear interpolation to speed up audio while maintaining pitch.
Pure JavaScript: All processing is done in JavaScript without external dependencies.
License
MIT