How can I set the CD audio volume in Linux?

Posted by user1296362 on Super User See other posts from Super User or by user1296362
Published on 2012-05-28T15:00:30Z Indexed on 2012/05/30 16:45 UTC
Read the original article Hit count: 337

In Windows 7 Control Panel -> Sound -> Sound Properties window there's an slider for setting CD Audio volume:

enter image description here

And it's pretty strange that I can't find corresponding one in generic Linux mixers: alsamixer or amixer.

I connected a CD drive to try to set CD audio volume with cdcd (CD Player):

$ cdcd setvol 0
Invalid volume

It isn't actually an invalid volume, it is because ioctl() call fails. I found that out after searching and changing a bit the source code of this utility (in the libcdaudio):

--- cdaudio.c.orig  2004-09-09 06:26:20.000000000 +0600
+++ cdaudio.c   2012-05-30 21:34:34.167915521 +0600
@@ -578,8 +578,10 @@
   cdvol_data.CDVOLCTRL_BACK_RIGHT_SELECT = CDAUDIO_MAX_VOLUME;
 #endif

-  if(ioctl(cd_desc, CDAUDIO_SET_VOLUME, &cdvol) < 0)
-    return -1;
+  if(ioctl(cd_desc, CDAUDIO_SET_VOLUME, &cdvol) < 0) {
+     printf("*** cd_set_volume: ioctl() returned error\n");
+     return -1;
+  }

   return 0;
 }

By the way cdcd's get volume command yields rather weird output:

         Left  Right
Front 1281734864  32767
Back        0      0

Also I tried aumix:

$ aumix -c 0

But all with no success.

I read from this manual — http://tldp.org/HOWTO/Alsa-sound-6.html (section 6.2 The mixer) that CD channel can present in amixer output. Maybe some drivers for sound card are missing in my Ubuntu 12.04 LTS installation. Though I don't think it's the case:

$ lsmod | grep snd
snd_mixer_oss          22602  0 
snd_hda_codec_hdmi     32474  1 
snd_hda_codec_realtek   223867  1 
snd_hda_intel          33773  4 
snd_hda_codec         127706  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hwdep              13668  1 snd_hda_codec
snd_pcm                97188  3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
snd_seq_midi           13324  0 
snd_rawmidi            30748  1 snd_seq_midi
snd_seq_midi_event     14899  1 snd_seq_midi
snd_seq                61896  2 snd_seq_midi,snd_seq_midi_event
snd_timer              29990  2 snd_pcm,snd_seq
snd_seq_device         14540  3 snd_seq_midi,snd_rawmidi,snd_seq
snd                    78855  19 snd_mixer_oss,snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep ,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore              15091  1 snd
snd_page_alloc         18529  2 snd_hda_intel,snd_pcm

All I need is just mute or set to 0 volume level of CD Audio channel, like I did in Windows 7, to get rid of sibilant noise in the speakers.

© Super User or respective owner

Related posts about linux

Related posts about audio