Skip to content

Audio filters

DisTube ships with fifteen audio filters. They are managed per queue, through the FilterManager of the queue.

const queue = distube.getQueue(guildId);
queue.filters.add("nightcore");
queue.filters.remove("nightcore");
Name Description
3d Spacial effect, for headphones.
bassboost Boosts the bass.
echo Adds an echo.
flanger Flanger effect.
gate Removes the silence between the tracks.
haas Stereo widening.
karaoke Removes the vocals.
nightcore Faster and deeper.
reverse Plays the track backwards.
vaporwave Slowed down and deeper.
mcompand Multi band compressor.
phaser Phaser effect.
tremolo Varying the volume.
surround Surround effect.
earwax Enhances the vocals, like earphones.
const queue = distube.getQueue(guildId);
// Enable one filter
queue.filters.add("bassboost");
// Enable several at once
queue.filters.add(["nightcore", "vaporwave"]);
// Disable one, or several
queue.filters.remove("bassboost");
queue.filters.remove(["nightcore", "vaporwave"]);
// Replace every enabled filter
queue.filters.set(["karaoke"]);
// Remove every filter
queue.filters.clear();
// Check whether a filter is enabled
queue.filters.has("bassboost"); // true
// The enabled filters
queue.filters.names; // ["bassboost", "karaoke"]
queue.filters.values; // [{ name: "bassboost", value: "bass=g=10" }, ...]

A filter is a name and the FFmpeg argument it applies.

queue.filters.add({
name: "my-filter",
value: "equalizer=f=1000:width_type=w:width=50:g=-6",
});

The customFilters option replaces the built-in filters, and adds the new ones.

const distube = new DisTube(client, {
customFilters: {
// Replace a built-in filter
nightcore: "asetrate=48000*1.5,aresample=48000,bass=g=8",
// Add a new one
"my-filter": "equalizer=f=1000:width_type=w:width=50:g=-6",
},
});

queue.filters.ffmpegArgs returns the FFmpeg argument that is really sent to the process. It is the first thing to look at when a filter does not behave the way you expect.

console.log(queue.filters.ffmpegArgs); // { af: "bass=g=10,equalizer=..." }