Skip to content

Filters#

Below will show you how to control the filter object, both making a new one, or modifying an existing one.

Setting a players filter can be found here.

Getting a filter.#

There is two methods to get a filter.

You can create a new one, or you can use a pre-existing one (from a player.)

Creating a new filter.

filters = ongaku.Filters()

Creating a filter from a pre-existing one.

filters = ongaku.Filters.from_filter(player.filters)

Tip

If you create a new one, then it will override pre-existing settings on the player. If you don't want it to do that, use the From Player method shown above!

Functions#

There is quite a few filters, and almost all have these two methods.

  • set_xxxx - This allows you to set new values to the filter.
  • clear_xxxx - This will completely clear the values from that filter.

Warning

clear != reset. Clearing sets the value to None which will override existing values.

Volume#

Setting the volume of the filter settings.

filters.set_volume(200)

Equalizer#

Add, remove and clear equalizer filter settings.

Learn More

Add a new equalizer band

filters.add_equalizer(BandType.HZ100, 0.3)

Remove a new equalizer band

filters.remove_equalizer(BandType.HZ100)

Remove all equalizer bands previously set.

filters.clear_equalizer()

Note

You can use any BandType you would like, BandType.HZ100 is just an example.

Karaoke#

Set or remove karaoke filter settings.

Lavalink Learn More

Set karaoke values.

filters.set_karaoke(
    level=1,
    mono_level=0,
    filter_band=0.5,
    filter_width=None
)

Clear karaoke values.

filters.clear_karaoke()

Timescale#

Set or remove timescale filter settings.

Lavalink Learn More

Set timescale values.

filters.set_timescale(
    speed=10,
    pitch=1.5,
    rate=None
)

Clear timescale values.

filters.clear_timescale()

Tremolo#

Set or remove tremolo filter settings.

Lavalink Learn More

Set tremolo values.

filters.set_tremolo(
    frequency=2,
    depth=1
)

Clear tremolo values.

filters.clear_tremolo()

Vibrato#

Set or remove vibrato filter settings.

Lavalink Learn More

Set vibrato values.

filters.set_vibrato(
    frequency=2,
    depth=1
)

Clear vibrato values.

filters.clear_vibrato()

Rotation#

Set or remove rotation filter settings.

Lavalink Learn More

Set rotation values.

filters.set_rotation(
    rotation_hz=8
)

Clear rotation values.

filters.clear_rotation()

Distortion#

Set or remove distortion filter settings.

Lavalink Learn More

Set distortion values.

filters.set_distortion(
    sin_offset=0.3,
    sin_scale=1,
    cos_offset=4,
    cos_scale=-3,
    tan_offset=4,
    tan_scale=9,
    offset=6.66,
    scale=-1.5,
)

Clear distortion values.

filters.clear_distortion()

Channel Mix#

Set or remove channel mix filter settings.

Lavalink Learn More

Set channel mix values.

filters.set_channel_mix(
    left_to_left=0.39,
    left_to_right=1,
    right_to_left=0,
    right_to_right=0.8
)

Clear channel mix values.

filters.clear_channel_mix()

Low Pass#

Set or remove low pass filter settings.

Lavalink Learn More

Set low pass values.

filters.set_low_pass(
    left_to_left=0.39,
    left_to_right=1,
    right_to_left=0,
    right_to_right=0.8
)

Clear low pass values.

filters.clear_low_pass()

Tip

All values except for the volume, can be one of three values

  • Float - The number you wish to set.
  • None - Clears that specific value in the filter.
  • Unset (DEFAULT) - Leaves it at its current value (only if set prior, otherwise it will be None)