# Introduction
"Voice" refers to the ability of a bot to send audio in voice channels. discord.js makes it easy for you to get up and running with voice!
# Quick example
async function play(voiceChannel) {
const connection = await voiceChannel.join();
connection.play('audio.mp3');
}
# Installing dependencies
At the bare minimum, you'll need:
- An Opus library:
You may also choose to install the following dependencies.
- FFmpeg (recommended) – allows you to play a range of media (e.g. MP3s).
- This guide will assume you have installed FFmpeg.
ffmpeg
(opens new window) - install and add to your system environmentffmpeg-static
(opens new window) - to install FFmpeg via npm
- Faster encryption packages
sodium
(opens new window) (best performance)libsodium-wrappers
(opens new window)
TIP
Outside a development environment, it is recommended for you to use @discordjs/opus
and sodium
to improve performance and improve the stability of audio playback!
If you're struggling to install these dependencies, make sure you have build tools installed first. On Windows, this is as easy as running npm install --global --production --vs2015 --add-python-to-path windows-build-tools
!