Coder Social home page Coder Social logo

loudred's Introduction

Loudred - Discord Bot for streaming audio

A wild Loudred appeared

Loudred! Loudred!

Hmm... this Loudred appears to be trying to say something.

Loudred LOUDRED Loudred!

It seems like they're saying...that they're a Discord Audio Bot that streams audio from a MacOS audio device?

Motivations

This is quite strange. Wild Loudred don't usually venture out this way. Why are you here, Loudred?

Loudred Loud!

They're saying that they're here to fix a limitation with Go Live with Discord on MacOS. Currently, MacOS users are unable to stream audio through this service, but by adding Loudred as a bot, you can stream audio through them instead.

Setup

Loud Loud Loudred!

Slow down there, Loudred! They appear to be trying to tell us how to use them to stream audio. It seems a little complicated, but I'll do my best to break it down:

1. Setup a Discord Bot and add it to your Server

The first thing you need to do is create an application with a bot, and then add it to your server.

Loudred!

Oh, thank you Loudred! They've given us some helpful documentation

At the end of this process, your bot page should look something like this:

Screenshot of the Bot page. We have an application called "Loudred" with a bot that also happens to have the username "Loudred"

NOTE: Feel free to name your bot and application something other than Loudred!

2. Configure your audio devices

For this next step, you'll need some way of capturing your computer's sound output in an audio device

Loud! Loud!

Loudred recommends using a program called BlackHole (a wonderful program that you should consider sponsoring) for this. It works by creating a virtual audio device that you can read and write audio data to. Don't worry if you don't understand all that, we'll walk you through how to set all this up later! You can install it with homebrew by running the command:

brew cask install blackhole

Or install it using their intaller

Check out your audio devices by going to System Preferences > Sound. You should have the following output devices:

The "Output" tab of the "Sound" window. It shows a device called "MacBook Pro Speakers", which should have already been there, as well as a new device called "BlackHole 16ch"

and the following input devices:

The "Input" tab of the "Sound" window. It shows a device called "MacBook Pro Microphone", which should have already been there, as well as a new device called "BlackHole 16ch"

3. Download this Github repository

Loudred! Loudred! LOUDRED!

For the next step, you'll need to make sure you have the following installed:

  1. NodeJS - Download NodeJS here
  2. FFmpeg - Download FFmpeg here or install it using brew install ffmpeg

Once you have those installed, clone this repo using the following command:

git clone https://github.com/reccanti/Loudred.git

Once that's done, go into the newly created directory:

cd Loudred

...and then install its dependencies using

npm install

Running Loudred

Loudred! Loudred!

Now that we have everything downloaded and installed, we can start the process of setting up and streaming our audio to Discord!

1. Setup your Program's Audio Device

The Easy Way

Loudred Loud!

If the program you're trying to stream supports changing the Audio output device, that's great! Just set your program's audio device to BlackHole and you're finished.

A great example of this is VLC, which lets you set the output device in its Audio menu like so:

You can set the output audio Device for VLC by going to Audio > Audio Device

The Hard Way

Loud! Loud!

Unfortunately, not every program supports this or makes it readily available. In this situation, you'll need to get a little more creative.

The first thing you'll need to do is make a Multi-Output Device. This is a device that will direct audio output into multiple sources. We're going to use it to direct audio to both our speakers and BlackHole. Open up the Audio MIDI Setup program. Yours should look something like this:

The Audio MIDI Setup program. It's displaying 3 audio devices: "BlackHole 16ch", "MacBook Pro Microphone", and "MacBook Pro Speakers"

Click the "+" button at the bottom and select Create Multi-Output Device:

The "+" menu. It displays 3 options: "Create Aggregate Device", "Create Multi-Output Device", and "Connect AirPlay Device"

You should now have a Multi-output device! Make sure both "MacBook Pro Speakers" and "BlackHole 16ch" are selected, and make sure "MacBook Pro Speakers" is the Master Device. It should look something like this:

The Audio MIDI Setup program again, but this time it's displaying a fourth audio device: "Multi-Output Device". The Master Device is set to "MacBook Pro Speakers", and both "MacBook Pro Speakers" and "BlackHole 16ch" are selected

Then, right click "Multi-Output Device"'s icon and select "Use This Device For Sound Output":

The menu that appears when you right click the "Multi-Output Device" icon. It displays the following options: "Configure Device... (disabled)", "Configure Speakers...", "Use This Device For Sound Input (disabled)", "Use This Device For Sound Output", and "Play Alerts and Sound Effects Through This Device"

NOTE: You may not hear any audio if "MacBook Pro Speakers" isn't at the top of your Audio Devices. To fix this, just deselect and reselect "BlackHole 16ch", and that should move it below the speakers

2. Setup Discord's Audio Device

Loudred! Loudred! Loudred!

It sounds like Loudred is getting excited, we're almost done! Our next step is to set Discord's Output Audio Device. This is much easier. To do this, click the "User Settings" gear at the bottom of the client:

Screenshot showing the location of the User Settings Gear at the bottom of the Discord Client, next to the "Deafen" and "Mute" buttons

and then go to Voice & Video and set the Output Device to "MacBook Pro Speakers". Or, if you're wearing headphones, set it to those! The important thing is that you DON'T set your output device to anything that's directing audio to BlackHole, since that will produce an echo. Your configuration should look something like this:

The Voice Settings Page. We've configured it so that our Output Device is "MacBook Pro Speakers"

3. Configure and run the bot client

LOUDRED! LOUDRED!

This is it, the last step! Rename config.copy.js to config.js. So far so good, but we need to add our client token. Go back to your bot's page in the Discord developer portal you created earlier and click the "Copy" button. Then, in config.js, change the value of the DISCORD_CLIENT_TOKEN variable from YOUR CLIENT TOKEN HERE to the token you copied.

NOTE: While you're here, feel free to customize anything else about the bot! The names, descriptions, and messages are all customizable.

Now you're ready to run the program! Run this command in your terminal:

npm start

You should be met with the following options:

A menu in the terminal. It asks the question "Choose the output audio device you'd like to stream to Discord" and gives the following options: "BlackHole 16ch", "MackBook Pro Microphone", "MacBook Pro Speakers", and "Multi-Output Device"

Select "BlackHole 16ch". If everything went well, you should see the message "ready" in your terminal.

Conclusion

Loudred! Loudred! Loud!

And that's it! You should be able to use Loudred in your Discord Server. Type @loudred IChooseYou so that it starts listening for commands from your server. You should get a list of all the commands it can use.

loudred's People

Contributors

reccanti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.