Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ALSA -- Can't control volume via keyboard
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
stvoffutt
n00b
n00b


Joined: 14 Apr 2017
Posts: 7

PostPosted: Thu Jun 15, 2017 12:14 am    Post subject: ALSA -- Can't control volume via keyboard Reply with quote

I am struggling with ALSA and have exhausted quite a few google searches. I have my sound card connected to a receiver via SPDIF and I have sound. However, I am not able to control the sound via the keyboard. I am in KDE and when I press my hotkey to increase/decrease the volume, the on-screen notification comes up saying the volume is changing. In alsamixer I can see the volume level for PCM being changed but the volume level I am hearing is not changing. Here is my ~/.asoundrc:
Code:

pcm.!spdif {
     type hw
     card 0
     device 1
}
#
pcm.!default {
     type plug
     slave {
           pcm "spdif"
     }
}


Here is the output of aplay -l
Code:

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 0: ALC1150 Analog [ALC1150 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 1: ALC1150 Digital [ALC1150 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: Generic Digital [Generic Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


Here is output of sudo lspci | grep -i audio
Code:

00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller (rev 01)
01:00.1 Audio device: NVIDIA Corporation Device 0fba (rev a1)


I've followed the ALSA gentoo post here (https://wiki.gentoo.org/wiki/ALSA) but have had no luck in controlling volume via keyboard. All help is appreciated.
Back to top
View user's profile Send private message
Telemin
l33t
l33t


Joined: 25 Aug 2005
Posts: 734
Location: Glasgow, UK

PostPosted: Thu Jun 15, 2017 10:01 am    Post subject: Reply with quote

This is because S/PDIF does not have an associated hardware volume control and you are likely still controlling the analogue output mixer, indeed if you also set the ctl.!default to point to card 0 device 1 you will likely find that your volume control disappears. You can "fix" this, and give yourself volume control on the spdif output by using the softvol plugin. you will likely also want to use the dmix plugin to allow you to source sound from multiple applications at the same time.

For dmix see: https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Dmix
and http://alsa.opensrc.org/Dmix

For softvol see: http://alsa.opensrc.org/Softvol

-Telemin-
_________________
The Geek formerly known as -Freestyling-
When you feel your problem has been solved please add [Solved] to the topic title.
Please adopt an unanswered post
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7041
Location: Saint Amant, Acadiana

PostPosted: Thu Jun 15, 2017 1:42 pm    Post subject: Reply with quote

The idea of digital passthrough is to preserve the quality of sound. No audiophile would want to change SPDIF volume, because this means resampling and loss of quality.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Telemin
l33t
l33t


Joined: 25 Aug 2005
Posts: 734
Location: Glasgow, UK

PostPosted: Thu Jun 15, 2017 3:18 pm    Post subject: Reply with quote

Jaglover wrote:
The idea of digital passthrough is to preserve the quality of sound. No audiophile would want to change SPDIF volume, because this means resampling and loss of quality.


Meh. I seriously doubt the difference will be noticeable. I listen to a lot of music, and appreciate good quality equipment, but the "high end" audio community is victim to so much snake oil, especially when it comes to bitrates and resampling. The XIPH guys have plenty to say on this issue that makes a lot of sense see e.g https://people.xiph.org/~xiphmont/demo/neil-young.html. I can also personally attest from my daily life as a mathematical physicist dealing with fourier series and resampling of data all the time: resampling is not an issue, you can take 44.1k sample, sinc-resample at 48k and then sinc-resample that at 44.1k again and get back exactly what you started with so good resampling doesn't distort the data. For my own interest I also ABX tested dmix+softvol against straight passthrough when I first got my nice DAC (which is tonnes better than intel HDA, but mostly just because it has good grounding and an inaudible noise floor). I can't tell the difference, so I stuck with the setup that allows more flexibility. Objective tests (see HA for good methodology) usually find that perceived differences are the issue with this kind of thing. I even *gasp* encode my audio in opus for my portable devices, and the resample from 44.1k to 48k is transparent to my ears, only the bitrate matters there, and perceptual transparency there starts at about 192kb/s.

OP: let me know if you are getting anywhere with the alsa config. I will try to remember to post something more concretely useful when I get home.

-Telemin-
_________________
The Geek formerly known as -Freestyling-
When you feel your problem has been solved please add [Solved] to the topic title.
Please adopt an unanswered post
Back to top
View user's profile Send private message
stvoffutt
n00b
n00b


Joined: 14 Apr 2017
Posts: 7

PostPosted: Fri Jun 16, 2017 1:54 am    Post subject: Reply with quote

Thank you for the kind reply. To be honest, all of this is completely foreign to me. I have read the gentoo page on ALSA and came away with more questions than answers. So what I gather from the above is that I need to use an ALSA plugin for the volume control. Does my configuration look correct above? First I would like to make sure that is sound (no pun intended). The copy and paste solution from ArchWiki was no help. That is, I am still unable to control volume via keyboard. I am still reading through the other links you mentioned. Before I go farther though, I would like to make sure the configuration in ~/.asoundrc mentioned previously is correct. That will help me understand what is going on in later steps.
Back to top
View user's profile Send private message
Telemin
l33t
l33t


Joined: 25 Aug 2005
Posts: 734
Location: Glasgow, UK

PostPosted: Sat Jun 17, 2017 8:50 am    Post subject: Reply with quote

Hi there, so the config you have at the top is quite correct, as evidenced by the fact that you have your spdif output working as default, but to get volume control working you need to chain in the softvol filter correctly. I am not sure at first inspection why the arch snippet doesn't work, but it may have to do with differences in shipped default configs.

In any case, you just need to add the dmix and softvol filters to the chain, in between the spdif output at the bottom and the default device entry at the top. (FYI prepending a ! to the device name instructs alsa to overwrite any existing config node with that name, so while !spdif was not in any sense wrong, as a general philosophy I suggest removing such things unless needed because that kind of thing can come back to bite you later.)

A minimal config should look something like this.

Code:

pcm.spdifdmix{
    type dmix
    slave.pcm "hw:0,1"
}
 
pcm.softvol{
    type softvol
    slave.pcm "spdifdmix"
    control.name "Master"
    control.card 0
}

pcm.!default {
     type plug
     slave.pcm "softvol"
}

_________________
The Geek formerly known as -Freestyling-
When you feel your problem has been solved please add [Solved] to the topic title.
Please adopt an unanswered post
Back to top
View user's profile Send private message
stvoffutt
n00b
n00b


Joined: 14 Apr 2017
Posts: 7

PostPosted: Sun Jun 25, 2017 8:09 pm    Post subject: Reply with quote

I was able to fix the issue with you're solution. However it seems as though I also had PulseAudio installed and needed to remerge with PulseAudio use flag set. I guess Skype pulled in PulseAudio and I didn't notice it. :oops: Thank you so much for you're help!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum