lavalink-client 2.2.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -1
- package/dist/cjs/index.d.ts +7 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/structures/Constants.d.ts +40 -0
- package/dist/cjs/structures/Constants.js +244 -0
- package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/cjs/structures/Filters.d.ts +2 -217
- package/dist/cjs/structures/Filters.js +8 -232
- package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
- package/dist/cjs/structures/LavalinkManager.js +59 -7
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/cjs/structures/Node.d.ts +15 -156
- package/dist/cjs/structures/Node.js +131 -49
- package/dist/cjs/structures/NodeManager.d.ts +54 -52
- package/dist/cjs/structures/NodeManager.js +74 -4
- package/dist/cjs/structures/Player.d.ts +31 -124
- package/dist/cjs/structures/Player.js +77 -43
- package/dist/cjs/structures/Queue.d.ts +66 -42
- package/dist/cjs/structures/Queue.js +69 -11
- package/dist/cjs/structures/Types/Filters.d.ts +190 -0
- package/dist/cjs/structures/Types/Manager.d.ts +184 -0
- package/dist/cjs/structures/Types/Manager.js +2 -0
- package/dist/cjs/structures/Types/Node.d.ts +216 -0
- package/dist/cjs/structures/Types/Node.js +2 -0
- package/dist/cjs/structures/Types/Player.d.ts +108 -0
- package/dist/cjs/structures/Types/Player.js +2 -0
- package/dist/cjs/structures/Types/Queue.d.ts +34 -0
- package/dist/cjs/structures/Types/Queue.js +2 -0
- package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
- package/dist/cjs/structures/Types/Track.js +2 -0
- package/dist/cjs/structures/Types/Utils.d.ts +367 -0
- package/dist/cjs/structures/Types/Utils.js +2 -0
- package/dist/cjs/structures/Utils.d.ts +13 -369
- package/dist/cjs/structures/Utils.js +35 -14
- package/dist/esm/index.d.ts +7 -1
- package/dist/esm/index.js +7 -1
- package/dist/esm/structures/Constants.d.ts +40 -0
- package/dist/esm/structures/Constants.js +241 -0
- package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/esm/structures/Filters.d.ts +2 -217
- package/dist/esm/structures/Filters.js +3 -227
- package/dist/esm/structures/LavalinkManager.d.ts +31 -166
- package/dist/esm/structures/LavalinkManager.js +57 -5
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/esm/structures/Node.d.ts +15 -156
- package/dist/esm/structures/Node.js +122 -40
- package/dist/esm/structures/NodeManager.d.ts +54 -52
- package/dist/esm/structures/NodeManager.js +71 -1
- package/dist/esm/structures/Player.d.ts +31 -124
- package/dist/esm/structures/Player.js +76 -42
- package/dist/esm/structures/Queue.d.ts +66 -42
- package/dist/esm/structures/Queue.js +69 -11
- package/dist/esm/structures/Types/Filters.d.ts +190 -0
- package/dist/esm/structures/Types/Manager.d.ts +184 -0
- package/dist/esm/structures/Types/Manager.js +1 -0
- package/dist/esm/structures/Types/Node.d.ts +216 -0
- package/dist/esm/structures/Types/Node.js +1 -0
- package/dist/esm/structures/Types/Player.d.ts +108 -0
- package/dist/esm/structures/Types/Player.js +1 -0
- package/dist/esm/structures/Types/Queue.d.ts +34 -0
- package/dist/esm/structures/Types/Queue.js +1 -0
- package/dist/{types/structures → esm/structures/Types}/Track.d.ts +3 -2
- package/dist/esm/structures/Types/Track.js +1 -0
- package/dist/esm/structures/Types/Utils.d.ts +367 -0
- package/dist/esm/structures/Types/Utils.js +1 -0
- package/dist/esm/structures/Utils.d.ts +13 -369
- package/dist/esm/structures/Utils.js +35 -14
- package/dist/types/index.d.ts +7 -1
- package/dist/types/structures/Constants.d.ts +40 -0
- package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/types/structures/Filters.d.ts +2 -217
- package/dist/types/structures/LavalinkManager.d.ts +31 -166
- package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/types/structures/Node.d.ts +15 -156
- package/dist/types/structures/NodeManager.d.ts +54 -52
- package/dist/types/structures/Player.d.ts +31 -124
- package/dist/types/structures/Queue.d.ts +66 -42
- package/dist/types/structures/Types/Filters.d.ts +190 -0
- package/dist/types/structures/Types/Manager.d.ts +184 -0
- package/dist/types/structures/Types/Node.d.ts +216 -0
- package/dist/types/structures/Types/Player.d.ts +108 -0
- package/dist/types/structures/Types/Queue.d.ts +34 -0
- package/dist/{esm/structures → types/structures/Types}/Track.d.ts +3 -2
- package/dist/types/structures/Types/Utils.d.ts +367 -0
- package/dist/types/structures/Utils.d.ts +13 -369
- package/package.json +1 -1
- /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
- /package/dist/esm/structures/{Track.js → Types/Filters.js} +0 -0
package/README.md
CHANGED
|
@@ -146,7 +146,7 @@ client.lavalink.on("error", (node, error, payload) => {
|
|
|
146
146
|
- `error` ➡️ `(node, error, payload) => {}`
|
|
147
147
|
- `resumed` ➡️ `(node, payload, players) => {}`
|
|
148
148
|
- Resuming needs to be handled manually by you *(aka add the players to the manager)*
|
|
149
|
-
- e.g
|
|
149
|
+
- e.g. of listening to node events:
|
|
150
150
|
```js
|
|
151
151
|
client.lavalink.nodeManager.on("create", (node, payload) => {
|
|
152
152
|
console.log(`The Lavalink Node #${node.id} connected`);
|
|
@@ -212,6 +212,74 @@ client.lavalink.nodeManager.on("resumed", (node, payload, fetchedPlayers) => {
|
|
|
212
212
|
})
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
+
## Resuming full Example
|
|
216
|
+
Full code sample: can be found on the [Testbot in here](https://github.com/Tomato6966/lavalink-client/blob/main/testBot/Utils/handleResuming.ts)
|
|
217
|
+
```js
|
|
218
|
+
// but here is the schema:
|
|
219
|
+
client.lavalink.nodeManager.on("connect", (node) => node.updateSession(true, 360e3));
|
|
220
|
+
client.lavalink.nodeManager.on("resumed", (node, payload, fetchedPlayers) => {
|
|
221
|
+
// create players:
|
|
222
|
+
for(const fetchedPlayer of fetchedPlayers) {
|
|
223
|
+
// fetchedPlayer is the live data from lavalink
|
|
224
|
+
// saved Player data is the config you should save in a database / file or smt
|
|
225
|
+
const savedPlayerData = await getSavedPlayerData(fetchedPlayer.guildId);
|
|
226
|
+
const player = client.lavalink.createPlayer({
|
|
227
|
+
guildId: fetchedPlayer.guildId,
|
|
228
|
+
});
|
|
229
|
+
// if lavalink says the bot got disconnected, we can skip the resuming, or force reconnect whatever you want!, here we choose to not do anything and thus delete the saved player data
|
|
230
|
+
if(!data.state.connected) {
|
|
231
|
+
console.log("skipping resuming player, because it already disconnected");
|
|
232
|
+
await deletedSavedPlayerData(data.guildId);
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
// now you can create the player based on the live and saved data
|
|
236
|
+
const player = client.lavalink.createPlayer({
|
|
237
|
+
guildId: data.guildId,
|
|
238
|
+
node: node.id,
|
|
239
|
+
// you need to update the volume of the player by the volume of lavalink which might got decremented by the volume decrementer
|
|
240
|
+
volume: client.lavalink.options.playerOptions?.volumeDecrementer
|
|
241
|
+
? Math.round(data.volume / client.lavalink.options.playerOptions.volumeDecrementer)
|
|
242
|
+
: data.volume,
|
|
243
|
+
// all of the following options are needed to be provided by some sort of player saving
|
|
244
|
+
voiceChannelId: dataOfSaving.voiceChannelId,
|
|
245
|
+
textChannelId: dataOfSaving.textChannelId,
|
|
246
|
+
// all of the following options can either be saved too, or you can use pre-defined defaults
|
|
247
|
+
selfDeaf: dataOfSaving.options?.selfDeaf || true,
|
|
248
|
+
selfMute: dataOfSaving.options?.selfMute || false,
|
|
249
|
+
|
|
250
|
+
applyVolumeAsFilter: dataOfSaving.options.applyVolumeAsFilter,
|
|
251
|
+
instaUpdateFiltersFix: dataOfSaving.options.instaUpdateFiltersFix,
|
|
252
|
+
vcRegion: dataOfSaving.options.vcRegion,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// player.voice = data.voice;
|
|
256
|
+
// normally just player.voice is enough, but if you restart the entire bot, you need to create a new connection, thus call player.connect();
|
|
257
|
+
await player.connect();
|
|
258
|
+
|
|
259
|
+
player.filterManager.data = data.filters; // override the filters data
|
|
260
|
+
await player.queue.utils.sync(true, false); // get the queue data including the current track (for the requester)
|
|
261
|
+
// override the current track with the data from lavalink
|
|
262
|
+
if(data.track) player.queue.current = client.lavalink.utils.buildTrack(data.track, player.queue.current?.requester || client.user);
|
|
263
|
+
// override the position of the player
|
|
264
|
+
player.lastPosition = data.state.position;
|
|
265
|
+
player.lastPositionChange = Date.now();
|
|
266
|
+
// you can also override the ping of the player, or wait about 30s till it's done automatically
|
|
267
|
+
player.ping.lavalink = data.state.ping;
|
|
268
|
+
// important to have skipping work correctly later
|
|
269
|
+
player.paused = data.paused;
|
|
270
|
+
player.playing = !data.paused && !!data.track;
|
|
271
|
+
// That's about it
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
client.lavalink.on("playerUpdate", (oldPlayer, newPlayer) => { // automatically sync player data on updates. if you don'T want to save everything you can instead also just save the data on playerCreate
|
|
275
|
+
setSavedPlayerData(newPlayer.toJSON());
|
|
276
|
+
});
|
|
277
|
+
// delete the player again
|
|
278
|
+
client.lavalink.on("playerDestroy", (player) => {
|
|
279
|
+
deleteSavedPlayerData(player.guildId);
|
|
280
|
+
})
|
|
281
|
+
```
|
|
282
|
+
|
|
215
283
|
***
|
|
216
284
|
|
|
217
285
|
|
|
@@ -410,3 +478,29 @@ if(previousTrack) {
|
|
|
410
478
|
await player.play({ clientTrack: previousTrack });
|
|
411
479
|
}
|
|
412
480
|
```
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
## **Version 2.3.0**
|
|
484
|
+
|
|
485
|
+
- Added a heartbeat + ping-pong system to check wether the client is still connected to the node, if the node doesn't receive a ping in time, it will destroy the node and thus cause a reconnect.
|
|
486
|
+
- For that following new nodeOptions got added:
|
|
487
|
+
- `enablePingOnStatsCheck: boolean` (default: true)
|
|
488
|
+
- `heartBeatInterval: number` (default: 30_000)
|
|
489
|
+
- Added new Property on a node:
|
|
490
|
+
- `isAlive: boolean` (if it's false, then it's not connected to the node anymore, and will AUTOMATICALLY Cause a reconnect within the heartBeatInterval)
|
|
491
|
+
- `heartBeatPing: number` (the ping it takes lavalink to respond to the acknowledge of heartbeat)
|
|
492
|
+
- Added new NodeManager Events:
|
|
493
|
+
- `reconnectinprogress` (when the client internal reconnect system is triggered, the actual reconnect gets triggered by the node after your retryDelay)
|
|
494
|
+
- Refactored internal code for better readability and maintainability
|
|
495
|
+
- Removed several intermediate promises
|
|
496
|
+
- Added new types for better type safety
|
|
497
|
+
- Updated types for better type safety
|
|
498
|
+
- Reduced default retryDelay from 30s to 10s
|
|
499
|
+
- Added example on the testbot how to store player data easily and how to use the resume feature, and updated the Resuming Example in the README [jump](#how-to-do-resuming) by adding a [full example](#resuming-full-example)
|
|
500
|
+
|
|
501
|
+
- **"Breaking Change" for providing track / clientTrack for player.play()**
|
|
502
|
+
- Instead of adding the track to the queue and skipping to it, they get directly played by lavalink through replacing the track.
|
|
503
|
+
- To make this work, we need to pass the transformed requester object to the userData of the track. (all handled by the client)
|
|
504
|
+
- *This is technically better than skipping to a track but i wanted to point it out.*
|
|
505
|
+
- You can play with clientTrack like this: `player.play({ clientTrack: searchResult.tracks[0] })`
|
|
506
|
+
- You can play with just track like this: `player.play({ track: { encoded: "base64string..." }, requester: interaction.user })`
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -5,5 +5,11 @@ export * from "./structures/Node";
|
|
|
5
5
|
export * from "./structures/NodeManager";
|
|
6
6
|
export * from "./structures/Player";
|
|
7
7
|
export * from "./structures/Queue";
|
|
8
|
-
export * from "./structures/Track";
|
|
9
8
|
export * from "./structures/Utils";
|
|
9
|
+
export * from "./structures/Types/Track";
|
|
10
|
+
export * from "./structures/Types/Utils";
|
|
11
|
+
export * from "./structures/Types/Filters";
|
|
12
|
+
export * from "./structures/Types/Player";
|
|
13
|
+
export * from "./structures/Types/Queue";
|
|
14
|
+
export * from "./structures/Types/Node";
|
|
15
|
+
export * from "./structures/Constants";
|
package/dist/cjs/index.js
CHANGED
|
@@ -8,5 +8,11 @@ tslib_1.__exportStar(require("./structures/Node"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./structures/NodeManager"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./structures/Player"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./structures/Queue"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./structures/Track"), exports);
|
|
12
11
|
tslib_1.__exportStar(require("./structures/Utils"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./structures/Types/Track"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./structures/Types/Utils"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./structures/Types/Filters"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./structures/Types/Player"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./structures/Types/Queue"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./structures/Types/Node"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./structures/Constants"), exports);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AudioOutputs, ChannelMixFilter, EQBand } from "./Types/Filters";
|
|
2
|
+
export declare enum DestroyReasons {
|
|
3
|
+
QueueEmpty = "QueueEmpty",
|
|
4
|
+
NodeDestroy = "NodeDestroy",
|
|
5
|
+
NodeDeleted = "NodeDeleted",
|
|
6
|
+
LavalinkNoVoice = "LavalinkNoVoice",
|
|
7
|
+
NodeReconnectFail = "NodeReconnectFail",
|
|
8
|
+
Disconnected = "Disconnected",
|
|
9
|
+
PlayerReconnectFail = "PlayerReconnectFail",
|
|
10
|
+
ChannelDeleted = "ChannelDeleted",
|
|
11
|
+
DisconnectAllNodes = "DisconnectAllNodes",
|
|
12
|
+
ReconnectAllNodes = "ReconnectAllNodes"
|
|
13
|
+
}
|
|
14
|
+
export declare const validSponsorBlocks: string[];
|
|
15
|
+
/** The audio Outputs Data map declaration */
|
|
16
|
+
export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
|
|
17
|
+
export declare const EQList: {
|
|
18
|
+
/** A Bassboost Equalizer, so high it distorts the audio */
|
|
19
|
+
BassboostEarrape: EQBand[];
|
|
20
|
+
/** A High and decent Bassboost Equalizer */
|
|
21
|
+
BassboostHigh: EQBand[];
|
|
22
|
+
/** A decent Bassboost Equalizer */
|
|
23
|
+
BassboostMedium: EQBand[];
|
|
24
|
+
/** A slight Bassboost Equalizer */
|
|
25
|
+
BassboostLow: EQBand[];
|
|
26
|
+
/** Makes the Music slightly "better" */
|
|
27
|
+
BetterMusic: EQBand[];
|
|
28
|
+
/** Makes the Music sound like rock music / sound rock music better */
|
|
29
|
+
Rock: EQBand[];
|
|
30
|
+
/** Makes the Music sound like Classic music / sound Classic music better */
|
|
31
|
+
Classic: EQBand[];
|
|
32
|
+
/** Makes the Music sound like Pop music / sound Pop music better */
|
|
33
|
+
Pop: EQBand[];
|
|
34
|
+
/** Makes the Music sound like Electronic music / sound Electronic music better */
|
|
35
|
+
Electronic: EQBand[];
|
|
36
|
+
/** Boosts all Bands slightly for louder and fuller sound */
|
|
37
|
+
FullSound: EQBand[];
|
|
38
|
+
/** Boosts basses + lower highs for a pro gaming sound */
|
|
39
|
+
Gaming: EQBand[];
|
|
40
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EQList = exports.audioOutputsData = exports.validSponsorBlocks = exports.DestroyReasons = void 0;
|
|
4
|
+
var DestroyReasons;
|
|
5
|
+
(function (DestroyReasons) {
|
|
6
|
+
DestroyReasons["QueueEmpty"] = "QueueEmpty";
|
|
7
|
+
DestroyReasons["NodeDestroy"] = "NodeDestroy";
|
|
8
|
+
DestroyReasons["NodeDeleted"] = "NodeDeleted";
|
|
9
|
+
DestroyReasons["LavalinkNoVoice"] = "LavalinkNoVoice";
|
|
10
|
+
DestroyReasons["NodeReconnectFail"] = "NodeReconnectFail";
|
|
11
|
+
DestroyReasons["Disconnected"] = "Disconnected";
|
|
12
|
+
DestroyReasons["PlayerReconnectFail"] = "PlayerReconnectFail";
|
|
13
|
+
DestroyReasons["ChannelDeleted"] = "ChannelDeleted";
|
|
14
|
+
DestroyReasons["DisconnectAllNodes"] = "DisconnectAllNodes";
|
|
15
|
+
DestroyReasons["ReconnectAllNodes"] = "ReconnectAllNodes";
|
|
16
|
+
})(DestroyReasons || (exports.DestroyReasons = DestroyReasons = {}));
|
|
17
|
+
;
|
|
18
|
+
exports.validSponsorBlocks = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "filler"];
|
|
19
|
+
/** The audio Outputs Data map declaration */
|
|
20
|
+
exports.audioOutputsData = {
|
|
21
|
+
mono: {
|
|
22
|
+
leftToLeft: 0.5,
|
|
23
|
+
leftToRight: 0.5,
|
|
24
|
+
rightToLeft: 0.5,
|
|
25
|
+
rightToRight: 0.5,
|
|
26
|
+
},
|
|
27
|
+
stereo: {
|
|
28
|
+
leftToLeft: 1,
|
|
29
|
+
leftToRight: 0,
|
|
30
|
+
rightToLeft: 0,
|
|
31
|
+
rightToRight: 1,
|
|
32
|
+
},
|
|
33
|
+
left: {
|
|
34
|
+
leftToLeft: 1,
|
|
35
|
+
leftToRight: 0,
|
|
36
|
+
rightToLeft: 1,
|
|
37
|
+
rightToRight: 0,
|
|
38
|
+
},
|
|
39
|
+
right: {
|
|
40
|
+
leftToLeft: 0,
|
|
41
|
+
leftToRight: 1,
|
|
42
|
+
rightToLeft: 0,
|
|
43
|
+
rightToRight: 1,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
exports.EQList = {
|
|
47
|
+
/** A Bassboost Equalizer, so high it distorts the audio */
|
|
48
|
+
BassboostEarrape: [
|
|
49
|
+
{ band: 0, gain: 0.6 * 0.375 },
|
|
50
|
+
{ band: 1, gain: 0.67 * 0.375 },
|
|
51
|
+
{ band: 2, gain: 0.67 * 0.375 },
|
|
52
|
+
{ band: 3, gain: 0.4 * 0.375 },
|
|
53
|
+
{ band: 4, gain: -0.5 * 0.375 },
|
|
54
|
+
{ band: 5, gain: 0.15 * 0.375 },
|
|
55
|
+
{ band: 6, gain: -0.45 * 0.375 },
|
|
56
|
+
{ band: 7, gain: 0.23 * 0.375 },
|
|
57
|
+
{ band: 8, gain: 0.35 * 0.375 },
|
|
58
|
+
{ band: 9, gain: 0.45 * 0.375 },
|
|
59
|
+
{ band: 10, gain: 0.55 * 0.375 },
|
|
60
|
+
{ band: 11, gain: -0.6 * 0.375 },
|
|
61
|
+
{ band: 12, gain: 0.55 * 0.375 },
|
|
62
|
+
{ band: 13, gain: -0.5 * 0.375 },
|
|
63
|
+
{ band: 14, gain: -0.75 * 0.375 },
|
|
64
|
+
],
|
|
65
|
+
/** A High and decent Bassboost Equalizer */
|
|
66
|
+
BassboostHigh: [
|
|
67
|
+
{ band: 0, gain: 0.6 * 0.25 },
|
|
68
|
+
{ band: 1, gain: 0.67 * 0.25 },
|
|
69
|
+
{ band: 2, gain: 0.67 * 0.25 },
|
|
70
|
+
{ band: 3, gain: 0.4 * 0.25 },
|
|
71
|
+
{ band: 4, gain: -0.5 * 0.25 },
|
|
72
|
+
{ band: 5, gain: 0.15 * 0.25 },
|
|
73
|
+
{ band: 6, gain: -0.45 * 0.25 },
|
|
74
|
+
{ band: 7, gain: 0.23 * 0.25 },
|
|
75
|
+
{ band: 8, gain: 0.35 * 0.25 },
|
|
76
|
+
{ band: 9, gain: 0.45 * 0.25 },
|
|
77
|
+
{ band: 10, gain: 0.55 * 0.25 },
|
|
78
|
+
{ band: 11, gain: -0.6 * 0.25 },
|
|
79
|
+
{ band: 12, gain: 0.55 * 0.25 },
|
|
80
|
+
{ band: 13, gain: -0.5 * 0.25 },
|
|
81
|
+
{ band: 14, gain: -0.75 * 0.25 },
|
|
82
|
+
],
|
|
83
|
+
/** A decent Bassboost Equalizer */
|
|
84
|
+
BassboostMedium: [
|
|
85
|
+
{ band: 0, gain: 0.6 * 0.1875 },
|
|
86
|
+
{ band: 1, gain: 0.67 * 0.1875 },
|
|
87
|
+
{ band: 2, gain: 0.67 * 0.1875 },
|
|
88
|
+
{ band: 3, gain: 0.4 * 0.1875 },
|
|
89
|
+
{ band: 4, gain: -0.5 * 0.1875 },
|
|
90
|
+
{ band: 5, gain: 0.15 * 0.1875 },
|
|
91
|
+
{ band: 6, gain: -0.45 * 0.1875 },
|
|
92
|
+
{ band: 7, gain: 0.23 * 0.1875 },
|
|
93
|
+
{ band: 8, gain: 0.35 * 0.1875 },
|
|
94
|
+
{ band: 9, gain: 0.45 * 0.1875 },
|
|
95
|
+
{ band: 10, gain: 0.55 * 0.1875 },
|
|
96
|
+
{ band: 11, gain: -0.6 * 0.1875 },
|
|
97
|
+
{ band: 12, gain: 0.55 * 0.1875 },
|
|
98
|
+
{ band: 13, gain: -0.5 * 0.1875 },
|
|
99
|
+
{ band: 14, gain: -0.75 * 0.1875 },
|
|
100
|
+
],
|
|
101
|
+
/** A slight Bassboost Equalizer */
|
|
102
|
+
BassboostLow: [
|
|
103
|
+
{ band: 0, gain: 0.6 * 0.125 },
|
|
104
|
+
{ band: 1, gain: 0.67 * 0.125 },
|
|
105
|
+
{ band: 2, gain: 0.67 * 0.125 },
|
|
106
|
+
{ band: 3, gain: 0.4 * 0.125 },
|
|
107
|
+
{ band: 4, gain: -0.5 * 0.125 },
|
|
108
|
+
{ band: 5, gain: 0.15 * 0.125 },
|
|
109
|
+
{ band: 6, gain: -0.45 * 0.125 },
|
|
110
|
+
{ band: 7, gain: 0.23 * 0.125 },
|
|
111
|
+
{ band: 8, gain: 0.35 * 0.125 },
|
|
112
|
+
{ band: 9, gain: 0.45 * 0.125 },
|
|
113
|
+
{ band: 10, gain: 0.55 * 0.125 },
|
|
114
|
+
{ band: 11, gain: -0.6 * 0.125 },
|
|
115
|
+
{ band: 12, gain: 0.55 * 0.125 },
|
|
116
|
+
{ band: 13, gain: -0.5 * 0.125 },
|
|
117
|
+
{ band: 14, gain: -0.75 * 0.125 },
|
|
118
|
+
],
|
|
119
|
+
/** Makes the Music slightly "better" */
|
|
120
|
+
BetterMusic: [
|
|
121
|
+
{ band: 0, gain: 0.25 },
|
|
122
|
+
{ band: 1, gain: 0.025 },
|
|
123
|
+
{ band: 2, gain: 0.0125 },
|
|
124
|
+
{ band: 3, gain: 0 },
|
|
125
|
+
{ band: 4, gain: 0 },
|
|
126
|
+
{ band: 5, gain: -0.0125 },
|
|
127
|
+
{ band: 6, gain: -0.025 },
|
|
128
|
+
{ band: 7, gain: -0.0175 },
|
|
129
|
+
{ band: 8, gain: 0 },
|
|
130
|
+
{ band: 9, gain: 0 },
|
|
131
|
+
{ band: 10, gain: 0.0125 },
|
|
132
|
+
{ band: 11, gain: 0.025 },
|
|
133
|
+
{ band: 12, gain: 0.25 },
|
|
134
|
+
{ band: 13, gain: 0.125 },
|
|
135
|
+
{ band: 14, gain: 0.125 },
|
|
136
|
+
],
|
|
137
|
+
/** Makes the Music sound like rock music / sound rock music better */
|
|
138
|
+
Rock: [
|
|
139
|
+
{ band: 0, gain: 0.300 },
|
|
140
|
+
{ band: 1, gain: 0.250 },
|
|
141
|
+
{ band: 2, gain: 0.200 },
|
|
142
|
+
{ band: 3, gain: 0.100 },
|
|
143
|
+
{ band: 4, gain: 0.050 },
|
|
144
|
+
{ band: 5, gain: -0.050 },
|
|
145
|
+
{ band: 6, gain: -0.150 },
|
|
146
|
+
{ band: 7, gain: -0.200 },
|
|
147
|
+
{ band: 8, gain: -0.100 },
|
|
148
|
+
{ band: 9, gain: -0.050 },
|
|
149
|
+
{ band: 10, gain: 0.050 },
|
|
150
|
+
{ band: 11, gain: 0.100 },
|
|
151
|
+
{ band: 12, gain: 0.200 },
|
|
152
|
+
{ band: 13, gain: 0.250 },
|
|
153
|
+
{ band: 14, gain: 0.300 },
|
|
154
|
+
],
|
|
155
|
+
/** Makes the Music sound like Classic music / sound Classic music better */
|
|
156
|
+
Classic: [
|
|
157
|
+
{ band: 0, gain: 0.375 },
|
|
158
|
+
{ band: 1, gain: 0.350 },
|
|
159
|
+
{ band: 2, gain: 0.125 },
|
|
160
|
+
{ band: 3, gain: 0 },
|
|
161
|
+
{ band: 4, gain: 0 },
|
|
162
|
+
{ band: 5, gain: 0.125 },
|
|
163
|
+
{ band: 6, gain: 0.550 },
|
|
164
|
+
{ band: 7, gain: 0.050 },
|
|
165
|
+
{ band: 8, gain: 0.125 },
|
|
166
|
+
{ band: 9, gain: 0.250 },
|
|
167
|
+
{ band: 10, gain: 0.200 },
|
|
168
|
+
{ band: 11, gain: 0.250 },
|
|
169
|
+
{ band: 12, gain: 0.300 },
|
|
170
|
+
{ band: 13, gain: 0.250 },
|
|
171
|
+
{ band: 14, gain: 0.300 },
|
|
172
|
+
],
|
|
173
|
+
/** Makes the Music sound like Pop music / sound Pop music better */
|
|
174
|
+
Pop: [
|
|
175
|
+
{ band: 0, gain: 0.2635 },
|
|
176
|
+
{ band: 1, gain: 0.22141 },
|
|
177
|
+
{ band: 2, gain: -0.21141 },
|
|
178
|
+
{ band: 3, gain: -0.1851 },
|
|
179
|
+
{ band: 4, gain: -0.155 },
|
|
180
|
+
{ band: 5, gain: 0.21141 },
|
|
181
|
+
{ band: 6, gain: 0.22456 },
|
|
182
|
+
{ band: 7, gain: 0.237 },
|
|
183
|
+
{ band: 8, gain: 0.237 },
|
|
184
|
+
{ band: 9, gain: 0.237 },
|
|
185
|
+
{ band: 10, gain: -0.05 },
|
|
186
|
+
{ band: 11, gain: -0.116 },
|
|
187
|
+
{ band: 12, gain: 0.192 },
|
|
188
|
+
{ band: 13, gain: 0 },
|
|
189
|
+
],
|
|
190
|
+
/** Makes the Music sound like Electronic music / sound Electronic music better */
|
|
191
|
+
Electronic: [
|
|
192
|
+
{ band: 0, gain: 0.375 },
|
|
193
|
+
{ band: 1, gain: 0.350 },
|
|
194
|
+
{ band: 2, gain: 0.125 },
|
|
195
|
+
{ band: 3, gain: 0 },
|
|
196
|
+
{ band: 4, gain: 0 },
|
|
197
|
+
{ band: 5, gain: -0.125 },
|
|
198
|
+
{ band: 6, gain: -0.125 },
|
|
199
|
+
{ band: 7, gain: 0 },
|
|
200
|
+
{ band: 8, gain: 0.25 },
|
|
201
|
+
{ band: 9, gain: 0.125 },
|
|
202
|
+
{ band: 10, gain: 0.15 },
|
|
203
|
+
{ band: 11, gain: 0.2 },
|
|
204
|
+
{ band: 12, gain: 0.250 },
|
|
205
|
+
{ band: 13, gain: 0.350 },
|
|
206
|
+
{ band: 14, gain: 0.400 },
|
|
207
|
+
],
|
|
208
|
+
/** Boosts all Bands slightly for louder and fuller sound */
|
|
209
|
+
FullSound: [
|
|
210
|
+
{ band: 0, gain: 0.25 + 0.375 },
|
|
211
|
+
{ band: 1, gain: 0.25 + 0.025 },
|
|
212
|
+
{ band: 2, gain: 0.25 + 0.0125 },
|
|
213
|
+
{ band: 3, gain: 0.25 + 0 },
|
|
214
|
+
{ band: 4, gain: 0.25 + 0 },
|
|
215
|
+
{ band: 5, gain: 0.25 + -0.0125 },
|
|
216
|
+
{ band: 6, gain: 0.25 + -0.025 },
|
|
217
|
+
{ band: 7, gain: 0.25 + -0.0175 },
|
|
218
|
+
{ band: 8, gain: 0.25 + 0 },
|
|
219
|
+
{ band: 9, gain: 0.25 + 0 },
|
|
220
|
+
{ band: 10, gain: 0.25 + 0.0125 },
|
|
221
|
+
{ band: 11, gain: 0.25 + 0.025 },
|
|
222
|
+
{ band: 12, gain: 0.25 + 0.375 },
|
|
223
|
+
{ band: 13, gain: 0.25 + 0.125 },
|
|
224
|
+
{ band: 14, gain: 0.25 + 0.125 },
|
|
225
|
+
],
|
|
226
|
+
/** Boosts basses + lower highs for a pro gaming sound */
|
|
227
|
+
Gaming: [
|
|
228
|
+
{ band: 0, gain: 0.350 },
|
|
229
|
+
{ band: 1, gain: 0.300 },
|
|
230
|
+
{ band: 2, gain: 0.250 },
|
|
231
|
+
{ band: 3, gain: 0.200 },
|
|
232
|
+
{ band: 4, gain: 0.150 },
|
|
233
|
+
{ band: 5, gain: 0.100 },
|
|
234
|
+
{ band: 6, gain: 0.050 },
|
|
235
|
+
{ band: 7, gain: -0.0 },
|
|
236
|
+
{ band: 8, gain: -0.050 },
|
|
237
|
+
{ band: 9, gain: -0.100 },
|
|
238
|
+
{ band: 10, gain: -0.150 },
|
|
239
|
+
{ band: 11, gain: -0.200 },
|
|
240
|
+
{ band: 12, gain: -0.250 },
|
|
241
|
+
{ band: 13, gain: -0.300 },
|
|
242
|
+
{ band: 14, gain: -0.350 },
|
|
243
|
+
],
|
|
244
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Player } from "../Player";
|
|
2
|
-
import { UnresolvedSearchResult } from "../Utils";
|
|
1
|
+
import type { Player } from "../Player";
|
|
2
|
+
import type { UnresolvedSearchResult } from "../Types/Utils";
|
|
3
3
|
export declare const bandCampSearch: (player: Player, query: string, requestUser: unknown) => Promise<UnresolvedSearchResult>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Player } from "./Player";
|
|
2
|
-
import {
|
|
1
|
+
import type { Player } from "./Player";
|
|
2
|
+
import type { AudioOutputs, EQBand, FilterData, PlayerFilters, TimescaleFilter } from "./Types/Filters";
|
|
3
3
|
/**
|
|
4
4
|
* The FilterManager for each player
|
|
5
5
|
*/
|
|
@@ -143,218 +143,3 @@ export declare class FilterManager {
|
|
|
143
143
|
/** Clears the equalizer bands. */
|
|
144
144
|
clearEQ(): Promise<this>;
|
|
145
145
|
}
|
|
146
|
-
/** The Audio Outputs type */
|
|
147
|
-
export type AudioOutputs = "mono" | "stereo" | "left" | "right";
|
|
148
|
-
/** The audio Outputs Data map declaration */
|
|
149
|
-
export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
|
|
150
|
-
/** The "active" / "disabled" Player Filters */
|
|
151
|
-
export interface PlayerFilters {
|
|
152
|
-
/** Sets nightcore to false, and vaporwave to false */
|
|
153
|
-
custom: boolean;
|
|
154
|
-
/** Sets custom to false, and vaporwave to false */
|
|
155
|
-
nightcore: boolean;
|
|
156
|
-
/** Sets custom to false, and nightcore to false */
|
|
157
|
-
vaporwave: boolean;
|
|
158
|
-
/** If rotation filter is enabled / not */
|
|
159
|
-
rotation: boolean;
|
|
160
|
-
/** if karaoke filter is enabled / not */
|
|
161
|
-
karaoke: boolean;
|
|
162
|
-
/** if tremolo filter is enabled / not */
|
|
163
|
-
tremolo: boolean;
|
|
164
|
-
/** if vibrato filter is enabled / not */
|
|
165
|
-
vibrato: boolean;
|
|
166
|
-
lowPass: boolean;
|
|
167
|
-
/** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
|
|
168
|
-
audioOutput: AudioOutputs;
|
|
169
|
-
/** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
|
|
170
|
-
volume: boolean;
|
|
171
|
-
/** Filters for the Lavalink Filter Plugin */
|
|
172
|
-
lavalinkFilterPlugin: {
|
|
173
|
-
/** if echo filter is enabled / not */
|
|
174
|
-
echo: boolean;
|
|
175
|
-
/** if reverb filter is enabled / not */
|
|
176
|
-
reverb: boolean;
|
|
177
|
-
};
|
|
178
|
-
lavalinkLavaDspxPlugin: {
|
|
179
|
-
/** if lowPass filter is enabled / not */
|
|
180
|
-
lowPass: boolean;
|
|
181
|
-
/** if highPass filter is enabled / not */
|
|
182
|
-
highPass: boolean;
|
|
183
|
-
/** if normalization filter is enabled / not */
|
|
184
|
-
normalization: boolean;
|
|
185
|
-
/** if echo filter is enabled / not */
|
|
186
|
-
echo: boolean;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* There are 15 bands (0-14) that can be changed.
|
|
191
|
-
* "gain" is the multiplier for the given band.
|
|
192
|
-
* The default value is 0.
|
|
193
|
-
* Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled.
|
|
194
|
-
* Modifying the gain could also change the volume of the output.
|
|
195
|
-
*/
|
|
196
|
-
export interface EQBand {
|
|
197
|
-
/** On what band position (0-14) it should work */
|
|
198
|
-
band: IntegerNumber | number;
|
|
199
|
-
/** The gain (-0.25 to 1.0) */
|
|
200
|
-
gain: FloatNumber | number;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Uses equalization to eliminate part of a band, usually targeting vocals.
|
|
204
|
-
*/
|
|
205
|
-
export interface KaraokeFilter {
|
|
206
|
-
/** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
207
|
-
level?: number;
|
|
208
|
-
/** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
209
|
-
monoLevel?: number;
|
|
210
|
-
/** The filter band (in Hz) */
|
|
211
|
-
filterBand?: number;
|
|
212
|
-
/** The filter width */
|
|
213
|
-
filterWidth?: number;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Changes the speed, pitch, and rate
|
|
217
|
-
*/
|
|
218
|
-
export interface TimescaleFilter {
|
|
219
|
-
/** The playback speed 0.0 ≤ x */
|
|
220
|
-
speed?: number;
|
|
221
|
-
/** The pitch 0.0 ≤ x */
|
|
222
|
-
pitch?: number;
|
|
223
|
-
/** The rate 0.0 ≤ x */
|
|
224
|
-
rate?: number;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Uses amplification to create a shuddering effect, where the volume quickly oscillates.
|
|
228
|
-
* Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
|
|
229
|
-
*/
|
|
230
|
-
export interface TremoloFilter {
|
|
231
|
-
/** The frequency 0.0 < x */
|
|
232
|
-
frequency?: number;
|
|
233
|
-
/** The tremolo depth 0.0 < x ≤ 1.0 */
|
|
234
|
-
depth?: number;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
|
|
238
|
-
*/
|
|
239
|
-
export interface VibratoFilter {
|
|
240
|
-
/** The frequency 0.0 < x ≤ 14.0 */
|
|
241
|
-
frequency?: number;
|
|
242
|
-
/** The vibrato depth 0.0 < x ≤ 1.0 */
|
|
243
|
-
depth?: number;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
|
|
247
|
-
* It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
|
|
248
|
-
*/
|
|
249
|
-
export interface RotationFilter {
|
|
250
|
-
/** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
|
|
251
|
-
rotationHz?: number;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Distortion effect. It can generate some pretty unique audio effects.
|
|
255
|
-
*/
|
|
256
|
-
export interface DistortionFilter {
|
|
257
|
-
sinOffset?: number;
|
|
258
|
-
sinScale?: number;
|
|
259
|
-
cosOffset?: number;
|
|
260
|
-
cosScale?: number;
|
|
261
|
-
tanOffset?: number;
|
|
262
|
-
tanScale?: number;
|
|
263
|
-
offset?: number;
|
|
264
|
-
scale?: number;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
|
|
268
|
-
* With the defaults, both channels are kept independent of each other.
|
|
269
|
-
* Setting all factors to 0.5 means both channels get the same audio.
|
|
270
|
-
*/
|
|
271
|
-
export interface ChannelMixFilter {
|
|
272
|
-
/** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
273
|
-
leftToLeft?: number;
|
|
274
|
-
/** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
275
|
-
leftToRight?: number;
|
|
276
|
-
/** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
277
|
-
rightToLeft?: number;
|
|
278
|
-
/** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
279
|
-
rightToRight?: number;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
|
|
283
|
-
* Any smoothing values equal to or less than 1.0 will disable the filter.
|
|
284
|
-
*/
|
|
285
|
-
export interface LowPassFilter {
|
|
286
|
-
/** The smoothing factor (1.0 < x) */
|
|
287
|
-
smoothing?: number;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Filter Data stored in the Client and partially sent to Lavalink
|
|
291
|
-
*/
|
|
292
|
-
export interface FilterData {
|
|
293
|
-
volume?: number;
|
|
294
|
-
karaoke?: KaraokeFilter;
|
|
295
|
-
timescale?: TimescaleFilter;
|
|
296
|
-
tremolo?: TremoloFilter;
|
|
297
|
-
vibrato?: VibratoFilter;
|
|
298
|
-
rotation?: RotationFilter;
|
|
299
|
-
distortion?: DistortionFilter;
|
|
300
|
-
channelMix?: ChannelMixFilter;
|
|
301
|
-
lowPass?: LowPassFilter;
|
|
302
|
-
pluginFilters?: {
|
|
303
|
-
"lavalink-filter-plugin"?: {
|
|
304
|
-
"echo"?: {
|
|
305
|
-
delay?: number;
|
|
306
|
-
decay?: number;
|
|
307
|
-
};
|
|
308
|
-
"reverb"?: {
|
|
309
|
-
delays?: number[];
|
|
310
|
-
gains?: number[];
|
|
311
|
-
};
|
|
312
|
-
};
|
|
313
|
-
"high-pass"?: {
|
|
314
|
-
cutoffFrequency?: number;
|
|
315
|
-
boostFactor?: number;
|
|
316
|
-
};
|
|
317
|
-
"low-pass"?: {
|
|
318
|
-
cutoffFrequency?: number;
|
|
319
|
-
boostFactor?: number;
|
|
320
|
-
};
|
|
321
|
-
normalization?: {
|
|
322
|
-
maxAmplitude?: number;
|
|
323
|
-
adaptive?: boolean;
|
|
324
|
-
};
|
|
325
|
-
echo?: {
|
|
326
|
-
echoLength?: number;
|
|
327
|
-
decay?: number;
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Actual Filter Data sent to Lavalink
|
|
333
|
-
*/
|
|
334
|
-
export interface LavalinkFilterData extends FilterData {
|
|
335
|
-
equalizer?: EQBand[];
|
|
336
|
-
}
|
|
337
|
-
export declare const EQList: {
|
|
338
|
-
/** A Bassboost Equalizer, so high it distorts the audio */
|
|
339
|
-
BassboostEarrape: EQBand[];
|
|
340
|
-
/** A High and decent Bassboost Equalizer */
|
|
341
|
-
BassboostHigh: EQBand[];
|
|
342
|
-
/** A decent Bassboost Equalizer */
|
|
343
|
-
BassboostMedium: EQBand[];
|
|
344
|
-
/** A slight Bassboost Equalizer */
|
|
345
|
-
BassboostLow: EQBand[];
|
|
346
|
-
/** Makes the Music slightly "better" */
|
|
347
|
-
BetterMusic: EQBand[];
|
|
348
|
-
/** Makes the Music sound like rock music / sound rock music better */
|
|
349
|
-
Rock: EQBand[];
|
|
350
|
-
/** Makes the Music sound like Classic music / sound Classic music better */
|
|
351
|
-
Classic: EQBand[];
|
|
352
|
-
/** Makes the Music sound like Pop music / sound Pop music better */
|
|
353
|
-
Pop: EQBand[];
|
|
354
|
-
/** Makes the Music sound like Electronic music / sound Electronic music better */
|
|
355
|
-
Electronic: EQBand[];
|
|
356
|
-
/** Boosts all Bands slightly for louder and fuller sound */
|
|
357
|
-
FullSound: EQBand[];
|
|
358
|
-
/** Boosts basses + lower highs for a pro gaming sound */
|
|
359
|
-
Gaming: EQBand[];
|
|
360
|
-
};
|