If you're here, you probably know what Lavalink is, but to quote the project readme:
A standalone audio sending node based on Lavaplayer and JDA-Audio. Allows for sending audio without it ever reaching any of your shards.
Or for what it means to me: How a Discord bot can have audio playing functionality - particularly YouTube.
Lavalink is written in Java and has many libraries in your favourite language to interact with it. In the .NET space, I personally like to use Victoria:
In this post we'll be looking at how to get Lavalink running on a Raspberry Pi Zero 2 W by:
- Installing Java
- Running Lavalink
Lavalink has issues with a couple of Java versions and as such I opted to install Java 16 which seems to work. Follow the post below for installation instructions:
Issue resolution a little lower.
We can grab Lavalink from the releases page on the GitHub repo. However, in order to run Lavalink you also need to put an
application.yaml file in the same directory as Lavalink.jar. Thankfully, there is a good default example hosted in the repo too.
From here head to where you put the two files mentioned just above and we can run the following command (might take a little to get going):
java -jar Lavalink.jar
Which should result in:
Lavalink Zero 2 W Problem Resolution
As hinted to earlier, for some reason the .jar file does not properly work specifically on the Zero 2 W. We can fix this by using a custom patched .jar:
This repo seems to take the Lavalink repository and create custom patched versions. I originally stumbled upon it with this GitHub issue comment:
Essentially using the custom patched .jar works just the same as the original. For my purposes I use the original when using Windows and the patched version when running on the Pi. Remember you'll need the
With this you can now successfully run Lavalink on your little Pi Zero 2 W (or Windows for development like I did). Happy coding!