Utilizing CUI music player on Linux: installation and configuration of cmus, ncmpcpp, and MPD

There are many music playback tools available in a CUI (character user interface) environment, but here are a few that are new and noteworthy. These players feature the latest features and modern design concepts.

  1. cmus:
    • cmus (C* Music Player) is a very lightweight and efficient CUI-based music player. It offers support for a wide range of audio formats, playlist management, library search, and a queue function.
  2. ncmpcpp:
    • ncmpcpp (NCurses Music Player Client Plus Plus) is a powerful CUI client for mpd (Music Player Daemon). It has a graphical interface, but features CUI-based operation.
  3. moc:
    • moc (Music On Console) is an easy-to-use CUI music player. It uses a server/client architecture, allowing you to control your music while it runs in the background.
  4. musikcube:
    • musikcube is a modern CUI music player that leverages the latest C language features, supports numerous audio formats, playlist management, and streaming support.

These players are available for Linux, as well as some for macOS and Windows. Installation and use is typically done through the package management system of each Linux distribution. Each player has different features and interfaces, so it is important to choose the one that best suits your needs. Another advantage is that these players are open source and are actively supported and extended by the community. First, install cmus.

https://github.com/cmus/cmus

Perhaps you can install it easily with the following command.

sudo apt install cmus

Use make and ./configure and through the package manager are the main differences in the complexity of the installation process, the flexibility of customization, and package management.

The main differences between installation using make and ./configure

  1. Customizability: .
    • ./configure scripts provide options to customize the software for your system. This allows for detailed configuration, such as enabling/disabling specific features or installing to a specific path.
  2. Latest Version: .
    • When building directly from source code, you often have access to the latest or developing version.
  3. Manual management of dependencies: If you are building directly from source code, you will often have access to the latest version or the version under development.
    • Dependencies must be managed manually and the necessary libraries and tools must be installed in advance.
  4. Process Complexity: The process is complex.
    • The build process requires technical knowledge and may require troubleshooting of errors.

How to Use Package Manager

  1. Simplicity and Convenience:.
    • Using a package manager (e.g., apt, yum, dnf, etc.), you can complete the installation with a single command. This is a beginner-friendly method.
  2. Automatic Dependency Resolution:.
    • The package manager automatically resolves necessary dependencies and downloads and installs the required packages.
  3. Stability and compatibility.
    • Software provided by package managers is usually guaranteed to be compatible and stable with your system.
  4. Easy updating and management.
    • Software can be easily updated and managed along with overall system updates.

Conclusion

  • The methods using make and ./configure are highly customizable and suitable for installing the latest or a specific version, but require more technical knowledge.
  • Using a package manager is more convenient and easier to manage dependencies, and this method is generally recommended.

Here, we will use the former installation method for the sake of learning. First, create a clone and move it to the given directory.

git clone https://github.com/cmus/cmus.git
cd cmus

Next, type the command ./configure and type the command .

./configure is a script used to prepare software for compilation and installation. It is especially common on systems such as UNIX and Linux. This script is usually provided as part of the source code package and is used to

  1. System checks: ./configure script checks that the system has the appropriate tools and libraries to compile the software. This includes compilers (such as gcc), required libraries, and other tools.
  2. Generate Configuration: Once the system checks are complete, the script generates a file called Makefile. This Makefile is used by the make command to direct the software compilation process.
  3. Customization: The user can customize the software by running the ./configure script to customize the build of the software. For example, they can specify where the software will be installed, enable/disable certain features, etc.
  4. Cross-platform support: ./configure scripts can be run on many different types of systems and will automatically generate the appropriate configuration for each environment.

Usage Example

Basic usage is to execute the following command in the source directory

./configure

Additional options can also be specified. For example, if you want to install the software in a specific directory, use

./configure --prefix=/path/to/directory

Notes

  • The ./configure script is used primarily with programs written in C or C.
  • The scripts are often generated by a tool called Autoconf, which is used to make source code portable to different systems.
  • ./configure is often executed by a shell script. This is for compatibility on various UNIX-like systems.
./configure

checking for program gcc… no
configure failed.

./configure error, especially if the error message checking for program gcc... no appears, this indicates that the GNU Compiler Collection ( GCC ) is not installed on your system. no error message, this indicates that the GNU Compiler Collection (GCC) is not installed on your system. GCC is a compiler used to compile programs in C, C and other languages.

Solution

  1. Install the C compiler:
    • Linux distributions such as Ubuntu usually use gcc (GNU Compiler Collection ).
    • Run the following command to install gcc and other development tools

      sudo apt update
      sudo apt install build-essential
    • This command will install gcc as well as make and any necessary library files.
  2. Check the path:
    • After installation, check that gcc is properly included in the path. The following commands can be used to check.

      gcc --version
    • This command displays the version information of gcc and confirms that the installation was successful.
  3. Run . /configure again:
    • After installing the C compiler, run the . /configure script again after installing the C compiler.
    • The script should now execute correctly and generate a Makefile.
sudo apt install build-essential

Run the ./configure script again, an error occurred at the end.

mamu@ubuntu22s:~/cmus$ . /configure
checking for program gcc… /usr/bin/gcc
checking for program gcc… /usr/bin/gcc
checking for C11 (with atomics support)… yes
checking for CFLAGS -pipe -Wall -Wshadow -Wcast-align -Wpointer-arith -Wwrite-strings -Wundef -Wmissing-prototypes -Wredundant-decls -Wextra – Wno-sign-compare -Wformat-security… yes
checking for CFLAGS -Wold-style-definition… yes
checking for CFLAGS -Wno-pointer-sign… yes
checking for CFLAGS -Werror-implicit-function-declaration… yes
checking for CFLAGS -Wno-unused-parameter… yes
checking for CFLAGS -Wno-missing-field-initializers… yes
checking if CC can generate dependency information… yes
checking byte order… little-endian
checking for DL_LIBS (-ldl -Wl,–export-dynamic)… yes
checking for PTHREAD_LIBS (-lpthread)… yes
checking for realtime scheduling… yes
checking for program pkg-config… no
checking for NCURSES_LIBS (pkg-config)… no
checking for NCURSES_LIBS (-lncursesw)… no
checking for NCURSES_LIBS (pkg-config)… no
checking for NCURSES_LIBS (-lncurses)… no
checking for NCURSES_LIBS (pkg-config)… no
checking for NCURSES_LIBS (-lcurses)… no
configure failed.

The error message “configure: error: could not find (n)curses libs or includes, which are required” indicates that the (n)curses libraries required to build mp3blaster are not installed on your system or is missing. (n)curses is a library for creating text-based user interfaces.

Solution

This ./configure error is caused by the pkg-config and ncurses libraries not being found. The following steps may solve the problem

  1. Install pkg-config:
    • pkg-config is a tool to search for libraries and get compile-time flags. Without it, the configure script will not be able to find the necessary library information.
    • On Debian-based systems (such as Ubuntu), you can install it with the following command

      sudo apt-get update
      sudo apt-get install pkg-config
  2. Installation of the ncurses library:
    • ncurses is a library used to create text-based user interfaces.
    • To install ncurses, run the following command

      sudo apt-get install libncurses5-dev libncursesw5-dev

After these installations are complete, try running ./configure again. This should resolve the problem. If you still encounter errors, further action may be required based on the error message.

sudo apt install pkg-config
sudo apt install libncurses5-dev libncursesw5-dev

Again, run the ./configure script again. I got the following result

mamu@ubuntu22s:~/cmus$ . /configure
checking for program gcc… /usr/bin/gcc
checking for program gcc… /usr/bin/gcc
checking for C11 (with atomics support)… yes
checking for CFLAGS -pipe -Wall -Wshadow -Wcast-align -Wpointer-arith -Wwrite-strings -Wundef -Wmissing-prototypes -Wredundant-decls -Wextra – Wno-sign-compare -Wformat-security… yes
checking for CFLAGS -Wold-style-definition… yes
checking for CFLAGS -Wno-pointer-sign… yes
checking for CFLAGS -Werror-implicit-function-declaration… yes
checking for CFLAGS -Wno-unused-parameter… yes
checking for CFLAGS -Wno-missing-field-initializers… yes
checking if CC can generate dependency information… yes
checking byte order… little-endian
checking for DL_LIBS (-ldl -Wl,–export-dynamic)… yes
checking for PTHREAD_LIBS (-lpthread)… yes
checking for realtime scheduling… yes
checking for program pkg-config… /usr/bin/pkg-config
checking for NCURSES_LIBS (pkg-config)… -lncursesw -ltinfo
checking for NCURSES_CFLAGS (pkg-config)… -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
checking for working ncurses setup… yes
checking for function resizeterm… yes
checking for function use_default_colors… yes
checking for A_ITALIC… yes
checking for ICONV_LIBS (-liconv)… no
assuming libc contains iconv
checking for working iconv… yes
checking for uchar compatible wcwidth… yes
checking for header … yes
checking for function strdup… yes
checking for function strndup… yes
checking for CDDB_LIBS (pkg-config)… no
checking for CDDB_LIBS (-lcddb)… no
checking for CDIO_LIBS (pkg-config)… no
checking for CDIO_LIBS (-lcdio_cdio -lcdio -lm)… no
checking for FLAC_LIBS (pkg-config)… no
checking for FLAC_LIBS (-lFLAC -lm)… no
checking for MAD_LIBS (pkg-config)… no
checking for MAD_LIBS (-lmad -lm)… no
checking for MODPLUG_LIBS (pkg-config)… no
checking for MODPLUG_LIBS (-lmodplug -lstdc -lm)… no
checking for header … no
checking for header … no
checking for VORBIS_LIBS (pkg-config)… no
checking for VORBIS_LIBS (-lvorbisfile -lvorbis -lm -logg)… no
checking for OPUS_LIBS (pkg-config)… no
*** Package opusfile was not found in the pkg-config search path.
*** Perhaps you should add the directory containing opusfile.pc’ *** to the PKG_CONFIG_PATH environment variable *** No package ‘opusfile’ found checking for LIBSYSTEMD_LIBS (pkg-config)… no *** Package libsystemd found no *** Package libsystemd was not found in the pkg-config search path. *** Perhaps you should add the directory containinglibsystemd.pc’
*** to the PKG_CONFIG_PATH environment variable
*** No package ‘libsystemd’ found
checking for LIBSYSTEMD_LIBS (pkg-config)… no
*** Package libelogind was not found in the pkg-config search path.
*** Perhaps you should add the directory containing libelogind.pc’ *** to the PKG_CONFIG_PATH environment variable *** No package ‘libelogind’ found checking for LIBSYSTEMD_LIBS (pkg-config)… no *** Package basu was not found no *** Package basu was not found in the pkg-config search path.
*** to the PKG_CONFIG_PATH environment variable
*** No package ‘basu’ found
checking for WAVPACK_LIBS (pkg-config)… no
checking for WAVPACK_LIBS (-lwavpack)… no
checking for header … no
checking for header … no
checking for header … no
checking for FFMPEG_LIBS (pkg-config)… no
*** Package libavformat was not found in the pkg-config search path.
*** Perhaps you should add the directory containing libavformat.pc’ *** to the PKG_CONFIG_PATH environment variable *** No package ‘libavformat’ found *** Package libavcoding was not found in the pkg-config search path. found *** Package libavcodec was not found in the pkg-config search path.
*** to the PKG_CONFIG_PATH environment variable
*** No package ‘libavcodec’ found
checking for header … no
checking for PULSE_LIBS (pkg-config)… no
*** Package libpulse was not found in the pkg-config search path.
*** Perhaps you should add the directory containing libpulse.pc’ *** to the PKG_CONFIG_PATH environment variable *** No package ‘libpulse’ found checking for ALSA_LIBS (pkg-config)… no *** Package alsa was not found no *** Package alsa was not found in the pkg-config search path. *** Perhaps you should add the directory containingalsa.pc’.
*** to the PKG_CONFIG_PATH environment variable
*** No package ‘alsa’ found
*** Perhaps you should add the directory containingalsa.pc’ ** to the PKG_CONFIG_PATH environment variable ** No package ‘alsa’ found
*** Package jack was not found in the pkg-config search path.
*** Perhaps you should add the directory containing jack.pc’ *** to the PKG_CONFIG_PATH environment variable *** No package ‘jack’ found checking for SAMPLERATE_LIBS (pkg-config)… no *** Package samplerate was found. no *** Package samplerate was not found in the pkg-config search path. *** Perhaps you should add the directory containingsamplerate.pc’.
*** to the PKG_CONFIG_PATH environment variable
*** No package ‘samplerate’ found
checking for AO_LIBS (pkg-config)… no
checking for AO_LIBS (-lao)… no
checking for program artsc-config… no
checking for header … no
checking for SNDIO_LIBS (-lsndio)… no
checking for header … no
checking for ROAR_LIBS (pkg-config)… no
*** Package libroar was not found in the pkg-config search path.
*** Perhaps you should add the directory containing `libroar.pc’
*** to the PKG_CONFIG_PATH environment variable
*** No package ‘libroar’ found
creating config/cdio.h
creating config/mpris.h
creating config/datadir.h
creating config/libdir.h
creating config/debug.h
creating config/tremor.h
creating config/modplug.h
creating config/mpc.h
creating config/mp4.h
creating config/curses.h
creating config/ffmpeg.h
creating config/utils.h
creating config/iconv.h
creating config/wcwidth.h
creating config/samplerate.h
creating config/xmalloc.h
creating config.mk

As far as the ./configure result is concerned, you can run make to start the build.

However, there is a message that some libraries (e.g. libsystemd, libavformat, libavcodec, libpulse, alsa, jack, etc.) were not found. These libraries may be needed for specific features of cmus. For example, support for a particular audio format or support for a particular audio output system.

If you need these features, install the relevant libraries and then run ./configure again. If you do not need those libraries, you can proceed with the build by running make in its current state.

To install the libraries, use commands like the following (depending on which libraries you need)

sudo apt-get install libpulse-dev libalsa-ocaml-dev libjack-jackd2-dev libsamplerate0-dev libao-dev

The above is for installing common audio-related libraries and is applicable in many cases. However, ./configure logs to identify and install the required libraries may be more appropriate . Based on the libraries listed in the ./configure log, consider the following command

sudo apt install libpulse-dev libalsa-ocaml-dev libjack-jackd2-dev libsamplerate0-dev libao-dev libavcodec-dev libavformat-dev libcdio-dev libmad0-dev libmodplug-dev libmpcdec-dev libvorbis-dev libopusfile-dev libsystemd-dev libwavpack-dev libroar-dev

These commands are in the ./configure logs. However, not all libraries are necessarily required; you can choose which libraries to install depending on what features and audio formats you intend to use with cmus.

For example, if you do not need support for a particular audio format, you do not need to install the libraries associated with it (for example, libmad0-dev is associated with MP3 support). However, if you want to take advantage of all the features in the future, it is recommended that you install the library using the above command.

After installation, run ./configure again to confirm that the previous error has been resolved. Now that the problem of missing libraries is gone, enter the make command.

If you run make with some libraries missing, you may get the following results

  1. Successful build:.
    • If the missing libraries do not affect the core functionality of cmus, the build may succeed. In this case, cmus will be installed and basic functionality will be available, but specific features or format support related to the missing library may not be available.
  2. Lack of specific functionality:.
    • For example, if libavcodec is missing, cmus may not support some audio formats. As a result, you may not be able to play audio files in certain file formats.
  3. Build Failure:.
    • Some libraries may be essential in the build of cmus. If such libraries are missing, errors may occur during the make process and the build may not complete.
  4. Later library additions:.
    • If the build is successful but additional functionality is needed later, you may need to install the necessary libraries and build cmus again.

In summary, this means that if there are no missing libraries, the build of cmus may succeed, but not all features will be available. It is recommended that you decide whether or not to install libraries based on whether or not you need specific features.

make is a tool for automating the software build process. Used primarily on UNIX and Linux systems, but also available for other systems such as Windows, the make command performs a series of tasks to compile an executable program from source code and place the associated files in the appropriate locations.

Main Functions and Features

  1. Automatic build:
    • make automates the process of compiling and linking software. This eliminates the need for developers to manually execute complex build commands.
  2. Dependency management:
    • make tracks dependencies between files and recompiles only those files that have changed. This reduces build time.
  3. Use of Makefiles:
    • The build process is directed by a specially formatted file called a Makefile. This file describes the details of the build process, including which files to compile and which commands to execute.
  4. Customizability:
    • The Makefile is customizable and can be tailored to the specific needs of your project.

Typical Use Cases

  • Executing the make command in the source code directory starts the build process according to the Makefile.
  • After the build, it is common to use the make install command to install the program on the system.
make

Some warnings are given.

CC op/roar.lo
op/roar.c: In function ‘op_roar_drop’:.
op/roar.c:213:9: warning: ‘roar_vs_reset_buffer’ is deprecated [-Wdeprecated-declarations].
213 | if (roar_vs_reset_buffer(vss, ROAR_VS_TRUE, ROAR_VS_TRUE, &err) == -1) {
| ^~
In file included from /usr/include/libroar/libroar.h:209,
In file included from /usr/include/libroar/libroar.h:209, from /usr/include/roaraudio.h:137,
In file included from /usr/include/libroar/libroar.h:209, from /usr/include/roaraudio.h:137, from op/roar.c:20:
/usr/include/libroar/vs.h:255:9: note: declared here
255 | int roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error) _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_DEPRECATED;
| ^~~~~~~~
op/roar.c: At top level
op/roar.c:354:46: warning: missing braces around initializer [-Wmissing-braces]
354 | const struct mixer_plugin_ops op_mixer_ops = {
| const struct mixer_plugin_ops = {
LD op/roar.so

The messages displayed are warnings that occurred during the execution of the make command. These warnings indicate, among other things, that the roar_vs_reset_buffer function is deprecated. Deprecated means that it will be removed in a future version or that a better alternative already exists.

This type of warning indicates the following

  1. Does not affect the execution of the code:.
    • Warnings are not compilation errors and do not directly affect the compilation or execution of the program. The compilation process will proceed despite these warnings.
  2. Possible future problems:.
    • However, the use of deprecated functions may lead to future compatibility problems. If the library is updated and the deprecated functions are removed, the program may not work correctly.
  3. Information on code maintenance:.
    • This information is important for software maintainers and developers. In the future, it may be desirable to update the code to an alternative method to these deprecated functions.

At this time, these warnings do not prevent the build process from completing; if the make command completes without error, the next step is to run sudo make install to install the program on your system. However, it is important to take these warnings into account when updating the software in the future.

sudo make install

The sudo make install command is an important command used in the final stage of the software build process. The meaning and purpose of this command is as follows

  1. sudo:
    • sudo ( short for superuser do) is used to execute commands with superuser (usually root user) privileges. Many system files and directories are not accessible with normal user privileges, so sudo is used to gain the necessary privileges.
  2. make install:
    • make install is used to install programs built (compiled) by the make command on the system. During this step, executables, libraries, configuration files, etc. are copied to the appropriate locations on the system (e.g., /usr/local/bin or /usr/local/lib).
    • This process usually requires superuser privileges to copy files to critical directories on the system.
  3. Safety and Convenience:
    • Using sudo make install ensures that the software is available system-wide and that all users can use it.
    • Using sudo also allows you to safely perform operations that may affect critical parts of the system. It should be used with caution, as improper use can affect system stability.

In short, sudo make install is a command used to install built software on the system and access protected areas of the system with proper privileges.

Once the installation is complete, type cmus to start the program. When the program starts, first press the number 7 to see the playback buttons, etc. To quit the program, type the English letter q. Pressing the number 5 will bring up a tree view, and you can use the arrow keys to navigate the rest of the way. I will try to listen to some music as soon as possible. However, an error occurs.

Error: opening audio device: No such device

I was able to play music by typing the following as a command to start the program.

sudo cmus

Next, install ncmpcpp.

On Debian-based Linux distributions such as Ubuntu, ncmpcpp can be installed using the sudo apt install ncmpcpp command. ncmpcpp is a client for the Music Player Daemon (MPD), which is a software application that provides a user interface (CUI) for the Music Player Daemon (MPD). a character user interface (CUI)-based music player.

To install, follow these steps

  1. Open a terminal: .
    • Open an Ubuntu terminal.
  2. Update package list: Open the
    • To get the latest package information, run the following command

      sudo apt update
  3. Install ncmpcpp:
    • Install ncmpcpp with the following command

      sudo apt install ncmpcpp
  4. Confirmation of installation:
    • To verify that the installation completed successfully, you can run the command ncmpcpp --version.

Since ncmpcpp is a client of MPD, the MPD server must be configured and running; if MPD is not already installed, it can be installed using the sudo apt install mpd command as well. MPD will then be configured and ncmpcpp will be able to play music.

Configuration of Music Player Daemon (MPD) is done primarily by editing its configuration file; the basic configuration procedure for Ubuntu and other Linux distributions is as follows

MPD Configuration Procedure

  1. Install MPD: 1.
    • If it is not already installed, install MPD using the following command. Immediately after installation, the service was not started. In addition to the installation, the service was started. Also, when the PC was rebooted, the service was stopped.

      sudo apt install mpd
      sudo systemctl start mpd
  2. Edit the configuration file:.
    • The MPD configuration file is usually located in /etc/mpd.conf. Edit this file to configure MPD behavior.
    • To edit the configuration file, use your favorite text editor (e.g., sudo nano /etc/mpd.conf ).
  3. Main configuration options:.
    • music_directory: Specify the directory where MPD will look for music files.

      music_directory "/path/to/your/music"
    • playlist_directory: the directory where MPD stores playlists.

      playlist_directory "/path/to/your/playlists"
    • database: Location of MPD’s music database files.

      db_file "/var/lib/mpd/tag_cache"
    • Log file: Location of MPD’s log file.

      log_file "/var/log/mpd/mpd.log"
    • Audio Output: Settings for audio output. In most cases the default settings are sufficient, but can be adjusted as needed.
  4. Apply settings:.
    • After changing the settings, restart MPD to apply the new settings.

      sudo systemctl restart mpd
  5. Check the permissions:.
    • Verify that the proper permissions are set so that MPD can access music and configuration files.

NOTES.

  • The settings in the /etc/mpd.conf file affect the entire system. Edit carefully.
  • MPD is a daemon that runs in the background, so the service must be restarted after any configuration changes.
  • MPD can also operate over the network, so you can configure network-related settings as needed. For example, if MPD is installed on a remote PC with an SSH connection, the sound will usually play on the remote PC; it will also be possible to play the sound on the PC with the SSH connection.

Practice

First, check the operation with the client and server installed on the same PC as above. The music files should be placed in the proper location; when the ncmpcpp command is entered, the volume is set to n/a and cannot be played.

So edit the mpd.conf file.

sudo vi /etc/mpd.conf

The edited location is shown below. I just removed the # at the beginning because it was treated as a comment at first.

audio_output {
    type "alsa"
    name "My ALSA Device"
    mixer_type "hardware"
}

Restart MPD to apply the new configuration.

sudo systemctl restart mpd

This time, the volume n/a problem is resolved and I can now listen to music. However, there is still a problem with the volume adjustment not being reflected. There is also the problem of sometimes no sound, so the above description may be incorrect. The workaround is to use the aplay command to output device information. We will show that later.

If you connect to a remote PC via SSH and manipulate the Music Player Daemon (MPD) to play music there, the music will be played from the remote PC’s audio output (i.e., its speakers or connected audio devices).

If you want to listen to music on a PC connected via SSH (the local PC), you must take one of the following approaches

  1. Audio Streaming:.
    • The music is delivered as HTTP streaming on the remote PC, and the local PC catches and plays the stream. This requires changing the MPD settings to enable HTTP streaming.
  2. PulseAudio Network Transfer:.
    • Configure PulseAudio to transfer audio over the network from the remote PC to the local PC. This is somewhat complicated and requires that PulseAudio be installed on both PCs.
  3. File Transfer:.
    • Use SSH to transfer the music file itself to a local PC for local playback. This is not streaming, but is an effective way to listen to music on a file basis.

In the mpd.conf file, the music directory was initially /var/lib/mpd/music, so place the music file here or change the location and save it.

There are multiple ways to check if an audio device is recognized by the system in Ubuntu. The most common method is to use a command line tool. Here are a few ways to do this

1. Using the aplay command

aplay is part of the ALSA (Advanced Linux Sound Architecture) sound card driver and is used to list audio device information.

  • To get a list of audio devices, run the following command

    aplay -l

    This command displays all sound cards and digital audio devices connected to the system.

2. Using the arecord command

The arecord command is for recording, but it can also list available capture devices (e.g. microphones).

  • To get a list of capture devices, run the following command

    arecord -l

3. Using the pacmd command

If you are using PulseAudio, you can use the pacmd command to get information about audio devices.

  • To view information about all PulseAudio devices, run the following command

    pacmd list-sinks

    This will display information about output devices (speakers, headphones, etc.).

    pacmd list-sources

    This will display information about input devices (microphones, etc.).

These commands are intended to verify that the audio devices on the system are properly recognized. If an audio device is not listed or has problems, you may need to reinstall the device driver or check the configuration. if the commands to check audio device information are “not present” in Ubuntu, then those tools If the commands to check audio device information “do not exist” in Ubuntu, it is possible that these tools are not installed. Here is how to install these tools

1. Installing the ALSA tools ( aplay, arecord )

The ALSA utilities are not installed by default in Ubuntu, as I checked. If it does not exist, it can be installed with the following command

sudo apt-get install alsa-utils

This command will install ALSA-related tools such as aplay, arecord, etc.

2. Installation of PulseAudio tools ( pacmd)

PulseAudio related tools are included in the PulseAudio package. If you do not have PulseAudio installed, you can install it with the following command

sudo apt-get install pulseaudio

Actual work

mamu@ubuntu22s:~$ aplay -l
aplay: device_list:274: no soundcards found…
mamu@ubuntu22s:~$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
Subdevices: 1/1
Subdevice #0: subdevice #0

The above installs the missing aplay -l command. aplay -l showed no sound card, so I added sudo and entered the command. This brought up the device.

Based on the output of the aplay -l command, the audio output settings in the mpd.conf file of MPD (Music Player Daemon) are as follows

MPD Settings

The output shows that the available audio devices are card 0 and device 0. With this information, configure the audio output section of the mpd.conf file as follows

audio_output {
    type        "alsa"
    name        "Intel 82801AA-ICH"
    device      "hw:0,0"    # card 0, device 0
    mixer_type  "software"  # use software mixer
}

This configuration uses ALSA (Advanced Linux Sound Architecture) to output audio to the specified audio device. mixer_type is set to software, so MPD controls the volume at the software level The mixer_type is set to software, so MPD controls the volume at the software level. Then, after this description, restarting mpd enabled the volume control and solved the problem of sometimes no sound.

Location of the mpd.conf file

The mpd.conf file is usually located in one of the following locations

  • /etc/mpd.conf
  • ~/.mpd/mpd.conf
  • Or, if MPD is started in a specific custom path, that path

You will need to open an editor with the appropriate access rights (usually root) to edit it.

sudo vi /etc/mpd.conf

Restart MPD

After making changes to the configuration, MPD must be restarted to reflect the new settings.

sudo systemctl restart mpd

MPD will now play audio using the new audio output settings. I was also able to adjust the volume, so it is probably correct. If you do not hear any sound, you will need to check your audio device settings and system audio settings.

Execution time of make and make install commands

The execution time of the make and make install commands varies based on the tasks they perform.

The make command

  • The make command is used to build an executable program (or other artifact of software) from source code.
  • This process involves a series of build steps, such as compiling and linking source code, and can be time consuming depending on the size and complexity of the project.
  • For large projects or those with many dependencies, the make command may take a reasonable amount of time to execute.

The make install Command

  • The make install command is used to install programs built by make on the system.
  • This process includes copying compiled binary files, placing configuration files, and installing libraries.
  • Typically, make install takes less time than make. This is because the build process is already complete and simply copies the files to their proper locations.

Conclusion

  • In general, the make command (build process) takes longer than the make install command (installation process).
  • However, this may vary depending on the size and complexity of the project and the performance of the system.
  • The execution time of make install is usually shorter, but depends on the system speed and disk write speed.
Please share if you like it!
TOC