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/dc-offset.js
View on GitHub/**
* DC Offset Detection and Removal Module
*
* DC offset occurs when the audio waveform is shifted from the zero line,
* reducing headroom and potentially causing clicks at edit points.
*/
/**
* Detect DC offset in a channel
* @param {Float32Array} channel - Audio samples
* @returns {Object} { linear, dB, percent, significant }
*/
export function detectDCOffset(channel) {
let sum = 0;
const length = channel.length;
// Calculate mean of all samples
for (let i = 0; i < length; i++) {
sum += channel[i];
}
const dcOffset = sum / length;
const absOffset = Math.abs(dcOffset);
return {
linear: dcOffset,
dB: absOffset > 0 ? 20 * Math.log10(absOffset) : -Infinity,
percent: absOffset * 100,
significant: absOffset > 0.001 // > 0.1% is considered significant
};
}
/**
* Detect DC offset across all channels of a buffer
* @param {AudioBuffer} buffer - Audio buffer to analyze
* @returns {Object} { channels: [], average, significant }
*/
export function detectDCOffsetBuffer(buffer) {
const results = [];
let totalOffset = 0;
for (let ch = 0; ch < buffer.numberOfChannels; ch++) {
const channelData = buffer.getChannelData(ch);
const result = detectDCOffset(channelData);
results.push(result);
totalOffset += Math.abs(result.linear);
}
const averageOffset = totalOffset / buffer.numberOfChannels;
return {
channels: results,
average: {
linear: averageOffset,
dB: averageOffset > 0 ? 20 * Math.log10(averageOffset) : -Infinity,
percent: averageOffset * 100
},
significant: results.some(r => r.significant)
};
}
/**
* Remove DC offset from a channel by subtracting the mean
* @param {Float32Array} channel - Audio samples (modified in place)
* @returns {number} The DC offset that was removed
*/
export function removeDCOffset(channel) {
const { linear: dcOffset } = detectDCOffset(channel);
if (Math.abs(dcOffset) > 1e-10) {
for (let i = 0; i < channel.length; i++) {
channel[i] -= dcOffset;
}
}
return dcOffset;
}
/**
* Remove DC offset from all channels of a buffer
* @param {AudioBuffer} buffer - Audio buffer to process
* @param {Function} onProgress - Progress callback
* @returns {AudioBuffer} New buffer with DC offset removed
*/
export function removeDCOffsetBuffer(buffer, onProgress = null) {
const output = new AudioBuffer({
numberOfChannels: buffer.numberOfChannels,
length: buffer.length,
sampleRate: buffer.sampleRate
});
for (let ch = 0; ch < buffer.numberOfChannels; ch++) {
const input = buffer.getChannelData(ch);
const out = output.getChannelData(ch);
// Copy data
out.set(input);
// Remove DC offset
removeDCOffset(out);
if (onProgress) {
onProgress((ch + 1) / buffer.numberOfChannels);
}
}
return output;
}
/**
* Remove DC offset using a highpass filter (better for real-time)
* This gradually removes DC rather than instant subtraction
* @param {Float32Array} channel - Audio samples
* @param {number} sampleRate - Sample rate
* @param {number} cutoffHz - Cutoff frequency (default 5Hz)
* @returns {Float32Array} Filtered samples
*/
export function removeDCOffsetFiltered(channel, sampleRate, cutoffHz = 5) {
const output = new Float32Array(channel.length);
// Simple 1-pole highpass filter
const rc = 1.0 / (2 * Math.PI * cutoffHz);
const dt = 1.0 / sampleRate;
const alpha = rc / (rc + dt);
let prevInput = 0;
let prevOutput = 0;
for (let i = 0; i < channel.length; i++) {
output[i] = alpha * (prevOutput + channel[i] - prevInput);
prevInput = channel[i];
prevOutput = output[i];
}
return output;
}
/**
* DC Offset severity levels
*/
export const DC_OFFSET_SEVERITY = {
NONE: 'none', // < 0.01%
MINOR: 'minor', // 0.01% - 0.1%
MODERATE: 'moderate', // 0.1% - 1%
SEVERE: 'severe' // > 1%
};
/**
* Get severity level of DC offset
* @param {number} percent - DC offset as percentage
* @returns {string} Severity level
*/
export function getDCOffsetSeverity(percent) {
if (percent < 0.01) return DC_OFFSET_SEVERITY.NONE;
if (percent < 0.1) return DC_OFFSET_SEVERITY.MINOR;
if (percent < 1) return DC_OFFSET_SEVERITY.MODERATE;
return DC_OFFSET_SEVERITY.SEVERE;
}
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 |