konradre/video-production-skills / skills/mastering-audio
mastering-audio
VerifiedMaster audio files (especially Suno/Udio AI music) for streaming release with LUFS normalization, true peak limiting, and optional enhancements. Triggers — "master this", "master the track", "LUFS normalize", "optimize for streaming". Not for a spot's or film's delivery loudness — use video-finish-qc.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.4 KB |
| lib/dsp/constants.js | script | 1.8 KB |
| lib/dsp/dc-offset.js | script | 4.2 KB |
| lib/dsp/dynamic-leveler.js | script | 10.6 KB |
| lib/dsp/dynamic-processor.js | script | 16.8 KB |
| lib/dsp/exciter.js | script | 7.9 KB |
| lib/dsp/fft.js | script | 6.5 KB |
| lib/dsp/final-filters.js | script | 3.2 KB |
| lib/dsp/index.js | script | 3.2 KB |
| lib/dsp/limiter.js | script | 12.2 KB |
| lib/dsp/lufs.js | script | 5.7 KB |
| lib/dsp/multiband-saturation.js | script | 13.3 KB |
| lib/dsp/multiband-transient.js | script | 8.1 KB |
| lib/dsp/multiband.js | script | 8.2 KB |
| lib/dsp/normalizer.js | script | 4.5 KB |
| lib/dsp/saturation.js | script | 9.3 KB |
| lib/dsp/soft-clipper.js | script | 9.1 KB |
| lib/dsp/stereo.js | script | 8.8 KB |
| lib/dsp/transient.js | script | 7.9 KB |
| lib/dsp/true-peak.js | script | 2.6 KB |
| lib/dsp/utils.js | script | 4.4 KB |
| lib/src/audio-buffer-shim.js | script | 3.6 KB |
| lib/src/wav-encoder.js | script | 5.1 KB |
| package-lock.json | manifest | 611 B |
| package.json | manifest | 187 B |
| scripts/master.mjs | script | 15.2 KB |
lib/dsp/utils.js
View on GitHub/**
* DSP Utility Functions
* Biquad filter implementations and coefficient calculators
*/
/**
* Apply biquad filter to audio samples
* @param {Float32Array} samples - Input samples
* @param {Object} coeffs - Filter coefficients {b0, b1, b2, a1, a2}
* @returns {Float32Array} Filtered output samples
*/
export function applyBiquadFilter(samples, coeffs) {
const output = new Float32Array(samples.length);
let x1 = 0, x2 = 0, y1 = 0, y2 = 0;
const { b0, b1, b2, a1, a2 } = coeffs;
for (let i = 0; i < samples.length; i++) {
const x0 = samples[i];
const y0 = b0 * x0 + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2;
output[i] = y0;
x2 = x1; x1 = x0;
y2 = y1; y1 = y0;
}
return output;
}
/**
* Calculate biquad coefficients for high shelf filter (K-weighting)
* @param {number} sampleRate - Sample rate in Hz
* @param {number} frequency - Center frequency in Hz
* @param {number} gainDB - Gain in dB
* @param {number} Q - Q factor
* @returns {Object} Biquad coefficients {b0, b1, b2, a1, a2}
*/
export function calcHighShelfCoeffs(sampleRate, frequency, gainDB, Q) {
const A = Math.pow(10, gainDB / 40);
const w0 = 2 * Math.PI * frequency / sampleRate;
const cosW0 = Math.cos(w0);
const sinW0 = Math.sin(w0);
const alpha = sinW0 / (2 * Q);
const b0 = A * ((A + 1) + (A - 1) * cosW0 + 2 * Math.sqrt(A) * alpha);
const b1 = -2 * A * ((A - 1) + (A + 1) * cosW0);
const b2 = A * ((A + 1) + (A - 1) * cosW0 - 2 * Math.sqrt(A) * alpha);
const a0 = (A + 1) - (A - 1) * cosW0 + 2 * Math.sqrt(A) * alpha;
const a1 = 2 * ((A - 1) - (A + 1) * cosW0);
const a2 = (A + 1) - (A - 1) * cosW0 - 2 * Math.sqrt(A) * alpha;
return { b0: b0 / a0, b1: b1 / a0, b2: b2 / a0, a1: a1 / a0, a2: a2 / a0 };
}
/**
* Calculate biquad coefficients for high pass filter (K-weighting)
* @param {number} sampleRate - Sample rate in Hz
* @param {number} frequency - Cutoff frequency in Hz
* @param {number} Q - Q factor
* @returns {Object} Biquad coefficients {b0, b1, b2, a1, a2}
*/
export function calcHighPassCoeffs(sampleRate, frequency, Q) {
const w0 = 2 * Math.PI * frequency / sampleRate;
const cosW0 = Math.cos(w0);
const sinW0 = Math.sin(w0);
const alpha = sinW0 / (2 * Q);
const b0 = (1 + cosW0) / 2;
const b1 = -(1 + cosW0);
const b2 = (1 + cosW0) / 2;
const a0 = 1 + alpha;
const a1 = -2 * cosW0;
const a2 = 1 - alpha;
return { b0: b0 / a0, b1: b1 / a0, b2: b2 / a0, a1: a1 / a0, a2: a2 / a0 };
}
/**
* Convert dB to linear gain
* @param {number} db - Value in dB
* @returns {number} Linear gain
*/
export function dbToLinear(db) {
return Math.pow(10, db / 20);
}
/**
* Convert linear gain to dB
* @param {number} linear - Linear gain
* @returns {number} Value in dB
*/
export function linearToDb(linear) {
return linear > 0 ? 20 * Math.log10(linear) : -Infinity;
}
/**
* Create a Hann window of specified size
* @param {number} size - Window size
* @returns {Float32Array} Hann window coefficients
*/
export function createHannWindow(size) {
const window = new Float32Array(size);
for (let i = 0; i < size; i++) {
window[i] = 0.5 * (1 - Math.cos(2 * Math.PI * i / (size - 1)));
}
return window;
}
/**
* Calculate RMS of a sample array
* @param {Float32Array} samples - Input samples
* @returns {number} RMS value
*/
export function calculateRMS(samples) {
let sum = 0;
for (let i = 0; i < samples.length; i++) {
sum += samples[i] * samples[i];
}
return Math.sqrt(sum / samples.length);
}
/**
* Find peak value in a sample array
* @param {Float32Array} samples - Input samples
* @returns {number} Peak absolute value
*/
export function findPeak(samples) {
let peak = 0;
for (let i = 0; i < samples.length; i++) {
const abs = Math.abs(samples[i]);
if (abs > peak) peak = abs;
}
return peak;
}
/**
* Catmull-Rom interpolation
* Useful for oversampling and true-peak detection
*
* @param {number} y0 - Sample at t-1
* @param {number} y1 - Sample at t=0
* @param {number} y2 - Sample at t=1
* @param {number} y3 - Sample at t=2
* @param {number} t - Interpolation factor (0 to 1)
* @returns {number} Interpolated value
*/
export function interpolateCatmullRom(y0, y1, y2, y3, t) {
const a0 = -0.5 * y0 + 1.5 * y1 - 1.5 * y2 + 0.5 * y3;
const a1 = y0 - 2.5 * y1 + 2 * y2 - 0.5 * y3;
const a2 = -0.5 * y0 + 0.5 * y2;
const a3 = y1;
const t2 = t * t;
const t3 = t2 * t;
return a0 * t3 + a1 * t2 + a2 * t + a3;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |