Skip to content

Instantly share code, notes, and snippets.

@JaykeBird
Last active March 4, 2021 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaykeBird/17ae5bcca1d1ebab0d8ac8fd2d02c703 to your computer and use it in GitHub Desktop.
Save JaykeBird/17ae5bcca1d1ebab0d8ac8fd2d02c703 to your computer and use it in GitHub Desktop.
DjBlue FAQs

Here's some answers to common questions about Dj Blue!

General

Basically, how does Dj Blue work?

Everything in Dj Blue is centered around playlists. Once you have at least one playlist set up, you can start playing it and you can have Dj Blue switch to your other playlists as you go along.

What makes Dj Blue different from other audio players or programs?

Dj Blue allows users to have a continuous, unbroken stream of music, good for things like providing background music to a TTRPG adventure or a gathering or helping a DJ put together a show. As you go along, this stream can be modified and you can swap what songs are played as it's continuing to play.

This is accomplished by having it focus specifically on playing and managing playlists. Unlike other programs where you're looking at one playlist (the same one that you're currently playing), Dj Blue allows you to manage multiple playlists at once. You can add songs to a new playlist while Dj Blue is playing a different list, and when you're ready, have Dj Blue swap over to the new list once it finishes the current song. It all occurs seamlessly on the end of the listeners.

On top of this, Dj Blue includes a number of audio effects which can be enabled and changed on the fly, such as crossfading, changing audio speed and pitch, and more.

What are the system requirements for Dj Blue?

Dj Blue is designed for Windows 8, Windows 8.1, and Windows 10 devices. Dj Blue will also work on Windows 7 devices for now, but it is not officially supported. For Windows 7, your computer must have .NET Framework 4.5 or newer on it before you can install Dj Blue.

In addition, you must meet these requirements:

  • 64-bit computer (x64) (most people have this)
  • 2 GB of RAM or more
  • 230 MB of free space
  • a screen resolution of 1024 x 768 or larger

If you are in Europe or South Korea and have a Windows N or Windows KN installation, read the following question.

What if I have a Windows N or Windows KN installation (in Europe or South Korea)?

The Windows N and Windows KN releases do not include any media features with Windows itself. Dj Blue uses Windows's media features to support more audio formats and play audio. You'll want to install the Media Features pack before you can install and use Dj Blue.

(If you have a standard Windows release, not a N or KN version, then you can disregard this.)

Please follow the instructions or visit the appropriate link below for your version of Windows:

Why does Dj Blue not officially support Windows 7?

Windows 7 is an older operating system, which Microsoft stopped supporting back in January 2020. While Windows 7 has nearly all of the audio features that Dj Blue uses, there are other technologies and features that Windows 7 doesn't have (out of the box). Coupled with the fact that I do not have any Windows 7 devices to test Dj Blue on, it will be more difficult for me to support Windows 7 than it is worth.

I recommend that if you're still using Windows 7, that you work on upgrading to Windows 10 (either on your existing PC or via getting a new PC) - not just for Dj Blue, but also for additional security and new features. At this point, I won't do anything that will explicitly keep Dj Blue from working on Windows 7, but there's going to be some point where it will stop working, and once it does, well, that's it.

Audio Support / Options

What audio formats/encodings are supported?

Dj Blue supports a number of formats, based upon what NAudio and Windows supports. This includes:

  • WAV/Linear PCM (*.wav)
  • AIFF (*.aiff, *.aif)
  • G.711 (*.au, *.snd) (both A-law and mu-law)
  • MP3 (*.mp3)
  • MPEG-4/AAC (*.m4a, *.mp4)
  • WMA (*.wma)

If you are using Windows 10, you can also open some FLAC (*.flac) files in Dj Blue.

What's the difference between WaveOut and WASAPI?

In the grand scheme of things, there isn't too much of a discernable difference.

WaveOut is an older Windows interface for playing audio - so old in fact that Windows 98 and later actually emulate WaveOut rather than directly having it. WaveOut doesn't support newer audio features, such as surround sound, but due to its age and relative simplicity, practically every computer audio device ever made will support WaveOut/WaveIn.

WASAPI is a newer, more modern audio interface added in Windows Vista. WASAPI supports more advanced features and is better constructed, and allows applications to exclusively take over the sound driver to deliver the lowest latency possible. Practically all modern audio devices out there support WASAPI, so this is the recommended output option to use.

What is "exclusive mode" in WASAPI? Should I use it?

Exclusive mode gives a program exclusive and direct access to your sound drivers (and thus, your speakers/headphones). This means the program is able to directly and precisely control what goes through those speakers/headphones with the lowest latency and no interference. However, this has the downside in which only that one program is able to output any sound; all other programs do not output any sound at all, as if they are muted.

It's up to you if you'd like to use exclusive mode. I personally do not find it useful to my purposes, but that may be different for you. This is why I provide options. :)

Does Dj Blue support ASIO?

ASIO support was not a priority for Dj Blue 1.0, but it can be looked at at a later time.

Does Dj Blue support Opus/WebM audio?

Dj Blue does come packaged with a copy of the Opus codec that I prepare myself, but I haven't specifically enabled Opus audio file support in Dj Blue 1.0.

The Opus codec included with Dj Blue is used specifically to transmit audio via Discord, as Discord only uses the Opus encoding. The third-party library Discord.NET handles interacting with the Opus codec to make this happen, Dj Blue doesn't directly interface with it. In regards to supported audio formats, Dj Blue relies upon what Windows itself supports as well, and newer versions of Windows 10 do include some form of Opus support, but in my testing, it seemed to not work for me.

As a result, even if Windows 10 may support it to some degree, I didn't want to give the appearance of Opus/WebM support if it isn't going to be reliable. You can certainly try to use Windows 10's Opus support and import Opus/WebM audio files by selecting "Add > Local File..." in a list, and then selecting "All Files" from the file type drop-down in the Open dialog. However, your mileage may vary.

For a future version of Dj Blue, I'll add in code to directly communicate to the Opus codec so that Opus audio files are officially supported.

What is a sample rate? What is audio resampling? Why does Dj Blue resample audio?

To explain this, we'll need to explain a few audio processing terms. (Note that this will be a simplification.)

For audio recording, a "sample" is a capture of all audio in that immediate moment, like a picture/snapshot. If we take these snapshots often enough, we can string them together to create the apparance of a seamless stream of audio. This is how audio is replicated and played, by playing out these snapshots in the same order they were captured. This applies equally from recording from a physical microphone as it does to "recording" computer-generated sound.

A "sample rate" is how many samples are made in a second (a.k.a. how often we take those snapshots), and thus how many samples are played in a second when audio data is played. As you'd expect, a higher-quality sample rate provides more accurate audio, but can also increase the size of audio files/streams. In reality, any sample rate over 60,000 Hz (or 60,000 samples in one second) don't have any discernable difference to human ears.

As a result, one of the most common sample rates you'll see is 44,100 Hz (or 44,100 samples in a second, also displayed as 44.1 KHz); this rate was selected as the "CD Audio" rate, so it is the rate which all audio CDs play at. Another highly common rate is 48,000 Hz, as it plays well with video frame rates of 24 FPS and 30 FPS. A lot of professional equipment use/support 48,000 Hz. (You'll also see some higher rates as well, such as 96,000 Hz and 192,000 Hz (both DVD audio quality).)

Resampling is simply the process of converting audio files/data from one sample rate to another, via means of mathematical calculations to add, remove, or interpolate samples as needed. Poor-quality resampling algorithms provide sometimes-undesirable results, but Windows luckily includes a fairly decent one. Dj Blue uses Windows's resampler to perform all needed resampling.

Dj Blue uses resampling to make sure all audio files play at the exact same sample rate. This has the benefit of playing more nicely with audio drivers, but also enables certain features such as crossfading and other fun stuff down the road. Discord also requires all streamed audio to have a 48,000 Hz sample rate, so resampling is needed there.

YouTube Import

How does the YouTube import feature work?

Dj Blue uses a third-party library called YouTube-Explode that provides this functionality. YouTube-Explode uses an internal YouTube API that they've reverse-engineered. This allows them to find videos (or playlists), get info about them, and download them. Dj Blue itself does not interact with YouTube or this API, only the third-party library.

When you tell Dj Blue to import a video, Dj Blue has YouTube-Explode find the video and get a list of all the formats the video can be downloaded as. Dj Blue find the MP4 format download (which there is usually only one) and downloads only the audio to your device. (In a later version, Dj Blue will start using the Opus codec and begin downloading videos in the Opus format.) Dj Blue uses this downloaded copy whenever you want to play that video.

It is recommended to find the video or playlist you want via YouTube itself and then enter the video ID or URL, or playlist ID or URL into Dj Blue. This is faster than searching YouTube from within Dj Blue itself.

Why do certain videos (or channels or playlists) not come up in Dj Blue when you search for them?

The third-party library, YouTube-Explode, isn't able to display channels or playlists, or certain types of videos, when you enter a search term. This is a limitation of YouTube itself, not something that YouTube-Explode can directly fix.

Do playing imported videos help the video creator? Do they increase the view count on YouTube?

They do not. When you import a video into Dj Blue, Dj Blue actually downloads a copy of the video's audio and stores it on your computer. This local copy is then played whenever you want to play that video. As it is just a simple audio file, just like any other audio file on your device, it has no way to connect back to YouTube to report it being played or anything like that. As a result, downloaded videos also do not provide any support for the video creator in regards to ad revenue or anything else.

It is recommended that you find ways to support the creators of the videos you download, such as buying their tracks (such as through Bandcamp) and using the bought tracks, or supporting the creator on Patreon or other crowd-funding services if available.

Do the downloads contain the video portion, or only audio?

Only the audio is downloaded from YouTube videos. YouTube stores each video's audio feed and video feed separately, so Dj Blue is able to grab only the audio feed and use that.

Why does searching/importing slow down or stop working when I search or import a lot of videos in a row?

When you import or search a lot of videos in a row, YouTube itself may begin to throttle your connection or cut you off from being able to access videos via Dj Blue. If this happens, stop importing videos for a few hours and then try again. If there's still an issue, try restarting the computer and/or restarting your modem.

Discord Bot

How do you set up a Discord bot in Dj Blue?

Dj Blue includes the functionality for running a Discord bot out of the box, but there is a bit of setup needed to get it working for you first.

You'll need to create a bot account and generate a bot token to provide to Dj Blue. It is not difficult to do at all, and also gives you the benefit of having total and complete control over the bot, including its name and profile icon. This does unfortunately mean you'll need a computer with a stable Internet connection that can run Dj Blue and the bot while you're using it. It is also important to note that creating a bot account is a permanent action; even if you don't use the bot anymore, the account will still be out there in the world (of course, you can simply kick it from all of your servers if you just don't wanna see it anymore).

To get started, head over to Discord's developer page (if you sign in and then are directed to the main Discord interface, close out of that tab and re-open the link again). If you don't have a bot account set up yet, click on "New Application" in the top-right to get started. Enter the name you want to use for the bot account and press "Create".

You should now be brought to the main application page for your bot account. Don't pay much attention to the main page for right now, and instead move over to the "Bot" tab on the left side of the page. You'll want to select the option to create the bot account, and from here, you can further customize the username and the profile icon if you'd like. You can turn on the "Public bot" option if you'd like others to invite your bot to their servers, or keep it off if only you will have that special right.

Lastly, you'll want to copy down two pieces of information: the bot token on this Bot page, and the client ID back on the main page ("General Information"). Put these into a text document or something somewhere for now. The client secret is not used. For these two pieces of information, do not share them with others, as it may allow them to take control of your bot!

Now that that's all set, we can return back to Dj Blue. First, select the Options > Discord Bot > Start Bot option. It'll immediately ask you for the bot token you copied down, and then the bot should be able to start. Next, you can re-open the menu and select Options > Discord Bot > Invite to Server. Here, Dj Blue will then ask for the client ID you copied. After that, a webpage will open where you can select which server to invite the bot into. Now, Dj Blue will remember the two things you copied, so you don't need to re-copy them again later.

From here, you'll be able to control the bot from Dj Blue itself. Most of the options you'll need are in that Options > Discord Bot submenu, and there are more settings and controls you can set by opening the Options window (Options > Discord Bot > Bot Settings).

Why is the Client ID and Bot Token hidden by default in the Discord bot settings?

Your bot's client ID and bot token are both sensitive pieces of information, and if other people are able to view and copy them, they'd be able to create their own bot that uses the same connections and appears online as your own bot.

With their own bot, they can control a variety of things on a number of servers, without you being aware.

As a result, they are hidden by default when you open the Discord Bot settings, and this is also why we recommend you do not share this information with others.

If this information is copied and others begin to impersonate your bot, you can go back to Discord's developer page and have it create for you a new token and client ID (which will also delete the old ones). Once that is created, you can go back to Dj Blue's Discord Bot settings via Options > Discord Bot > Bot Settings, and click on the buttons "Set New Client ID" and "Set New Token" to enter the newly created ID and token.

How do I change who has access to commands with the Discord bot?

You have a couple of options to change command access with the Discord bot. To get started, you'll want to open the bot settings in Dj Blue by going to Options > Discord Bot > Bot Settings.

Here, if you scroll down a little bit, you'll find two options under the Allowed Commands section: "Administrators" and "All other users". You can change which commands, if any, administrators and other server members have access to.

There are three levels available to choose:

  • None: This completely disables all commands. If they try to run a command with the bot, the bot won't even acknowledge them. If you set both "Administrators" and "All other users" to None, then commands as a whole are disabled.
  • Basic: This allows access to basic audio transport and listening controls (such as "pause", "stop", and "volume"), as well as access to the "join" command to have the bot join an audio channel. The Dj Blue program itself will still be needed to actually create playlists and get them started.
  • Advanced: This allows access to all commands available, including changing things like creating, managing, and playing playlists; changing the audio speed and pitch, the play mode (i.e. "In Order - Repeat" or "Shuffle"), and more. With these commands, a Discord user doesn't need direct access to the Dj Blue program to still be able to fully use its features.

There are also a couple things to note:

  • A user is considered an "Administrator" if they have the Administrator permission in the server's permission/role settings. If they do not have that permission, they fall under the "All other users" umbrella. As the Administrator permission is a powerful permission to grant in a server, this should only be left to moderators on your server or those whom you can trust with this permission.
  • Dj Blue considers "Administrators" and "All other users" as two separate groups. This means that if you set "Administrators" to None and set "All other users" to Advanced, then that means that your administrators will not be able to use commands at all, while all of the other server's members can use all of the commands. In general, the "Administrators" option should be at the same level/access or higher than the "All other users" option.
  • These settings are used in the bot throughout all servers, not saved per-server. This means that the "Administrators" option affects administrators in all servers the bot has been invited to, and the "All other users" respectively affects all other members in all servers. If a specific server needs different settings, either consider changing the roles/permissions on that server to match what you need, or creating another bot account for that specific server. However, if a user is on two servers the bot is also on, but is only an Administrator on one of those servers, the "Administrator" option will only apply when that user is using the bot in that particular server where they're an Administrator. In the other server, they'll be put in the "All other users" category.

What is a command prefix? How/why should I change it?

The command prefix sets what characters need to be typed before a command for the Discord bot to recognize it as a command. Thus, there's a difference between you typing "volume" in response to a friend in a text channel, and typing "volume" to change the bot's volume. If a Discord message doesn't contain the prefix, then the Discord bot disregards that message.

By default, Dj Blue's prefix is set to "!"; this means you'll need to type "!pause" or "!volume" to activate commands for the Discord bot. You can change this prefix by going to Options > Discord Bot > Bot Settings and scrolling down to the "Command Prefix" option. If you have multiple bots invited to one server and another already uses the "!" prefix, it's almost always better to change the prefix so you don't accidentally activate/confuse multiple bots with one command. (Many bots offer the ability to change their prefix, so you can change it in Dj Blue or change it in a different bot you're using, but some bots may not allow it to be changed).

In Dj Blue, the command prefix does not need to be a single character; you can set it to "@$!" for example (and thus, you'll need to type "@$!pause" or "@$!volume" to activate commands). Note that the longer the prefix is, though, the harder it will be to quickly type out commands. Also avoid using prefixes with only letters and/or numbers, as this can lead to situations where the bot is accidentally activated.

How do I get a list of all the commands available for the Discord bot?

Here is a list of commands: https://jaykebird.com/software/djblue/commandreference

Other Features / Questions

Can Dj Blue be controlled via command-line?

Yes, it can be, with a small caveat.

As long as Dj Blue is currently running, you can pass commands by starting DjBlue again and putting in the commands as command-line arguments. Dj Blue will operate on commands as well as it can, but it'll only output responses and errors in the Output Log window in the GUI itself. (It is important to note that Dj Blue is a GUI program first, and command-line accessible second.)

For example, if you have Dj Blue installed to "C:/DjBlue/DjBlue.exe", you can do the following:

# first, let's start the application
C:\DjBlue\> DjBlue.exe

# once the application is started, we can start passing commands
C:\DjBlue\> DjBlue.exe play "C:\playlist.djp"
C:\DjBlue\> DjBlue.exe pause
C:\DjBlue\> DjBlue.exe resume
# with Windows's CMD, you can simply type out "djblue" and drop the ".exe" part
C:\DjBlue\> djblue playmode shuffle
C:\DjBlue\> djblue skip
C:\DjBlue\> djblue stop

If you do not pass in a command (i.e. just type "DjBlue.exe") while its running, this simply brings the window back to the foreground.

If Dj Blue is not running and you start it with a command, the command will be disregarded and it'll start as normal. A future version of Dj Blue will probably change this.

Here's a list of available commands: https://jaykebird.com/software/djblue/commandreference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment