Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing over Discord #57

Closed
HagarJNode opened this issue Jul 16, 2022 · 13 comments
Closed

Playing over Discord #57

HagarJNode opened this issue Jul 16, 2022 · 13 comments

Comments

@HagarJNode
Copy link

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?

@HagarJNode
Copy link
Author

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

@HagarJNode
Copy link
Author

HagarJNode commented Jul 21, 2022

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.

@DxsSucuk
Copy link

DxsSucuk commented Jul 29, 2022

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?

@HagarJNode
Copy link
Author

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.

@Walkyst
Copy link
Owner

Walkyst commented Jul 30, 2022

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

@HagarJNode
Copy link
Author

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.

@Walkyst
Copy link
Owner

Walkyst commented Jul 30, 2022

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

@HagarJNode
Copy link
Author

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.

@Walkyst
Copy link
Owner

Walkyst commented Jul 30, 2022

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

@HagarJNode
Copy link
Author

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

@Walkyst
Copy link
Owner

Walkyst commented Jul 30, 2022

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

@HagarJNode
Copy link
Author

Going to test it right away

@HagarJNode
Copy link
Author

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.

mxscowc1ty pushed a commit to MoscowMusic/lavaplayer-fork that referenced this issue Jan 2, 2024
* Moved URLs to TwitchConstants

* Use lowercase streamName everywhere, fixes Walkyst#51

* Prevent a NullPointerException

* Also move the comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants