For the complete documentation index, see llms.txt. This page is also available as Markdown.

11.5 Audio Players

The main audio players on FreeBSD include Audacious, VLC, and MPD. This section provides pkg installation methods and introduces the configuration process for playing DSD audio with MPD.

Audacious

Installing Audacious

  • Install using pkg (binary package manager):

# pkg install audacious audacious-plugins

Note

The audacious-plugins plugin package is a necessary dependency for the Audacious main program to run. Without installing this plugin package, the audacious main program cannot start properly.

  • Or compile and install using Ports (source code package manager):

# cd /usr/ports/multimedia/audacious/ && make install clean
# cd /usr/ports/multimedia/audacious-plugins/ && make install clean

Using Audacious

Test compatibility with music formats such as .m4a (MPEG-4 audio container format), .flac (lossless audio compression encoding), .av3a (AVS3 audio raw bitstream format), etc. .m4a is a container format that can contain various encodings (such as AAC, ALAC, etc.); .av3a is a raw bitstream, and in practice AVS3 audio is also commonly encapsulated in MP4 containers with the .m4a extension.

Tip

Based on testing, Audacious with its default build supports .flac and .m4a (AAC encoding) formats among the above, but currently does not support .av3a (AVS3 audio raw bitstream) and other encoding formats. Appropriate plugins must be installed or separate configuration is required.

Audacious

VLC

The installation method for the VLC (originally VideoLAN Client) player can be found in the video player section of this book. The ffmpeg multimedia framework in FreeBSD (where "FF" stands for "Fast Forward" and "mpeg" refers to the MPEG standard) does not enable libuavs3d (AVS3 decoding) and libdavs2 (AVS2 decoding) support in its default build configuration. This section does not cover the configuration method for recompiling.

Through actual testing, with ffmpeg installed and AC-4 decoding support enabled at compile time, the VLC player can play AC-4 encoded m4a format audio (note that the standard ffmpeg build does not enable AC-4 decoding by default; you need to patch and compile it yourself):

Playing AC-4 Encoded m4a Format Audio

Playing DSD with MPD

Music Player Daemon (MPD) is a music player daemon that can run on a server or personal computer and be remotely controlled through various client programs.

MPD's main features include: support for decoding multiple audio formats, client-server separated architecture, playlist management, streaming support, and cross-platform operation.

Hardware Preparation

You need a sound card or DAC (Digital-to-Analog Converter) that supports the DSD (Direct Stream Digital) format, and a DSD-encoded audio file for testing.

The following configuration instructions are based on the FreeBSD 14.0 operating system, using the HiBy R3 as the external DAC example device (the configuration method for other similar sound cards is basically the same), and using the OSS (Open Sound System) audio driver.

Installing Music Player Daemon

Or compile and install via Ports source code:

Hardware Settings

The current system sound card and audio device status is as follows:

This example uses the pcm2 device, whose corresponding device file path is /dev/dsp2, which will be used in the configuration below.

You can use the sysctl -d dev.pcm.2 command to view the detailed meaning of relevant hardware parameters. The three key parameters are excerpted below:

Set the parameters as shown below (you can write these configurations to the sysctl.conf file to make them persist across system reboots):

Parameter descriptions:

  • Since the OSS audio driver is used, Music Player Daemon can only use DoP (DSD over PCM) transmission mode, and DoP mode requires enabling bit-perfect mode.

  • Sampling rate (vchanrate): The sampling rate of DSD audio is an integer multiple of 44.1 kHz, so it should not be set to an integer multiple of 48 kHz, as this may produce audio noise; when hardware conditions permit, it should be set to the highest possible value. The example here is set to 352.8 kHz.

  • dev.pcm.2.play.vchanmode virtual channel mode parameter description:

Value
Mode
Description

0

fixed

The audio device uses a fixed sampling rate and format to process multiple audio streams

1

passthrough

The audio device preserves the original sampling rate and format of the input audio stream as much as possible, without additional conversion processing

2

adaptive

The audio device automatically adapts and converts the sampling rate and format of the input audio stream as needed

Tip

You can use the dmesg command to view the available sampling rates supported by the hardware in the kernel log. When playing non-DSD files, it is more appropriate to set the sampling rate to the same as (or an integer multiple of) the audio file's own sampling rate, as this avoids audio quality loss caused by resampling. A higher sampling rate is not always better; multiple tests are needed to determine the value suitable for the current hardware configuration.

View kernel messages related to the pcm2 sound card:

Music Player Daemon Basic Settings

The configuration file for Music Player Daemon (musicpd) is /usr/local/etc/musicpd.conf.

The default directory structure used is as follows:

Some directories used by MPD by default need to be created manually:

Edit the /usr/local/etc/musicpd.conf file and add a new section after the "Default OSS Device" section:

Tip

You can specify multiple output devices and enable or disable the corresponding output devices as needed in various clients.

Enable the musicpd service:

Client Usage

You can use various clients such as ncmpc (character interface), MaximumMPD (iPhone), and others. There is a rich variety of clients available.

For PC GUI clients, Cantata (Port audio/cantata) is recommended. The original author of Cantata stopped development in 2022, but a community fork (nullobsi/cantata) has taken over maintenance and ported it to Qt6. The audio/cantata in FreeBSD Ports has already switched to this actively maintained fork.

For command-line environments, ncmpc (Port audio/ncmpc) is recommended, suitable for binding to desktop environment global hotkeys.

Last updated