Models

Settings

class sonolink.models.AutoPlaySettings(*, mode: AutoPlayMode = AutoPlayMode.DISABLED, max_seeds: int = 100, provider: SearchProvider = SearchProvider.YOUTUBE, discovery_count: int = 10)[source]

Configuration for the player’s AutoPlay behavior.

mode

The default discovery mode when the player starts. Defaults to DISABLED.

Type:

AutoPlayMode

max_seeds

The maximum number of track identifiers to store to prevent duplicates. Defaults to 100.

Type:

int

provider

The provider used for discovery. Defaults to SearchProvider.YOUTUBE.

Type:

SearchProvider | str

discovery_count

The maximum number of discovered tracks to add to the queue at once. Defaults to 10.

Type:

int

classmethod default() Self

Returns a fresh instance of this settings class with defaults.

replace(**kwargs: Any) Self

Returns a new instance of the settings with updated values.

This uses a shallow copy to ensure the original configuration instance remains immutable.

discovery_count
max_seeds: int
mode: AutoPlayMode
provider: SearchProvider
class sonolink.models.InactivitySettings(*, timeout: int | None = 300, mode: InactivityMode = InactivityMode.ALL_BOTS, user_ids: Iterable[Snowflake | int] | None = None)[source]

Configuration for player inactivity and auto-disconnection.

timeout

The time in seconds to wait before disconnecting. Defaults to 300.

Type:

int | None

mode

The strategy used to determine if the channel is “inactive”.

Type:

InactivityMode

user_ids

An iterable of user IDs or Discord objects that act as “Keep Alive” members.

Type:

Iterable[Snowflake | int]

classmethod default() Self

Returns a fresh instance of this settings class with defaults.

replace(**kwargs: Any) Self

Returns a new instance of the settings with updated values.

This uses a shallow copy to ensure the original configuration instance remains immutable.

mode: InactivityMode
timeout: int | None
user_ids: Iterable[Snowflake | int]
class sonolink.models.HistorySettings(*, enabled: bool = True, max_items: int | None = None)[source]

Configuration for player history tracking.

enabled

Whether history tracking is enabled. Defaults to True.

Type:

bool

max_items

The maximum number of items to keep in history.

Type:

int | None

classmethod default() Self

Returns a fresh instance of this settings class with defaults.

replace(**kwargs: Any) Self

Returns a new instance of the settings with updated values.

This uses a shallow copy to ensure the original configuration instance remains immutable.

enabled: bool
max_items: int | None
class sonolink.models.CacheSettings(*, enabled: bool = True, max_items: int = 1000)[source]
Attributes

Configuration for node caching.

enabled

Whether caching is enabled. Defaults to True.

Type:

bool

max_items

The maximum number of items to store in the LFU cache. Defaults to 1000.

Type:

int | None

classmethod default() Self

Returns a fresh instance of this settings class with defaults.

replace(**kwargs: Any) Self

Returns a new instance of the settings with updated values.

This uses a shallow copy to ensure the original configuration instance remains immutable.

enabled: bool
max_items: int

Tracks and playlists

class sonolink.models.Album[source]
Attributes

Represents album metadata usually provided by external plugins like LavaSrc.

property name: str | None

The name of the album.

property url: str | None

The URL to the album.

class sonolink.models.Artist[source]
Attributes

Represents artist metadata usually provided by external plugins like LavaSrc.

property name: str | None

The name of the artist.

property url: str | None

The URL to the artist profile.

class sonolink.models.Playable[source]

Represents a playable track within sonolink.

This class wraps the raw sonolink.rest.schemas.Track schema and provides a high-level interface for accessing track metadata and state.

property album: Album

The Album metadata for this track. Only populated by certain plugins.

property artist: Artist

The Artist metadata for this track. Only populated by certain plugins.

property artwork: str | None

A URL to the track’s artwork/thumbnail, if available.

property author: str

The author or artist of the track.

property autoplay: bool

Whether this track was added by AutoPlay rather than a user.

Added in version 1.1.0.

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property encoded: str

The base64 encoded string used by Lavalink to identify this track.

property extras: SimpleNamespace

Additional custom data attached to this track.

property identifier: str

The unique identifier for this track based on its source (e.g., YouTube Video ID).

property is_seekable: bool

Whether the track supports seeking.

property is_stream: bool

Whether the track is a live stream.

property isrc: str | None

The International Standard Recording Code for the track, if available.

property length: int

The total duration of the track in milliseconds.

property playlist: Playlist | None

The Playlist this track belongs to, if any.

property position: int

The starting position of the track in milliseconds.

property source_name: str

The name of the source manager that provided this track (e.g., ‘youtube’, ‘spotify’).

property title: str

The title of the track.

property uri: str | None

The direct URL to the track, if available.

class sonolink.models.Playlist[source]

Represents a Lavalink Playlist.

This class wraps the sonolink.rest.schemas.PlaylistData schema and implements the Sequence protocol to allow iteration over tracks.

property artwork: str | None

The artwork URL for the playlist, if available.

property author: str | None

The author of the playlist, if available.

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property extras: dict[str, Any]

Additional playlist data provided via pluginInfo or custom state.

property name: str

The name of the playlist.

property playlist_type: str | None

The type of playlist (e.g., ‘album’, ‘playlist’). Provided by plugins.

property selected: int

The index of the selected track from Lavalink. Returns -1 if none.

property tracks: list[Playable]

A list of sonolink.models.Playable objects in this playlist.

property url: str | None

The URL of the playlist, if available.

Search and node models

class sonolink.models.SearchResult[source]
Methods

The result of a track search.

is_empty() bool[source]

Whether this search result is empty. An empty search result has no SearchResult.result.

is_error() bool[source]

Whether this search result is an error.

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

exception

The raw exception data of this search result.

This will be None if SearchResult.is_error() is False.

result

The data of the search result. Depending on SearchResult.type, this property will return a different value.

If type is sonolink.TrackLoadResult.TRACK, this will return a sonolink.models.Playable. If type is sonolink.TrackLoadResult.PLAYLIST, this will return a sonolink.models.Playlist. If type is sonolink.TrackLoadResult.SEARCH, this will return a list of sonolink.models.Playables.

property type: TrackLoadResult

The result type.

class sonolink.models.PlayerInfo[source]

Represents a player’s info data.

This class wraps the raw sonolink.rest.schemas.Player schema and provides a high-level interface for accessing player metadata and state.

property channel_id: int | None

The Discord voice channel ID the player is connected to.

Returns None if the player is not connected to a channel.

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property connected: bool

Whether the player is connected to a voice channel.

property data: D

The raw msgspec schema object holding the data for this model.

property filters: PlayerFilters

The audio filters currently applied to the player.

property guild_id: int

The Discord guild ID the player belongs to.

property paused: bool

Whether the player is currently paused.

property ping: int

The connection ping in milliseconds.

Returns -1 if the player is not connected.

property position: int

Current track position in milliseconds.

property state: PlayerState

The current state of the player (PlayerState).

track

Current playing track, or None if no track is playing.

property voice: PlayerVoiceState

The voice connection state of the player (PlayerVoiceState).

property volume: int

The player volume in a 0-1000 percent scale.

class sonolink.models.ServerInfo[source]

Represents a Lavalink server’s metadata & stats information.

This class wraps the raw sonolink.rest.schemas.InfoResponse schema and provides a high-level interface for accessing Lavalink servers stats and metadata.

build_time

A datetime.datetime object representing the timestamp on which the Lavalink jar was built.

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property filters: list[str]

The enabled filters of the Lavalink server.

git

A GitInfo object denoting the git version of the Lavalink server.

property jvm: str

The JVM version used to run the Lavalink server.

property lavaplayer: str

The Lavaplayer version being used by the Lavalink server.

property plugins: list[PluginObject]

A list of structs denoting the available plugins of the Lavalink server.

property source_managers: list[str]

The enabled source managers of the Lavalink server.

version

A Version object denoting the version of this node.

Filter wrapper models

class sonolink.models.Equalizer(*, band: int, gain: float)[source]
Attributes
Methods

Represents a single Lavalink equalizer band.

Parameters:
  • band (int) – The target band index (0 to 14).

  • gain (float) – The band gain multiplier (-0.25 to 1.0).

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property band: int

The target band index (0 to 14).

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property gain: float

The band gain multiplier (-0.25 to 1.0).

class sonolink.models.Karaoke(*, level: float | None = None, mono_level: float | None = None, filter_band: float | None = None, filter_width: float | None = None)[source]

Filter that reduces vocal levels in a track, useful for karaoke.

Parameters:
  • level (float | None) – Overall effect intensity (0.0 to 1.0).

  • mono_level (float | None) – Mono signal amount (0.0 to 1.0).

  • filter_band (float | None) – Center frequency in Hz for the target region.

  • filter_width (float | None) – Bandwidth around the filter band in Hz.

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property filter_band: float | None

Center frequency in Hz for the target region.

property filter_width: float | None

Bandwidth around the filter band in Hz.

property level: float | None

Overall effect intensity (0.0 to 1.0).

property mono_level: float | None

Mono signal amount (0.0 to 1.0).

class sonolink.models.Timescale(*, speed: float | None = None, pitch: float | None = None, rate: float | None = None)[source]
Attributes
Methods

Adjusts the speed, pitch, and rate of audio playback.

Parameters:
  • speed (float | None) – Playback speed multiplier (0.0 <= x).

  • pitch (float | None) – Pitch multiplier (0.0 <= x).

  • rate (float | None) – Internal rate multiplier (0.0 <= x).

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property pitch: float | None

Pitch multiplier (>= 0.0).

property rate: float | None

Internal rate multiplier (>= 0.0).

property speed: float | None

Playback speed multiplier (>= 0.0).

class sonolink.models.Tremolo(*, frequency: float | None = None, depth: float | None = None)[source]
Attributes
Methods

Rapidly oscillates the volume of the audio.

Parameters:
  • frequency (float | None) – Oscillation frequency in Hz (0.0 < x).

  • depth (float | None) – Effect depth (0.0 < x <= 1.0).

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property depth: float | None

Effect depth (0.0 < x <= 1.0).

property frequency: float | None

Oscillation frequency in Hz (> 0.0).

class sonolink.models.Vibrato(*, frequency: float | None = None, depth: float | None = None)[source]
Attributes
Methods

Rapidly oscillates the pitch of the audio.

Parameters:
  • frequency (float | None) – Oscillation frequency in Hz (0.0 < x <= 14.0).

  • depth (float | None) – Effect depth (0.0 < x <= 1.0).

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property depth: float | None

Effect depth (0.0 < x <= 1.0).

property frequency: float | None

Oscillation frequency in Hz (0.0 < x <= 14.0).

class sonolink.models.Rotation(*, rotation_hz: float | None = None)[source]
Attributes
Methods

Rotates the audio across the stereo channels (panning effect).

Parameters:

rotation_hz (float | None) – Rotation frequency in Hz.

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property rotation_hz: float | None

Rotation frequency in Hz.

class sonolink.models.Distortion(*, sin_offset: float | None = None, sin_scale: float | None = None, cos_offset: float | None = None, cos_scale: float | None = None, tan_offset: float | None = None, tan_scale: float | None = None, offset: float | None = None, scale: float | None = None)[source]

Applies distortion effects using sine, cosine, and tangent transforms.

Parameters:
  • sin_offset (float | None) – The sine input offset component.

  • sin_scale (float | None) – The sine scaling component.

  • cos_offset (float | None) – The cosine input offset component.

  • cos_scale (float | None) – The cosine scaling component.

  • tan_offset (float | None) – The tangent input offset component.

  • tan_scale (float | None) – The tangent scaling component.

  • offset (float | None) – The input offset component.

  • scale (float | None) – The scaling component.

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property cos_offset: float | None

The cosine input offset component.

property cos_scale: float | None

The cosine scaling component.

property data: D

The raw msgspec schema object holding the data for this model.

property offset: float | None

The input offset component.

property scale: float | None

The scaling component.

property sin_offset: float | None

The sine input offset component.

property sin_scale: float | None

The sine scaling component.

property tan_offset: float | None

The tangent input offset component.

property tan_scale: float | None

The tangent scaling component.

class sonolink.models.ChannelMix(*, left_to_left: float | None = None, left_to_right: float | None = None, right_to_left: float | None = None, right_to_right: float | None = None)[source]

Mixes left and right audio channels to manipulate stereo separation.

Parameters:
  • left_to_left (float | None) – The left to left channel mix factor (0.0 <= x <= 1.0).

  • left_to_right (float | None) – The left to right channel mix factor (0.0 <= x <= 1.0).

  • right_to_left (float | None) – The right to left channel mix factor (0.0 <= x <= 1.0).

  • right_to_right (float | None) – The right to right channel mix factor (0.0 <= x <= 1.0).

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property left_to_left: float | None

The contribution of the left input channel to the left output channel.

property left_to_right: float | None

The contribution of the left input channel to the right output channel.

property right_to_left: float | None

The contribution of the right input channel to the left output channel.

property right_to_right: float | None

The contribution of the right input channel to the right output channel.

class sonolink.models.LowPass(*, smoothing: float | None = None)[source]
Attributes
Methods

Suppresses higher frequencies in the audio signal.

Parameters:

smoothing (float | None) – The smoothing factor (x > 1.0).

combine(other: BaseFilter[D]) Self

Combines this filter with another, preferring the other’s values.

This method does not mutate the current instance and returns a new one. See also merge() for an in-place version that mutates the current instance.

Parameters:

other (BaseFilter) – The other filter to combine with this one. Must be of the same type.

Returns:

A new instance with merged values from both filters.

Return type:

BaseFilter

merge(other: BaseFilter[D]) Self

Merges another filter into this one, preferring the other’s values.

This method mutates the current instance and returns it for chaining.

See also combine() for a non-mutating version that returns a new instance.

Parameters:

other (BaseFilter) – The other filter to merge into this one. Must be of the same type.

Returns:

The current instance with merged values.

Return type:

BaseFilter

property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

property smoothing: float | None

Smoothing factor (x > 1.0).

class sonolink.models.Filters(*, equalizer: list[Equalizer] | None = None, karaoke: Karaoke | None = None, timescale: Timescale | None = None, tremolo: Tremolo | None = None, vibrato: Vibrato | None = None, rotation: Rotation | None = None, distortion: Distortion | None = None, channel_mix: ChannelMix | None = None, low_pass: LowPass | None = None, volume: float = 1.0, plugin_filters: dict[str, Any] | None = None)[source]

The main container for all active player filters.

This class provides a Pythonic interface to the underlying Lavalink filter state. Active filters are sent to Lavalink via the payload() property.

Parameters:
  • volume (float) – The linear volume multiplier. Defaults to 1.0.

  • equalizer (list[Equalizer] | None) – A list of active equalizer bands.

  • karaoke (Karaoke | None) – The active karaoke filter settings.

  • timescale (Timescale | None) – The active timescale (speed/pitch) filter settings.

  • tremolo (Tremolo | None) – The active tremolo (volume oscillation) filter settings.

  • vibrato (Vibrato | None) – The active vibrato (pitch oscillation) filter settings.

  • rotation (Rotation | None) – The active rotation (panning) filter settings.

  • distortion (Distortion | None) – The active distortion filter settings.

  • channel_mix (ChannelMix | None) – The active channel mix filter settings.

  • low_pass (LowPass | None) – The active low pass filter settings.

  • plugin_filters (dict | None) – A dictionary of raw plugin-defined filter payloads.

combine(other: Filters) Self[source]

Return a new filter set with other merged into a copy of this one.

This does not mutate either input. Use merge() when you want in-place mutation of the current instance.

Parameters:

other (Filters) – The other filter to combine with.

Returns:

This filter instance after combining.

Return type:

Filters

merge(other: Filters) Self[source]

Merge another filter set into this instance in place.

This mutates self. Use combine() when you need a new merged Filters instance without changing either input.

Parameters:

other (Filters) – The other filter to merge with.

Returns:

This filter instance after merging.

Return type:

Filters

channel_mix: ChannelMix | None
property client: Client[Any] | None

The sonolink.Client instance associated with this object.

property data: D

The raw msgspec schema object holding the data for this model.

distortion: Distortion | None
equalizer: list[Equalizer]
karaoke: Karaoke | None
low_pass: LowPass | None
property payload: PlayerFilters

Returns the underlying msgspec schema for API requests.

plugin_filters: dict[str, Any]
rotation: Rotation | None
timescale: Timescale | None
tremolo: Tremolo | None
vibrato: Vibrato | None
volume: float