synthra-client
Version:
A user-friendly Lavalink client designed for NodeJS.
417 lines (416 loc) • 18.3 kB
TypeScript
import { Band } from "../utils/filtersEqualizers";
import { Player } from "./Player";
export declare class Filters {
distortion: distortionOptions | null;
equalizer: Band[];
karaoke: karaokeOptions | null;
player: Player;
rotation: rotationOptions | null;
timescale: timescaleOptions | null;
vibrato: vibratoOptions | null;
reverb: reverbOptions | null;
volume: number;
bassBoostlevel: number;
filtersStatus: Record<AvailableFilters, boolean>;
constructor(player: Player);
/**
* Updates the player's audio filters.
*
* This method sends a request to the player's node to update the filter settings
* based on the current properties of the `Filters` instance. The filters include
* distortion, equalizer, karaoke, rotation, timescale, vibrato, and volume. Once
* the request is sent, it ensures that the player's audio output reflects the
* changes in filter settings.
*
* @returns {Promise<this>} - Returns a promise that resolves to the current instance
* of the Filters class for method chaining.
*/
updateFilters(): Promise<this>;
/**
* Applies a specific filter to the player.
*
* This method allows you to set the value of a specific filter property.
* The filter property must be a valid key of the Filters object.
*
* @param {{ property: T; value: Filters[T] }} filter - An object containing the filter property and value.
* @param {boolean} [updateFilters=true] - Whether to update the filters after applying the filter.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
private applyFilter;
/**
* Sets the status of a specific filter.
*
* This method updates the filter status to either true or false, indicating whether
* the filter is applied or not. This helps track which filters are active.
*
* @param {AvailableFilters} filter - The filter to update.
* @param {boolean} status - The status to set (true for active, false for inactive).
* @returns {this} - Returns the current instance of the Filters class for method chaining.
*/
private setFilterStatus;
/**
* Retrieves the status of a specific filter.
*
* This method returns whether a specific filter is currently applied or not.
*
* @param {AvailableFilters} filter - The filter to check.
* @returns {boolean} - Returns true if the filter is active, false otherwise.
*/
getFilterStatus(filter: AvailableFilters): boolean;
/**
* Clears all filters applied to the audio.
*
* This method resets all filter settings to their default values and removes any
* active filters from the player.
*
* @returns {this} - Returns the current instance of the Filters class for method chaining.
*/
clearFilters(): Promise<this>;
/**
* Sets the own equalizer bands on the audio.
*
* This method adjusts the equalization curve of the player's audio output,
* allowing you to control the frequency response.
*
* @param {Band[]} [bands] - The equalizer bands to apply (band, gain).
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
setEqualizer(bands?: Band[]): Promise<this>;
/**
* Sets the own karaoke options to the audio.
*
* This method adjusts the audio so that it sounds like a karaoke song, with the
* original vocals removed. Note that not all songs can be successfully made into
* karaoke tracks, and some tracks may not sound as good.
*
* @param {karaokeOptions} [karaoke] - The karaoke settings to apply (level, monoLevel, filterBand, filterWidth).
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
setKaraoke(karaoke?: karaokeOptions): Promise<this>;
/**
* Sets the own timescale options to the audio.
*
* This method adjusts the speed and pitch of the audio, allowing you to control the playback speed.
*
* @param {timescaleOptions} [timescale] - The timescale settings to apply (speed and pitch).
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
setTimescale(timescale?: timescaleOptions): Promise<this>;
/**
* Sets the own vibrato options to the audio.
*
* This method applies a vibrato effect to the audio, which adds a wavering,
* pulsing quality to the sound. The effect is created by rapidly varying the
* pitch of the audio.
*
* @param {vibratoOptions} [vibrato] - The vibrato settings to apply (frequency, depth).
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
setVibrato(vibrato?: vibratoOptions): Promise<this>;
/**
* Sets the own rotation options effect to the audio.
*
* This method applies a rotation effect to the audio, which simulates the sound
* moving around the listener's head. This effect can create a dynamic and immersive
* audio experience by altering the directionality of the sound.
*
* @param {rotationOptions} [rotation] - The rotation settings to apply (rotationHz).
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
setRotation(rotation?: rotationOptions): Promise<this>;
/**
* Sets the own distortion options effect to the audio.
*
* This method applies a distortion effect to the audio, which adds a rougher,
* more intense quality to the sound. The effect is created by altering the
* audio signal to create a more jagged, irregular waveform.
*
* @param {distortionOptions} [distortion] - The distortion settings to apply (sinOffset, sinScale, cosOffset, cosScale, tanOffset, tanScale, offset, scale).
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
setDistortion(distortion?: distortionOptions): Promise<this>;
/**
* Sets the bass boost level on the audio.
*
* This method scales the gain of a predefined equalizer curve to the specified level.
* The curve is designed to emphasize or reduce low frequencies, creating a bass-heavy
* or bass-reduced effect.
*
* @param {number} level - The level of bass boost to apply. The value ranges from -3 to 3,
* where negative values reduce bass, 0 disables the effect,
* and positive values increase bass.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*
* @example
* // Apply different levels of bass boost or reduction:
* await player.bassBoost(3); // Maximum Bass Boost
* await player.bassBoost(2); // Medium Bass Boost
* await player.bassBoost(1); // Mild Bass Boost
* await player.bassBoost(0); // No Effect (Disabled)
* await player.bassBoost(-1); // Mild Bass Reduction
* await player.bassBoost(-2); // Medium Bass Reduction
* await player.bassBoost(-3); // Maximum Bass Removal
*/
bassBoost(stage: number): Promise<this>;
/**
* Toggles the chipmunk effect on the audio.
*
* This method applies or removes a chipmunk effect by adjusting the timescale settings.
* When enabled, it increases the speed, pitch, and rate of the audio, resulting in a high-pitched, fast playback
* similar to the sound of a chipmunk.
*
* @param {boolean} status - Whether to enable or disable the chipmunk effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
chipmunk(status: boolean): Promise<this>;
/**
* Toggles the "China" effect on the audio.
*
* This method applies or removes a filter that reduces the pitch of the audio by half,
* without changing the speed or rate. This creates a "hollow" or "echoey" sound.
*
* @param {boolean} status - Whether to enable or disable the "China" effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
china(status: boolean): Promise<this>;
/**
* Toggles the 8D audio effect on the audio.
*
* This method applies or removes an 8D audio effect by adjusting the rotation settings.
* When enabled, it creates a sensation of the audio moving around the listener's head,
* providing an immersive audio experience.
*
* @param {boolean} status - Whether to enable or disable the 8D effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
eightD(status: boolean): Promise<this>;
/**
* Toggles the nightcore effect on the audio.
*
* This method applies or removes a nightcore effect by adjusting the timescale settings.
* When enabled, it increases the speed and pitch of the audio, giving it a more
* upbeat and energetic feel.
*
* @param {boolean} status - Whether to enable or disable the nightcore effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
nightcore(status: boolean): Promise<this>;
/**
* Toggles the slowmo effect on the audio.
*
* This method applies or removes a slowmo effect by adjusting the timescale settings.
* When enabled, it slows down the audio while keeping the pitch the same, giving it
* a more relaxed and calming feel.
*
* @param {boolean} status - Whether to enable or disable the slowmo effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
slowmo(status: boolean): Promise<this>;
/**
* Toggles a soft equalizer effect to the audio.
*
* This method applies or removes a soft equalizer effect by adjusting the equalizer settings.
* When enabled, it reduces the bass and treble frequencies, giving the audio a softer and more
* mellow sound.
*
* @param {boolean} status - Whether to enable or disable the soft equalizer effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
soft(status: boolean): Promise<this>;
/**
* Toggles the TV equalizer effect on the audio.
*
* This method applies or removes a TV equalizer effect by adjusting the equalizer settings.
* When enabled, it enhances specific frequency bands to mimic the audio characteristics
* typically found in television audio outputs.
*
* @param {boolean} status - Whether to enable or disable the TV equalizer effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
tv(status: boolean): Promise<this>;
/**
* Toggles the treble/bass equalizer effect on the audio.
*
* This method applies or removes a treble/bass equalizer effect by adjusting the equalizer settings.
* When enabled, it enhances the treble and bass frequencies, giving the audio a more balanced sound.
*
* @param {boolean} status - Whether to enable or disable the treble/bass equalizer effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
trebleBass(status: boolean): Promise<this>;
/**
* Toggles the vaporwave effect on the audio.
*
* This method applies or removes a vaporwave effect by adjusting the equalizer settings.
* When enabled, it gives the audio a dreamy and nostalgic feel, characteristic of the vaporwave genre.
*
* @param {boolean} status - Whether to enable or disable the vaporwave effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
vaporwave(status: boolean): Promise<this>;
/**
* Toggles the distortion effect on the audio.
*
* This method applies or removes a distortion effect by adjusting the distortion settings.
* When enabled, it adds a rougher, more intense quality to the sound by altering the
* audio signal to create a more jagged, irregular waveform.
*
* @param {boolean} status - Whether to enable or disable the distortion effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
distort(status: boolean): Promise<this>;
/**
* Toggles the party effect on the audio.
*
* This method applies or removes a party effect by adjusting the equalizer settings.
* When enabled, it enhances the bass and treble frequencies, providing a more energetic and lively sound.
*
* @param {boolean} status - Whether to enable or disable the party effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
pop(status: boolean): Promise<this>;
/**
* Toggles a party effect on the audio.
*
* This method applies a party effect to audio.
* @param {boolean} status - Whether to enable or disable the party effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
party(status: boolean): Promise<this>;
/**
* Toggles earrape effect on the audio.
*
* This method applies earrape effect to audio.
* @param {boolean} status - Whether to enable or disable the earrape effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
earrape(status: boolean): Promise<this>;
/**
* Toggles electronic effect on the audio.
*
* This method applies electronic effect to audio.
* @param {boolean} status - Whether to enable or disable the electronic effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
electronic(status: boolean): Promise<this>;
/**
* Toggles radio effect on the audio.
*
* This method applies radio effect to audio.
* @param {boolean} status - Whether to enable or disable the radio effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
radio(status: boolean): Promise<this>;
/**
* Toggles a tremolo effect on the audio.
*
* This method applies a tremolo effect to audio.
* @param {boolean} status - Whether to enable or disable the tremolo effect.
* @returns {this} - Returns the current instance of the Filters class for method chaining.
*/
tremolo(status: boolean): Promise<this>;
/**
* Toggless a darthvader effect on the audio.
*
* This method applies a darthvader effect to audio.
* @param {boolean} status - Whether to enable or disable the darthvader effect.
* @returns {this} - Returns the current instance of the Filters class for method chaining.
*/
darthvader(status: boolean): Promise<this>;
/**
* Toggles a daycore effect on the audio.
*
* This method applies a daycore effect to audio.
* @param {boolean} status - Whether to enable or disable the daycore effect.
* @returns {this} - Returns the current instance of the Filters class for method chaining.
*/
daycore(status: boolean): Promise<this>;
/**
* Toggles a doubletime effect on the audio.
*
* This method applies a doubletime effect to audio.
* @param {boolean} status - Whether to enable or disable the doubletime effect.
* @returns {this} - Returns the current instance of the Filters class for method chaining
*/
doubletime(status: boolean): Promise<this>;
/**
* Toggles the demon effect on the audio.
*
* This method applies or removes a demon effect by adjusting the equalizer,
* timescale, and reverb settings. When enabled, it creates a deeper and more
* intense sound by lowering the pitch and adding reverb to the audio.
*
* @param {boolean} status - Whether to enable or disable the demon effect.
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
*/
demon(status: boolean): Promise<this>;
}
/** Options for adjusting the timescale of audio. */
interface timescaleOptions {
speed?: number;
pitch?: number;
rate?: number;
}
/** Options for applying vibrato effect to audio. */
interface vibratoOptions {
frequency: number;
depth: number;
}
/** Options for applying rotation effect to audio. */
interface rotationOptions {
rotationHz: number;
}
/** Options for applying karaoke effect to audio. */
interface karaokeOptions {
level?: number;
monoLevel?: number;
filterBand?: number;
filterWidth?: number;
}
/** Options for applying distortion effect to audio. */
interface distortionOptions {
sinOffset?: number;
sinScale?: number;
cosOffset?: number;
cosScale?: number;
tanOffset?: number;
tanScale?: number;
offset?: number;
scale?: number;
}
/** Options for applying reverb effect to audio. */
interface reverbOptions {
wet?: number;
dry?: number;
roomSize?: number;
damping?: number;
}
export declare enum AvailableFilters {
BassBoost = "bassboost",
Distort = "distort",
SetDistortion = "setDistortion",
EightD = "eightD",
SetKaraoke = "setKaraoke",
Nightcore = "nightcore",
Slowmo = "slowmo",
Soft = "soft",
TrebleBass = "trebleBass",
SetTimescale = "setTimescale",
TV = "tv",
Vibrato = "vibrato",
Vaporwave = "vaporwave",
Pop = "pop",
Party = "party",
Earrape = "earrape",
Electronic = "electronic",
Radio = "radio",
SetRotation = "setRotation",
Tremolo = "tremolo",
China = "china",
Chipmunk = "chipmunk",
Darthvader = "darthvader",
Daycore = "daycore",
Doubletime = "doubletime",
Demon = "demon"
}
export {};