almost finished with new docs
This commit is contained in:
parent
7fbf201d30
commit
38afb3a501
|
|
@ -1 +1,186 @@
|
||||||
# Use the Filter class
|
# Use the Filter class
|
||||||
|
|
||||||
|
Pomice takes full advantage of the Lavalink filter system by using a unique system to apply filters on top of one another. We call this system "filter stacking". With this system, we can stack any filter on top of one another to produce one-of-a-kind audio effects on playback while still being able to easily manage each filters.
|
||||||
|
|
||||||
|
|
||||||
|
## Types of filters
|
||||||
|
|
||||||
|
Lavalink, and by extension, Pomice, has different types of filters you can use.
|
||||||
|
|
||||||
|
Here are the different types and what they do:
|
||||||
|
|
||||||
|
:::{list-table}
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Type
|
||||||
|
- Class
|
||||||
|
- Description
|
||||||
|
|
||||||
|
|
||||||
|
* - Channel Mix
|
||||||
|
- `pomice.ChannelMix()`
|
||||||
|
- Adjusts stereo panning of a track.
|
||||||
|
|
||||||
|
* - Distortion
|
||||||
|
- `pomice.Distortion()`
|
||||||
|
- Generates a distortion effect on a track.
|
||||||
|
|
||||||
|
* - Equalizer
|
||||||
|
- `pomice.Equalizer()`
|
||||||
|
- Represents a 15 band equalizer. You can adjust the dynamic of the sound using this filter.
|
||||||
|
|
||||||
|
* - Karaoke
|
||||||
|
- `pomice.Karaoke()`
|
||||||
|
- Filters the vocals from the track.
|
||||||
|
|
||||||
|
* - Low Pass
|
||||||
|
- `pomice.LowPass()`
|
||||||
|
- Filters out high frequencies and only lets low frequencies pass through.
|
||||||
|
|
||||||
|
* - Rotation
|
||||||
|
- `pomice.Rotation()`
|
||||||
|
- Produces a stereo-like panning effect, which sounds like the audio is being rotated around the listener’s head
|
||||||
|
|
||||||
|
* - Timescale
|
||||||
|
- `pomice.Timescale()`
|
||||||
|
- Adjusts the speed and pitch of a track.
|
||||||
|
|
||||||
|
* - Tremolo
|
||||||
|
- `pomice.Tremolo()`
|
||||||
|
- Rapidly changes the volume of the track, producing a wavering tone.
|
||||||
|
|
||||||
|
* - Vibrato
|
||||||
|
- `pomice.Vibrato()`
|
||||||
|
- Rapidly changes the pitch of the track.
|
||||||
|
|
||||||
|
|
||||||
|
Each filter has individual values you can adjust to fine-tune the sound of the filter. If you want to see what values each filter has, refer to [](../api/filters.md).
|
||||||
|
|
||||||
|
If you are stuck on what values adjust what, some filters include presets that you can apply to get a certain sound, i.e: `pomice.Timescale` has the `vaporwave()` and `nightcore()` and so on. You can also play around with the values and generate your own unique sound if you'd like.
|
||||||
|
|
||||||
|
## Adding a filter
|
||||||
|
|
||||||
|
:::{important}
|
||||||
|
|
||||||
|
You must have the `Player` class initialized first before using this. Refer to [](player.md)
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
To add a filter, we need to use `Player.add_filter()`
|
||||||
|
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
await Player.add_filter(...)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
After you have initialized your function, we need to fill in the proper parameters:
|
||||||
|
|
||||||
|
:::{list-table}
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
|
||||||
|
* - `filter`
|
||||||
|
- `Filter`
|
||||||
|
- The filter to apply
|
||||||
|
|
||||||
|
* - `fast_apply`
|
||||||
|
- `bool`
|
||||||
|
- If set to `True`, the specified filter will apply (almost) instantly if a song is playing. Default value is `False`.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
After you set those parameters, your function should look something like this:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
await Player.add_filter(
|
||||||
|
filter=<your filter object here>,
|
||||||
|
fast_apply=<True/False>
|
||||||
|
)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After running this function, you should see your currently playing track sound different depending on the filter you chose.
|
||||||
|
|
||||||
|
## Removing a filter
|
||||||
|
|
||||||
|
:::{important}
|
||||||
|
|
||||||
|
You must have the `Player` class initialized first before using this. Refer to [](player.md)
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
|
||||||
|
To remove a filter, we need to use `Player.remove_filter()`
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
await Player.remove_filter(...)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
After you have initialized your function, we need to fill in the proper parameters:
|
||||||
|
|
||||||
|
:::{list-table}
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
|
||||||
|
* - `filter`
|
||||||
|
- `Filter`
|
||||||
|
- The filter to remove
|
||||||
|
|
||||||
|
* - `fast_apply`
|
||||||
|
- `bool`
|
||||||
|
- If set to `True`, the specified filter will be removed (almost) instantly if a song is playing. Default value is `False`.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
After you set those parameters, your function should look something like this:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
await Player.remove_filter(
|
||||||
|
filter=<your filter object here>,
|
||||||
|
fast_apply=<True/False>
|
||||||
|
)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After running this function, you should see your currently playing track sound different depending on the filter you chose to remove.
|
||||||
|
|
||||||
|
|
||||||
|
## Resetting all filters
|
||||||
|
|
||||||
|
:::{important}
|
||||||
|
|
||||||
|
You must have the `Player` class initialized first before using this. Refer to [](player.md)
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
To reset all filters, we need to use `Player.reset_filters()`
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
await Player.reset_filters()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
After you have initialized your function, you can optionally include the `fast_apply` parameter, which is a boolean. If this is set to `True`, it'll remove all filters (almost) instantly if theres a track playing.
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
await Player.reset_filters(fast_apply=<True/False>)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,113 @@
|
||||||
# Use the Queue class
|
# Use the Queue class
|
||||||
|
|
||||||
|
Pomice has an optional queue system that works seamlessly with the library. This queue system introduce quality-of-life features that every music application should ideally have like queue shuffling, queue jumping, and looping.
|
||||||
|
|
||||||
|
|
||||||
|
To use the queue system with Pomice, you must first subclass the `Player` class within your application like so:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
from pomice import Player
|
||||||
|
|
||||||
|
class CustomPlayer(Player):
|
||||||
|
...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After you have initialized your subclass, you can add a `queue` variable to your class so you can access your queue when you initialize your player:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
from pomice import Player, Queue
|
||||||
|
|
||||||
|
class CustomPlayer(Player):
|
||||||
|
...
|
||||||
|
self.queue = Queue()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a song to the queue
|
||||||
|
|
||||||
|
To add a song to the queue, we must use `Queue.put()`
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
Queue.put()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After you have initialized your function, we need to include the `item` parameter, which is a `Track`:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
Queue.put(item=<your Track here>)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After running the function, your track should be in the queue.
|
||||||
|
|
||||||
|
## Getting a track from the queue
|
||||||
|
|
||||||
|
To get a track from the queue, we need to do a few things.
|
||||||
|
|
||||||
|
To get a track using its position within the queue, you first need to get the position as a number, also known as its index. If you dont have the index and instead want to search for its index using keywords, you have to implement a fuzzy searching algorithm to find said track using a search query as an input and have it compare that query against the titles of the tracks in the queue. After that, you can get the `Track` object by [getting it with its index](queue.md#getting-track-with-its-index)
|
||||||
|
|
||||||
|
### Getting index of track
|
||||||
|
|
||||||
|
If you have the `Track` object and want to get its index within the queue, we can use `Queue.find_position()`
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
Queue.find_position()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After you have initialized your function, we need to include the `item` parameter, which is a `Track`:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
Queue.find_position(item=<your Track here>)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After running the function, it should return the position of the track as an integer.
|
||||||
|
|
||||||
|
|
||||||
|
### Getting track with its index
|
||||||
|
|
||||||
|
If you have the index of the track and want to get the `Track` object, you first need to get the raw queue list:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
queue = Queue.get_queue()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After you have your queue, you can use basic list splicing to get the track object:
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
track = queue[<index>]
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting the next track in the queue
|
||||||
|
|
||||||
|
To get the next track in the queue, we need to use `Queue.get()`
|
||||||
|
|
||||||
|
```py
|
||||||
|
|
||||||
|
Queue.get()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After running this function, it'll return the first track from the queue and remove it.
|
||||||
|
|
||||||
|
:::{note}
|
||||||
|
|
||||||
|
If you have a queue loop mode set, this behavior will be overridden since the queue is not allowed to remove tracks from the queue if its looping.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue