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/true-peak.js
View on GitHub/**
* True Peak Detection Module
* ITU-R BS.1770 compliant true-peak detection with 4x oversampling
*/
/**
* Calculate true peak using 4x oversampled Catmull-Rom interpolation
* This finds inter-sample peaks that simple sample-based measurement misses
*
* @param {Array} prevSamples - Array of 4 consecutive samples [y0, y1, y2, y3]
* @returns {number} True peak value (linear)
*/
export function calculateTruePeakSample(prevSamples) {
const y0 = prevSamples[0];
const y1 = prevSamples[1];
const y2 = prevSamples[2];
const y3 = prevSamples[3];
// Start with current sample
let peak = Math.abs(y2);
// Catmull-Rom spline coefficients: y(t) = a0*t³ + a1*t² + a2*t + a3
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;
// Check at 4x oversampled points
for (let i = 1; i <= 3; i++) {
const t = i * 0.25;
const t2 = t * t;
const t3 = t2 * t;
const interpolated = a0 * t3 + a1 * t2 + a2 * t + a3;
peak = Math.max(peak, Math.abs(interpolated));
}
return peak;
}
/**
* Find the true peak of an AudioBuffer using 4x oversampling
*
* @param {AudioBuffer} audioBuffer - Input audio buffer
* @returns {number} Peak in dBTP (decibels relative to full scale)
*/
export function findTruePeak(audioBuffer) {
let maxPeak = 0;
for (let ch = 0; ch < audioBuffer.numberOfChannels; ch++) {
const channelData = audioBuffer.getChannelData(ch);
const prevSamples = [0, 0, 0, 0];
for (let i = 0; i < channelData.length; i++) {
// Shift previous samples
prevSamples[0] = prevSamples[1];
prevSamples[1] = prevSamples[2];
prevSamples[2] = prevSamples[3];
prevSamples[3] = channelData[i];
if (i >= 3) {
const truePeak = calculateTruePeakSample(prevSamples);
if (truePeak > maxPeak) {
maxPeak = truePeak;
}
}
}
}
// Convert to dBTP (0 dBTP = 1.0 linear)
return maxPeak > 0 ? 20 * Math.log10(maxPeak) : -Infinity;
}
/**
* Find true peak of a Float32Array channel
*
* @param {Float32Array} channelData - Single channel audio data
* @returns {number} Peak in linear scale
*/
export function findChannelTruePeak(channelData) {
let maxPeak = 0;
const prevSamples = [0, 0, 0, 0];
for (let i = 0; i < channelData.length; i++) {
prevSamples[0] = prevSamples[1];
prevSamples[1] = prevSamples[2];
prevSamples[2] = prevSamples[3];
prevSamples[3] = channelData[i];
if (i >= 3) {
const truePeak = calculateTruePeakSample(prevSamples);
if (truePeak > maxPeak) {
maxPeak = truePeak;
}
}
}
return maxPeak;
}
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 |