Filters¶
Filters is the top-level container for all audio filters. Retrieve from a player, modify, and apply.
filters = player.filters
filters.timescale.set(pitch=1.2, speed=1.2)
await player.set_filters(filters)
# Reset all filters
await player.set_filters()
Guide
See the Filters Guide for presets (nightcore, bass boost, 8D audio) and recipes.
Filters ¶
The revvlink Filters class.
This class contains the information associated with each of Lavalinks filter objects,
as Python classes.
Each filter can be set or reset individually.
Using set on an individual filter only updates any new values you pass.
Using reset on an individual filter, resets its payload, and can be
used before set when you want a clean state for that filter.
See: :meth:~revvlink.Filters.reset to reset every individual filter.
This class is already applied an instantiated on all new :class:~revvlink.Player.
See: :meth:~revvlink.Player.set_filters for information on applying this class to
your :class:~revvlink.Player.
See: :attr:~revvlink.Player.filters for retrieving the applied filters.
To retrieve the payload for this Filters class, you can call an instance of this class.
Examples:
import revvlink
# Create a brand new Filters and apply it...
# You can use player.set_filters() for an easier way to reset.
filters: revvlink.Filters = revvlink.Filters()
await player.set_filters(filters)
# Retrieve the payload of any Filters instance...
filters: revvlink.Filters = player.filters
print(filters())
# Set some filters...
# You can set and reset individual filters at the same time...
filters: revvlink.Filters = player.filters
filters.timescale.set(pitch=1.2, speed=1.1, rate=1)
filters.rotation.set(rotation_hz=0.2)
filters.equalizer.reset()
await player.set_filters(filters)
# Reset a filter...
filters: revvlink.Filters = player.filters
filters.timescale.reset()
await player.set_filters(filters)
# Reset all filters...
filters: revvlink.Filters = player.filters
filters.reset()
await player.set_filters(filters)
# Reset and apply filters easier method...
await player.set_filters()
volume
property
writable
¶
The volume multiplier for the player.
Adjusts the volume multiplier for the player from 0.0 to 5.0,
where 1.0 is 100%. Values > 1.0 may cause clipping.
Returns:
| Type | Description |
|---|---|
float | None
|
The current volume multiplier, or |
equalizer
property
¶
Property which returns the :class:~revvlink.Equalizer filter associated with
this Filters payload.
karaoke
property
¶
Property which returns the :class:~revvlink.Karaoke filter associated with
this Filters payload.
timescale
property
¶
The :class:~revvlink.Timescale filter associated with this payload.
Returns:
| Type | Description |
|---|---|
class:`~revvlink.Timescale`
|
The timescale filter. |
tremolo
property
¶
Property which returns the :class:~revvlink.Tremolo filter associated with
this Filters payload.
vibrato
property
¶
Property which returns the :class:~revvlink.Vibrato filter associated with
this Filters payload.
rotation
property
¶
Property which returns the :class:~revvlink.Rotation filter associated with
this Filters payload.
distortion
property
¶
Property which returns the :class:~revvlink.Distortion filter associated with
this Filters payload.
channel_mix
property
¶
Property which returns the :class:~revvlink.ChannelMix filter associated with
this Filters payload.
low_pass
property
¶
Property which returns the :class:~revvlink.LowPass filter associated with
this Filters payload.
plugin_filters
property
¶
The :class:~revvlink.PluginFilters associated with this payload.
Returns:
| Type | Description |
|---|---|
class:`~revvlink.PluginFilters`
|
The plugin filters. |
set_filters ¶
Set multiple filters at once to a standalone Filter object.
To set the filters to the player directly see :meth:revvlink.Player.set_filters
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
The Volume filter to apply to the player. |
required | |
equalizer
|
The Equalizer filter to apply to the player. |
required | |
karaoke
|
The Karaoke filter to apply to the player. |
required | |
timescale
|
The Timescale filter to apply to the player. |
required | |
tremolo
|
The Tremolo filter to apply to the player. |
required | |
vibrato
|
The Vibrato filter to apply to the player. |
required | |
rotation
|
The Rotation filter to apply to the player. |
required | |
distortion
|
The Distortion filter to apply to the player. |
required | |
channel_mix
|
The ChannelMix filter to apply to the player. |
required | |
low_pass
|
The LowPass filter to apply to the player. |
required | |
plugin_filters
|
The extra Plugin Filters to apply to the player. See
:class: |
required | |
reset
|
Whether to reset all filters that were not specified. |
required |
reset ¶
Method which resets this object to an original state.
This method will clear all individual filters, and assign the revvlink default classes.
from_filters
classmethod
¶
Creates a Filters object with specified filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
The Volume filter to apply to the player. |
required | |
equalizer
|
The Equalizer filter to apply to the player. |
required | |
karaoke
|
The Karaoke filter to apply to the player. |
required | |
timescale
|
The Timescale filter to apply to the player. |
required | |
tremolo
|
The Tremolo filter to apply to the player. |
required | |
vibrato
|
The Vibrato filter to apply to the player. |
required | |
rotation
|
The Rotation filter to apply to the player. |
required | |
distortion
|
The Distortion filter to apply to the player. |
required | |
channel_mix
|
The ChannelMix filter to apply to the player. |
required | |
low_pass
|
The LowPass filter to apply to the player. |
required | |
plugin_filters
|
The extra Plugin Filters to apply to the player. See
:class: |
required | |
reset
|
Whether to reset all filters that were not specified. |
required |
Equalizer ¶
Equalizer Filter Class.
There are 15 bands 0 to 14 that can be changed.
Each band has a gain which is the multiplier for the given band. gain defaults to 0.
Valid gain values range from -0.25 to 1.0, where -0.25 means
the given band is completely muted,
and 0.25 means it will be doubled.
Modifying the gain could also change the volume of the output.
Initialize an Equalizer filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
list[Equalizer] | None
|
An optional list of 15 bands to initialize the equalizer with.
Each dictionary should contain the keys |
None
|
payload
property
¶
The raw payload associated with this filter.
Returns:
| Type | Description |
|---|---|
dict[int, :class:`~revvlink.types.filters.Equalizer`]
|
A copy of the equalizer payload. |
set ¶
Set the bands of the Equalizer.
This method changes all bands, resetting any bands not provided to 0.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bands
|
A list of dictionary objects containing |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
reset ¶
Reset the Equalizer to its default state.
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
Timescale ¶
Bases: _BaseFilter[Timescale]
Timescale Filter class.
Changes the speed, pitch, and rate.
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the Timescale filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
speed
|
The playback speed. |
required | |
pitch
|
The pitch multiplier. |
required | |
rate
|
The rate multiplier. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
Karaoke ¶
Bases: _BaseFilter[Karaoke]
Karaoke Filter class.
Uses equalization to eliminate part of a band, usually targeting vocals.
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the Karaoke filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
The vocal elimination level, between |
required | |
mono_level
|
The mono level, between |
required | |
filter_band
|
The filter band in Hz. |
required | |
filter_width
|
The filter width. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
Tremolo ¶
Bases: _BaseFilter[Tremolo]
The Tremolo Filter class.
Uses amplification to create a shuddering effect, where the volume quickly oscillates. Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the Tremolo filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
The frequency of the oscillations. |
required | |
depth
|
The tremolo depth. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
Vibrato ¶
Bases: _BaseFilter[Vibrato]
The Vibrato Filter class.
Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the Vibrato filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
The frequency of the oscillations. |
required | |
depth
|
The vibrato depth. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
Rotation ¶
Bases: _BaseFilter[Rotation]
The Rotation Filter class.
Rotates the sound around the stereo channels/user headphones (aka Audio Panning). It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the Rotation filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotation_hz
|
The frequency of the audio rotating around the listener in Hz.
|
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
Distortion ¶
Bases: _BaseFilter[Distortion]
The Distortion Filter class.
According to Lavalink "It can generate some pretty unique audio effects."
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the Distortion filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sin_offset
|
The sin offset. |
required | |
sin_scale
|
The sin scale. |
required | |
cos_offset
|
The cos offset. |
required | |
cos_scale
|
The cos scale. |
required | |
tan_offset
|
The tan offset. |
required | |
tan_scale
|
The tan scale. |
required | |
offset
|
The offset. |
required | |
scale
|
The scale. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
ChannelMix ¶
Bases: _BaseFilter[ChannelMix]
The ChannelMix Filter class.
Mixes both channels (left and right), with a configurable factor on how much each channel affects the other. With the defaults, both channels are kept independent of each other.
Setting all factors to 0.5 means both channels get the same audio.
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the ChannelMix filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
left_to_left
|
The left to left channel mix factor. Between |
required | |
left_to_right
|
The left to right channel mix factor. Between |
required | |
right_to_left
|
The right to left channel mix factor. Between |
required | |
right_to_right
|
The right to right channel mix factor. Between |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
LowPass ¶
Bases: _BaseFilter[LowPass]
The LowPass Filter class.
Higher frequencies get suppressed, while lower frequencies pass through this filter,
thus the name low pass.
Any smoothing values equal to or less than 1.0 will disable the filter.
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of the LowPass filter.
This method accepts keyword argument pairs. This method does not override existing settings if they are not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smoothing
|
The smoothing factor. Higher values mean more smoothing.
Values |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The current instance for chaining. |
PluginFilters ¶
Bases: _BaseFilter[dict[str, Any]]
The PluginFilters class.
This class handles setting filters on plugins that support setting filter values. See the documentation of the Lavalink Plugin for more information on the values that can be set.
This class takes in a dict[str, Any] usually in the form of:
{"pluginName": {"filterKey": "filterValue"}, ...}
Do NOT include the "pluginFilters" top level key when setting your values for this class.
payload
property
¶
The raw payload associated with this filter.
This property returns a copy.
set ¶
Set the properties of this filter.
This method accepts keyword argument pairs OR you can alternatively unpack a dictionary. See the documentation of the Lavalink Plugin for more information on the values that can be set.
Examples:
plugin_filters: PluginFilters = PluginFilters()
plugin_filters.set(pluginName={"filterKey": "filterValue", ...})
# OR...
plugin_filters.set(**{"pluginName": {"filterKey": "filterValue", ...}})