lavalink_rs.model.player API documentation

# lavalink_rs.model.player

class Player:

Information about the player of a guild.

filters: Optional[lavalink_rs.model.player.Filters]

The filters currently in use by the player

guild_id: GuildId
volume: int

The current volume of the player.

state: lavalink_rs.model.player.State

The state of the player.

track: Optional[TrackData]

The currently playing track.

paused: bool

Whether the player is paused or not.

voice: lavalink_rs.model.player.ConnectionInfo

The voice connection information of the player.

class State:
time: int

Unix timestamp in milliseconds.

position: int

The current position of the track in milliseconds.

ping: Optional[int]

The latency of the node to the Discord voice gateway in milliseconds.

None if not connected.

connected: bool

Whether Lavalink is connected to the discord voice gateway.

class ConnectionInfo:

Discord voice websocket connection information.

def fix(self) -> None:
token: str

The Discord voice token to authenticate with.

Provided by `Voice Server Update`.

session_id: str

The Discord voice session id to authenticate with.

Not to be confused by the Lavalink `session_id`.

Provided by `Voice State Update`.

endpoint: str

The Discord voice endpoint to connect to.

Provided by `Voice Server Update`.

class Filters:
vibrato: Optional[lavalink_rs.model.player.TremoloVibrato]
volume: Optional[int]
distortion: Optional[lavalink_rs.model.player.Distortion]
channel_mix: Optional[lavalink_rs.model.player.ChannelMix]
plugin_filters: Union[Dict[str, Union[Dict[str, ForwardRef('JSON')], List[ForwardRef('JSON')], str, int, float, bool, NoneType]], List[Union[Dict[str, ForwardRef('JSON')], List[ForwardRef('JSON')], str, int, float, bool, NoneType]], str, int, float, bool, NoneType]
low_pass: Optional[lavalink_rs.model.player.LowPass]
tremolo: Optional[lavalink_rs.model.player.TremoloVibrato]
equalizer: Optional[List[lavalink_rs.model.player.Equalizer]]
rotation: Optional[lavalink_rs.model.player.Rotation]
karaoke: Optional[lavalink_rs.model.player.Karaoke]
timescale: Optional[lavalink_rs.model.player.Timescale]
class ChannelMix:

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. All values are (0.0 <= x <= 1.0)

right_to_left: Optional[float]
left_to_right: Optional[float]
left_to_left: Optional[float]
right_to_right: Optional[float]
class Distortion:

Distortion effect.

It can generate some pretty unique audio effects.

cos_scale: Optional[float]
tan_scale: Optional[float]
cos_offset: Optional[float]
tan_offset: Optional[float]
offset: Optional[float]
sin_scale: Optional[float]
scale: Optional[float]
sin_offset: Optional[float]
class Equalizer:

A fixed band equalizer.

gain: float

The gain (-0.25 to 1.0)

-0.25 means the given band is completely muted, and 0.25 means it is doubled. Modifying the gain could also change the volume of the output.

band: int

The band (0 to 14)

class Karaoke:

Uses equalization to eliminate part of a band, usually targeting vocals.

mono_level: Optional[float]

The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect)

filter_band: Optional[float]

The filter band (in Hz)

level: Optional[float]

The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect)

filter_width: Optional[float]

The filter width.

class LowPass:

Higher frequencies get suppressed, while lower frequencies pass through this filter.

smoothing: Optional[float]

The smoothing factor (1.0 < x)

Any smoothing values equal to or less than 1.0 will disable the filter.

class Rotation:

Rotates the sound around the stereo channels/user headphones (aka Audio Panning).

It can produce an effect similar to this without the reverb.

rotation_hz: Optional[float]

The frequency of the audio rotating around the listener in Hz.

0.2 is similar to the example video above

class Timescale:

Changes the speed, pitch, and rate.

All default to 1.0.

pitch: Optional[float]

The pitch (0.0 <= x)

speed: Optional[float]

The playback speed (0.0 <= x)

rate: Optional[float]

The rate (0.0 <= x)

class TremoloVibrato:

Tremolo uses amplification to create a shuddering effect, where the volume quickly oscillates.

Demo

Vibrato is similar to tremolo, but rather than oscillating the volume, it oscillates the pitch.

depth: Optional[float]

For both tremolo and vibrato (0.0 < x <= 1.0)

frequency: Optional[float]

For tremolo (0.0 < x) For vibrato (0.0 < x <= 14.0)