📜 ⬆️ ⬇️

Sound settings in Ubuntu

I have a hobby - writing music. Therefore, after installing a fresh version of Ubuntu on my laptop, I needed to adjust the sound a little more subtly than regular users. To my regret, I didn’t do it. Nevertheless, I want to talk about the steps that brought me a little closer to the result. I hope that someone will save time. Or maybe with the help of readers I can go further. If you are using Linux and can say the words sidechain and compression in one meaningful sentence - Welcome!



Briefly


To begin, in more detail about the essence of the problem: there is a laptop Asus N55 with Kubuntu 17.10 on board. It is necessary to achieve the same configuration that can be obtained on Windows:


Configuration
  • Without a subwoofer connection, the driver works in 2.0 mode
  • When a subwoofer is connected, the driver switches to 2.1 mode. With this switch, frequency filters are applied to the channels - LF for the subwoofer and HF for the speakers
  • When headphones are connected, the audio output switches to them, the output to the speakers / subwoofer pauses
  • If you need low latency, you can switch to a mode that allows exclusive sound card capture by selecting a different driver.

Immediately after installation, we get a non-working subwoofer and non-working headphones.
As a result of my experiences, I managed to achieve the following system state:



For acquaintance with LMMS ( with which, as it turned out, it is impossible to work normally, but this is a separate topic ), this is in general enough.
If you also got to this state, then I will not tell you anything new with this article.


Overview


Have you ever thought about how a Linux sound system works? So I am not - usually the sound was either not needed, or somehow it worked, the speakers were playing - there was no talk about connecting the subwoofer or headphones.
Looks like now is the time to find out a little more about it. Googling showed the following picture:




Thought the first: we delete PulseAudio - we put JACK


Few people say that PulseAudio is the de facto standard for sound integration, at least in Ubuntu. Virtually any software that makes sounds will most likely use the PulseAudio API. FF, for example, to support JACK must be separately collected .
Therefore, you should not delete PulseAudio if you are not sure that everything you use will know how to work with JACK. Apparently, therefore, there is another version of the integration of Jack-PulseAudio. But I refused this option because to work on software where low latency is required, I am satisfied with exclusive access through ALSA (under Windows, it works the same way - where low latency is needed, exclusive access is requested). Maybe when it comes to installing some Ardour , I will have to go back to this option.


Thought two: ALSA and PulseAudio need to be customized


So, well, JACK is not needed. So, to make it work, I need to configure the ALSA component for my card and integrate it with PulseAudio


PulseAudio


Here we are offered out of the box just such a UI console



It seems to me that there is no need for such an explanation tool. After applying the settings, you can immediately hear the changes, so try.
Another amarao advises to pay attention to pactl / pacmd. If I get there, I'll write what's what with these utilities.


ALSA Diagnostics


First of all, at least some diagnostic tools will be needed - this is the alsa-utils package.
sudo apt install alsa-utils
Now let's see how our equipment sees the system.
aplay -l



In addition, the settings must be checked. For these purposes, the speaker-test utility was found.



calling speaker-test --help will show what the utility can do, but I am particularly interested in the configuration
speaker-test -Dplughw:1,0 -c4



ALSA Setup


Here and here it is advised to learn dmix - this is the channel mixer module in ALSA - I will watch


alsamixer


alsamixer is a pseudo graphic mixer interface. Half the tuning tips are limited to this utility. And indeed, it is this utility that will often show when the channel has suddenly closed down or its volume has been reset.



But the setting in the mixer did not give the result.


hdajacksensetest


The next useful utility is hdajacksensetest. Shows which connectors detect external device connections.



OK, I see that my external subwoofer is connected to port 0x1a.
Let's try to find out how to explain to the map where to put the LFO.


hdajackretask


Most tips for setting up mapping point to the hdajackretask utility:



Here everything seems to be clear - there are ports, there is a mapping. Unfortunately, no manipulations with port 0x1a resulted in success.
Maybe after setting you need to restart services explicitly?
sudo alsa force-reload
No, look further.


HDAAnalyzer


To configure the mapping there is another utility:
You can download it as a python-script (!!!) here .



This thing looks like a pumped-up version of hdajackretask - it even knows how to build a port routing scheme graphically. But experiments with this thing also did not lead to anything except the complete loss of sound.
I didn’t find any configuration guide, so I tried by trial and error.


Edit Configs


I did not find other utilities that can help in setting up the sound. It remains to try only one thing - to search and edit configs. With the help of Google and find, I managed to find several locations.


PulseAudio


/usr/share/pulseaudio
in the alsa-mixer folder there are configs here. Since Pulseaudio is more or less working here, I did not touch anything.
/etc/pulse/daemon.conf
As I understand it, these are the settings of the pulseaudio service - one of the few configs, the changes in which affect something. It is here settings:
enable-lfe-remixing = yes
lfe-crossover-freq = 200
I made my subwoofer from Pulseaudio sound as it should. For lfe-crossover-freq 200, this is a clear cut-off frequency in hertz.
But then it becomes obvious that it is not possible to adjust something more complicated (when connecting headphones to stop sending bass to the subwoofer).


Alsa


/usr/share/alsa/*
There are several shell scripts here, incl. alsa-info.sh, which can be useful in preparing a defect in the tracker, etc.
and there are some configs in the pcm folder, which I could not figure out:


Config example: center_lfe.conf
 pcm.!center_lfe { @args [ CARD DEV ] @args.CARD { type string default { @func getenv vars [ ALSA_CENTER_LFE_CARD ALSA_PCM_CARD ALSA_CARD ] default { @func refer name defaults.pcm.center_lfe.card } } } @args.DEV { type integer default { @func igetenv vars [ ALSA_CENTER_LFE_DEVICE ] default { @func refer name defaults.pcm.center_lfe.device } } } type empty slave.pcm { @func refer name { @func concat strings [ "cards." { @func card_driver card $CARD } ".pcm.center_lfe." $DEV ":CARD=" $CARD ] } } hint { show { @func refer name defaults.namehint.basic } description "Center and Subwoofer speakers" device $DEV } } 

I did not dare touch them yet.
/etc/modprobe.d/alsa-base.conf is the second proven useful config. This line, added to the bottom of the config, really made ALSA headphones work:
options snd-hda-intel model=auto,auto probe_mask=1
Quite a lot has been written about the configuration of this config. One of his goals, as I understood it, is to match codecs (model) to devices. Codecs are ... some preset mappings ... There is a sign (there is a copy here ). I think in most cases this is really enough for standard configurations.
There are described models for different controllers. But if they do not work for you, then you are recommended to add your configuration.
It sounds cool, but here I have to make 2 remarks:



By the way, in /sys/class/sound/hwC1D0/ - the files are already directly devices, i.e. As I understand it, hdajackretask works with these files. Here, too, you can probably do something useful if you know where to write.


findings


I have it all. After editing in daemon.conf and alsa-base.conf , I got the result described at the beginning. This is all that I could help you in setting up the sound for Ubuntu.
I received most of the information here, and the ALSA documentation on Arch Linux .
As I said, after the work done, there are more questions than answers:



The general conclusion that I can draw from the results of the work done is: in general, it is clear that if the GUI, for example, the community is more or less involved, the audio subsystem is clearly overboard.
To date, the possibility of using this subsystem can not withstand any competition with counterparts in other popular operating systems.
Such annoying problems, such as a broken subwoofer or headphones, or the absence of a low-pass filter for a subwoofer, make you think again before discarding the pre-installed software. After all, no one wants to receive less recoil from their hardware because of the curvature of the OS.


ps If there are any other tools, manuals about which it is useful to know when setting up the sound - write, I will add them to the article
ws Regarding my specific problem, I started the ticket, the owners of the Asus N55 are well-known:
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1733029


')

Source: https://habr.com/ru/post/343718/


All Articles