Add volume normalization, DSP filters (speed, pitch, bassboost), and playlist pagination (#16, #9, #17)

- Implement EBU R128 dynamic volume normalization & ReplayGain leveling in src/music/audio/VolumeNormalizer.mjs and commands/normalize.mjs (#16)
- Add real-time audio filter hot-reloading in PlaybackMixin.mjs and FluxerAudioBridge.mjs (#9)
- Add commands for %bassboost (low/medium/hard), %speed (0.5x-2.0x), and %pitch (0.5x-2.0x) (#9)
- Implement non-blocking background queue ingestion with progressive progress updates for large Spotify & SoundCloud playlists in SearchMixin.mjs (#17)
- Configure playlistLoadLimit: 10 in docker/nodelink.config.json (#17)
- Update README documentation and commands table (total 43 commands)
This commit is contained in:
NoLogicAlan committed 2026-10-22 01:59:45 +03:00
1 parent 90a53f047f
commit 351336ea19
13 files changed
+621 -23

No files matched your search

+86
View File
@@ -0,0 +1,86 @@
/**
* @module commands/speed
* @description Adjust real-time playback speed (0.5× to 2.0×) using timescale DSP filters.
*/
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { Utils } from "../src/utils/Utils.mjs";
/**
* @type {CommandBuilder}
* @description Command definition for the speed command.
*/
export const command = new CommandBuilder()
.setName("speed")
.setDescription("Adjust the playback speed of the current track (0.5× to 2.0×).", "commands.speed")
.setCategory("music")
.addNumberOption(o =>
o.setName("rate")
.setDescription("Playback speed multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×.")
.setRequired(false)
)
.addAliases("rate", "tempo");
/**
* Run handler for the speed command.
*
* @param {object} message - The command message wrapper.
* @param {object} data - Parsed command data.
* @returns {Promise<void>}
*/
export async function run(message, data) {
const p = await this.getPlayer(message, false, false, false);
if (!p) return;
const rawRate = data.get("rate")?.value;
const embed = new EmbedBuilder().setColor(getGlobalColor());
if (rawRate === null || rawRate === undefined || isNaN(Number(rawRate))) {
// Reset to 1.0 or show current speed
const currentTimescale = p.activeFilterPayload?.timescale;
const currentSpeed = currentTimescale?.speed ?? 1.0;
if (currentSpeed !== 1.0) {
// Reset
const existingPayload = { ...(p.activeFilterPayload || {}) };
delete existingPayload.timescale;
await p.applyFilter(existingPayload, Object.keys(existingPayload).length > 0 ? p.activeFilter : null);
embed.setDescription("⏩ Playback speed reset to normal **1.0×**.");
} else {
embed.setDescription(`⏩ Current playback speed: **1.0×**.\nUse \`%speed <0.5-2.0>\` to change playback speed.`);
}
return message.reply({ embeds: [embed] }).catch(() => {});
}
const speed = Utils.clamp(Number(rawRate), 0.5, 2.0);
// Preserve other active filters if present, update only timescale speed
const existingTimescale = p.activeFilterPayload?.timescale || {};
const newTimescale = {
...existingTimescale,
speed,
pitch: existingTimescale.pitch ?? 1.0,
rate: 1.0,
};
const payload = {
...(p.activeFilterPayload || {}),
timescale: newTimescale,
};
const filterMeta = {
key: `speed_${speed}`,
label: `${speed}× Speed`,
emoji: speed > 1 ? "⏩" : "🐢",
};
const res = await p.applyFilter(payload, filterMeta);
if (!res.ok) {
embed.setDescription(`❌ Failed to adjust speed: ${res.reason || "Unknown error"}`);
return message.reply({ embeds: [embed] }).catch(() => {});
}
embed.setDescription(`${speed > 1 ? "⏩" : "🐢"} Playback speed set to **${speed}×**.`);
message.reply({ embeds: [embed] }).catch(() => {});
}