How to control SPDIF volume with master volume?

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read this

How to control SPDIF volume with master volume?

Postby nashimus on Wed Mar 20, 2013 12:49 pm

I'm not able to control the volume for SPDIF (PCM) using my master volume control.

I know this is possible because I was doing this exact thing in archlinux a couple weeks ago. I just can't remember what I put in /etc/asound.conf to make it happen. I usually save solutions to my problems in my favorites, but I failed to do so with this particular issue... Also, I cannot seem to find the same article. After reading up on customizing asound.conf; I haven't found anything that looks familiar and I'v finally resigned to actually posting for help, :/ since I can't seem to figure this one out.

I'm currently running Linux Mint 14 64-bit, that was installed from the cinnamon media, but I've added MATE and and XFCE. I've decided to stick with XFCE since I like that, although that info probably isn't that relevant.

aplay -l output:

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC889 Analog [ALC889 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC889 Digital [ALC889 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0

When I run pavucontrol, my output device is "Built-in Audio Digital Stereo (IEC958) and the selected port is "Digital Output (S/PDIF), with PCM checked.

In the pavucontrol Configuration tab I can change my Built-in Audio Profile from "Digital Stereo (IEC 958) Output + Analog Stereo Input" to "Analog Stereo Duplex" and the master volume control does work, but only for analog output.

Current contents of /etc/asound.conf, which includes some of the stuff I've tried that doesn't work:

pcm.!default {
type hw
card 0
# mixer_device "default"
# mixer_control "Master"
}

ctl.!default {
type hw
card 0
# mixer_device "default"
# mixer_control "Master"
}


#Convert to pulse:

#pcm.pulse {
# type pulse
#}
#ctl.pulse {
# type pulse
#}
#pcm.!default {
# type pulse
#}
#ctl.!default {
# type pulse
#}

#Testing:
#pcm.!default {

# type plug
# slave {
# pcm "iec958"
# }

#}


Any help on this would be greatly appreciated. I know I need to make a change in /etc/asound.conf or ~/.asoundrc but I just can't remember how to tell SPDIF/PCM to use the main mixer.

Thanks for any suggestions!

nashimus
nashimus
Level 1
Level 1
 
Posts: 4
Joined: Fri Mar 01, 2013 4:36 pm

Linux Mint is funded by ads and donations.
 

Re: How to control SPDIF volume with master volume?

Postby nashimus on Sun Mar 24, 2013 12:32 am

I found a way to accomplish this. :D Now I can control the volume of my studio monitors without getting up to adjust the volume each speaker individually! Hope this helps someone else having this unpleasant issue.

asound.conf:
Code: Select all
pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}

pcm.phononpulse {
  type plug
  slave.pcm {
    type pulse
  }
  hint {
    show on
    description "PulseAudio"
  }
}


Then I bound these scripts to my media keys:
https://aur.archlinux.org/packages/pulseaudio_ctl/

Excerpt from vol_down (showing change in increment from 5% to 1%):
Code: Select all
#!/bin/bash
# Credit to Roland Latour
# http://www.freak-search.com/en/thread/4707111/q_volume_control,_xfce

# lower volume by 1%

# Find default sink
sink=$(pacmd info|grep "Default sink name"|awk '{print $4}')

# Now we need to find volume of default sink
# get line# of start of definition for default sink (plus 1, actually)
let line=$(pacmd list-sinks|grep -n $sink|sed '{s/://}'|awk '{print $1}')

# index down a bit for volume line
let line=($line + 6)
volume=$(pacmd list-sinks|awk 'NR=="'"$line"'"{print $3}'|sed '{s/%//}')

# pacmd returns volume as %, but demands setting as range: 0-65535
let volume=($volume * 65536);let volume=($volume / 100)
[b]#let volume=($volume - 3276) #5%
let volume=($volume - 655) #1%[/b]
[[ $volume -lt 0 ]] && let volume=0
pacmd set-sink-volume $sink $volume > /dev/null 2>&1


-nashimus
nashimus
Level 1
Level 1
 
Posts: 4
Joined: Fri Mar 01, 2013 4:36 pm


Return to Sound, Multimedia, & Codecs

Who is online

Users browsing this forum: No registered users and 10 guests