Walkyst/lavaplayer-fork

Playing over Discord

HagarJNode opened this issue · 13 comments

I'm trying to integrate JavaMod with Lavaplayer, but guess it can't be added to the project as it's LGPL (am I right??) I face some sound problems doing the integration. Uploading a mod file through Discord and sending data in AudioPipeline's process with chunck sized ShortBuffer just makes a lot of noise... some times bits of something sounding like an old am/fm radio not right tuned. Writing the same data on javax.sound.sampled.SourceDataLine playes the tune right. Any ideas on what is going wrong?

If any help, the mod file format is PCM signed. 48.000 Hz, 16 bit, 2 channels, 4 bytes/frame, LE

Hmm... sending the 2 channels to each own array and using the process(short[][], pos. length) made the sound better, but missing a lot of samples. For now I have taken a shortcut, as the JavaMod code had an export to wave files, which I used for a temp file and then just used the WavFileLoader with a LocalSeekableInputStream.

That done, I still would like some kind of document that describe how to create a new input provider/track and the requirements to the output stream, that could be nice.

What are you exactly trying to do? Do you want to use JavaMod to play the music with a Bot into a channel or the reveres?

What are you exactly trying to do? Do you want to use JavaMod to play the music with a Bot into a channel or the reveres?

Making Lavaplayer able to play mod files - like it can play wav files, using parts of JavaMod as the "engine", and play into a Discord channel.

What exactly mod files you mean, like what extensions or you mean .mod extension? Also send file example please

What exactly mod files you mean, like what extensions or you mean .mod extension? Also send file example please

Mod is a file format for some music made on the Amiga (https://en.wikipedia.org/wiki/MOD_(file_format)) - so, yes, like the .mod extension.

What I had, that worked, was like this:

Discord upload of file -> Lavaplayer -> JavaMod -> SourceDataLine (on my local running machine)

Not working:

Discord upload of file -> Lavaplayer -> JavaMod -> Lavaplayer -> Discord voice channel

What I ended up with:

Discord upload of file -> Lavaplayer -> JavaMod -> wav export -> WavTrackProvider -> Lavaplayer -> Discord voice channel

I'm failing to see why I couldn't send the data direct from my JavaMod integration, as if there is something, or some format, that it should be converted into in order to work.

I'm failing to see why I couldn't send the data direct from my JavaMod integration, as if there is something, or some format, that it should be converted into in order to work.

Discord voice support only OPUS frames, not sure JavaMod support it

Also I think it's possible completely remove JavaMod from this chain and pass files directly to Lavaplayer -> Voice channel, this just requires .mod decoder and you did not send example of file

I thought Lavaplayer convert all data sent to Discord by default into OPUS - but it sounds like I have to it, is that right?
I'm using the JavaMod as a decoder, was what I ment with "engine", sorry for that.

And, yes, I didn't send any example file. I cleaned up my code and committed it, but I could go back into history of my files and find it.

I thought Lavaplayer convert all data sent to Discord by default into OPUS - but it sounds like I have to it, is that right?

You don't need todo anything for that, LP is handling this, discord simply not accepting anything else

I'm using the JavaMod as a decoder, was what I ment with "engine", sorry for that.

I'm mean sure there's way don't use JavaMod at all and process audio completely in LP, i will try implement that, but can't guarantee anything

I created a Github repository that I invitated you into. Note that JavaMod is LGPL v2.

Just tested some .mod files and it worked well with XM extension, you just need register source manager HttpAudioSourceManager(MediaContainerRegistry.extended(new XmContainerProbe())) with this extension

Going to test it right away

D'ouh! It sure plays... had to update my LavaPlayer version, but it works... Looks like I could have saved a lot of time.
Thanks Walkyst - I'll close this issue.