Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

[Suggestion] Way to change the bot's volume #57

Closed
hugmanrique opened this issue Apr 23, 2016 · 7 comments
Closed

[Suggestion] Way to change the bot's volume #57

hugmanrique opened this issue Apr 23, 2016 · 7 comments

Comments

@hugmanrique
Copy link

A function could be added in the callback with the stream in the Bot#getAudionContext because music at 100% is so high

@Adryd
Copy link
Contributor

Adryd commented May 4, 2016

That's an issue with FFMPEG.
Here's my fix

var ffmpeg = spawn('ffmpeg', [ //Or 'avconv', if you have it instead
                                        '-i', file,
                                        '-af', 'volume=0.15',
                                        '-f', 's16le',
                                        '-ar', '48000',
                                        '-ac', '2', //If you want one audio channel (mono), you can omit `stereo: true` in `getAudioContext`
                                        'pipe:1'
                                    ], {
                                        stdio: ['pipe', 'pipe', 'ignore']
                                    });

@hugmanrique
Copy link
Author

hugmanrique commented May 5, 2016

This should be added to this line (Edit: outdated)

@RaidAndFade
Copy link
Contributor

RaidAndFade commented Dec 6, 2016

The library does not need to add something to suit your needs, The library actually does not even have a way to read audio files built in for the exact reason implicated as the statement above. You should implement your own commands because ffmpeg takes many arguments, as well as the fact that adding that line would need the library to have ffmpeg as a requirement, making the library much harder to install for no reason.

@ZatsuneNoMokou
Copy link

There's no other way to do it?

@t3kk
Copy link

t3kk commented Feb 26, 2017

You may be able to use pcm-volume to do it. You can pipe your files to the volume object instead and send that to the stream for discord.

@ZatsuneNoMokou
Copy link

I don't really understand how it works? how am I supposed to do it with the youtube-dl nodejs module?

@t3kk
Copy link

t3kk commented Feb 26, 2017

I've waited for youtube-dl to output a file and then ran that through ffmpeg to get a PCM stream. I don't have it sounding perfect yet, sometimes there are little blips in the audio, but once you have a PCM stream you can pipe that though volume.

This lets you change it almost immediately instead of though ffmpeg which I suspect you would need to wait for the next decode for it to take effect

@izy521 izy521 closed this as completed Jun 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants