When it makes sense to use lava link instead of using the integrated PCM Audio Source? #6988
-
I'm currently using a customized PCMVolumeTransformer with FFmpegPCMAudio. I have following requirements:
Does it makes sense to switch to lavalink? (with wavelink) When it generally makes sense to switch? What are the advantages? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Heya! Switching to a Lavalink server, specifically using Wavelink can easily handle 100+ players listening to high quality MP3 audio. Using Wavelink's built in functions, you can easily get the specific timestamp and current progress in the current track, song, or playlist. If I'm not mistaken, either Rhythm or Groovy Bot use a Lavalink server (not Python). Let's run through a quick implementation for fetching current progress and timestamp. @bot.command()
async def timestamp(ctx):
player = bot.wavelink.get_player(ctx.guild.id)
pos = player.position # The players seek position in the currently playing track in milliseconds.
# In order to get total track time, you would need to keep track of the current Track for each player.
# You can do this with a class or something simple:
current_track = self.tracks[ctx.guild.id].length # The duration of the track in milliseconds. You can do some simple maths from there to handle what you need. If you take a look at the advanced example from Wavelink, you can see they use a MusicController to handle everything (which would make your current track much easier to get). Using FFmpegPCMAudio with a customized PCMVolumeTransformer, although coded well, still has the tendency to break or have unreliable audio / playback. I would recommend testing out Wavelink and then going from there. |
Beta Was this translation helpful? Give feedback.
Heya!
Switching to a Lavalink server, specifically using Wavelink can easily handle 100+ players listening to high quality MP3 audio. Using Wavelink's built in functions, you can easily get the specific timestamp and current progress in the current track, song, or playlist. If I'm not mistaken, either Rhythm or Groovy Bot use a Lavalink server (not Python).
Let's run through a quick implementation for fetching current progress and timestamp.