Linux software mixing
Dec 31, 2011 at 5:33 PM Thread Starter Post #1 of 12

shrimants

1000+ Head-Fier
Joined
Nov 8, 2006
Posts
1,176
Likes
81
I have AMB Gamma 2 F++. Since it uses PCM2707 chip, I cant control the PCM volume for it through linux or windows. The obvious solution is to use a preamp but that gets very expensive, 59 bucks per active device, which means about 120 bucks just for 2 volume knobs and 2 mute switches.

I'm wondering if you guys know of a software volume layer in linux or in windows that can provide me with software volume control before the data hits the USB port. I know linux has dmix but I cannot get that to work for the life of me. There is also pulseaudio but it seems that I would need to configure each of my apps individually for that.

If someone is using a sound card with PCM2707+alsa, can you post your .asoundrc? Also, if you know of a windows program that enables me to control volume a bit easier (ie leave all applications at 100% and use windows volume only, or keep applications at 50% and use windows' volume) I would be much obliged.

Also, I made a thread in DIY regarding passive preamps. I posted a picture of what I'm thinking of but I'm not entirely sure if that will work or not.
 
Jan 5, 2012 at 1:26 AM Post #2 of 12
Am I right in understanding that in Linux you can hear sound in all your applications, but you just don't have a PCM control when you run alsamixer and select your card (F6)?

Do you mind showing the output of cat /proc/asound/modules, cat /proc/asound/cards and aplay -L?

If you're just missing a PCM control I suspect something like step 5 from the Dmix wiki is all you need, though I know you mentioned having problems with dmix before.
 
Jan 5, 2012 at 9:41 PM Post #3 of 12
You are correct. I can get the sound card working and I can set it as default but I can't control it's volume through dmix. I'll look at step 5 in the smock wiki. I'll also pay my output when I get to my computer again
 
Jan 6, 2012 at 7:20 PM Post #4 of 12
[shrimants@Sheila ~]$ cat /proc/asound/modules
0 snd_hda_intel
1 snd_usb_audio

[shrimants@Sheila ~]$ cat /proc/asound/cards
0 [Intel ]: HDA-Intel - HDA Intel
HDA Intel at 0xfebfc000 irq 45
1 [DAC ]: USB-Audio - USB Audio DAC
Burr-Brown from TI USB Audio DAC at usb-0000:00:1d.0-2, full speed

[shrimants@Sheila ~]$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
front:CARD=Intel,DEV=0
HDA Intel, STAC92xx Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, STAC92xx Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, STAC92xx Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, STAC92xx Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, STAC92xx Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, STAC92xx Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, STAC92xx Digital
IEC958 (S/PDIF) Digital Audio Output
front:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
Front speakers
surround40:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
IEC958 (S/PDIF) Digital Audio Output
[shrimants@Sheila ~]$
 
Jan 6, 2012 at 8:04 PM Post #5 of 12
Is alsa-lib installed from your distro repo?  
Can you control your volume via amixer?
Do the following terminal commands work for you? 
 
amixer -c 0 -- sset Master playback 5dB+
amixer -c 0 -- sset Master playback 5dB-
amixer -c 0 -- sset Master playback mute
amixer -c 0 -- sset Master playback unmute
 
 
Jan 6, 2012 at 9:55 PM Post #6 of 12
alsa-lib is installed. If I use my onboard intel sound card, I have full control with either master or PCM. In this case I usually keep PCM at 100% and control using master, or vice versa. With the Gamma2, it uses a different sort of audio interface. I cannot control PCM whatsoever. Issuing PCM +/- commands works and I can lower the volume of the PCM channel but it has no effect on the sound itself.

What I need to do instead is control application volume before it hits PCM, hence the need for dmix/software volume control. Without it, things like youtube are way too loud and I need to keep the volume slider 1 pixel short of mute in order to have it at a listenable volume.

I ended up going ahead with ordering a couple alps potentiometers, some headers, and an easy-mount circuit board for it. This should make wiring everything quite simple and all I'll need to do is provide a classy case design for the whole thing. If nothing else, i can just live with the volume being excessively loud going to the DAC and have that hardware passive preamp as a volume control before my speakers/sub.

here is by .asoundrc, btw. This works as far as keeping the Gamma2 as a usb DAC and using as default, and then auto switching to the intel card if the USB DAC isnt recognized. It also switches back to the USB dac if I plug it in automatically, but if there was an application using sound at that point that application must be restarted for the changes to take effect.

defaults.pcm.rate_converter "samplerate_best"

pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
 
Jan 6, 2012 at 11:53 PM Post #7 of 12
Thanks for the info shrimants. This should be your ~/.asoundrc file:

Code:
  pcm.softvol { type softvol slave { pcm "front:DAC" } control { name "Master" # This can be called whatever you like. card 0 } }
We just told ALSA to control your DAC volume using the softvol device (built-in by ALSA). front:DAC was taken from your output of aplay -L as the name of your 2-channel output device.

card 0 tells ALSA that the new control should use your default soundcard. In troubleshooting your issue using my FiiO E10 (which also uses the snd_usb_audio module) I wasn't able to get dmix working using a !default statement in .asoundrc.

The latest version of ALSA (1.0.24.1 at the time of writing) will dmix the default soundcard automatically, letting multiple applications output sound at the same time. As a workaround to ensure that your Gamma2 is the default card, you can use a parameter for snd_usb_audio setting it as default whenever it's loaded. If your Linux distro has an /etc/modprobe.d/ directory (as root) create a file called sound.conf there that reads:

Code:
  options snd_usb_audio index=0 options snd_hda_intel index=1 # Optional. Just showing that you can create a list # of your cards in order of preference like this.
If your distro doesn't use /etc/modprobe.d/ it might instead have a file called /etc/modprobe.conf. You should be able to place the above parameters there.

If all else fails you can manually remove all your ALSA modules then re-add only snd_usb_audio (so that it's forced to be default) when your computer boots. Slackware has a file called /etc/rc.d/rc.local for the purpose of executing commands at startup but your distro may use something else. The contents of such a file would look like:

Code:
  rmmod snd_usb_audio rmmod snd_hda_intel modprobe snd_usb_audio
After restarting your computer run the command cat /proc/asound/cards to verify that your Gamma2 is the default. Then try speaker-test -D softvol -c 2 -t wav to test sound. Once you've run that command your new volume control should be visible with alsamixer.

After all that you may find that even with your volume control at 100% it's not loud enough. Here's a short example of how to create an ALSA pre-amp though I haven't tried it myself.

For more on softvol this ALSA wiki page was really helpful.
 
Jan 7, 2012 at 12:37 AM Post #8 of 12
I have ubuntu 11.10 which supports sound from a Zotac mini-itx just fine... except when the Fubar DAC is connected.  Then it only works with the VLC media player.
 
Jan 7, 2012 at 2:10 AM Post #9 of 12

 
Quote:
I have ubuntu 11.10 which supports sound from a Zotac mini-itx just fine... except when the Fubar DAC is connected.  Then it only works with the VLC media player.


Ubuntu uses PulseAudio as its default sound server.  You may want to reinstall its components to make sure you're not missing anything:

Code:
  sudo apt-get install libasound2-plugins "pulseaudio-*" paman padevchooser paprefs pavucontrol pavumeter
Could you then report what audio output plugin VLC is using? You ought to see it under Tools -> Preferences -> Audio -> Output from the menu. If it's set to Default try changing it to ALSA, replay your file and see if you can hear anything. Then try it again with PulseAudio.
 
Jan 7, 2012 at 11:55 PM Post #10 of 12
Alright, I've tried what was suggested and still no luck. I've rebooted and such and I keep getting the error "Unable to find simple control 'Master', 0".

The sound.conf option has worked. Now USB audio is my default device and HDA Intel is my card "1"/fallback. The asoundrc is still wrong, however. I'm using archlinux with openbox. My volume frontend is "volwheel" though i'm open to suggestions for a different program. I was hoping to avoid having to mess around with Pulseaudio because I'd have to configure every single application independently and the thought of having to redo it if my system collapses makes me shudder.

i do have parts for a passive preamp so I suppose its not too big of a deal now that USB is at least my default sound card. I just have to figure out how to make perf board accomodate the gigantic pins of my RCA jacks. I'm pretty sure I can simply drill the perf board to size but I dont want to ruin the perf board by accident.

EDIT: Alright, I found the source of that error in my main TTY1. Its coming from volwheel, which was attempting to control the volume of the "master" channel. The volume control still isnt there, however. I think the only way I'll be able to get volume control is via hardware methods or via pulseaudio, which runs as a sort of server before actual hardware interaction. Dmix seems to be unable to deal with this sound chip (PCM2707). Thanks anyways for the help with setting default sound cards. That is a way better solution that the asoundrc !default statements IMO.
 
Jan 8, 2012 at 6:42 PM Post #11 of 12


Quote:
Alright, I've tried what was suggested and still no luck. I've rebooted and such and I keep getting the error "Unable to find simple control 'Master', 0".
The sound.conf option has worked. Now USB audio is my default device and HDA Intel is my card "1"/fallback. The asoundrc is still wrong, however. I'm using archlinux with openbox. My volume frontend is "volwheel" though i'm open to suggestions for a different program. I was hoping to avoid having to mess around with Pulseaudio because I'd have to configure every single application independently and the thought of having to redo it if my system collapses makes me shudder.
i do have parts for a passive preamp so I suppose its not too big of a deal now that USB is at least my default sound card. I just have to figure out how to make perf board accomodate the gigantic pins of my RCA jacks. I'm pretty sure I can simply drill the perf board to size but I dont want to ruin the perf board by accident.
EDIT: Alright, I found the source of that error in my main TTY1. Its coming from volwheel, which was attempting to control the volume of the "master" channel. The volume control still isnt there, however. I think the only way I'll be able to get volume control is via hardware methods or via pulseaudio, which runs as a sort of server before actual hardware interaction. Dmix seems to be unable to deal with this sound chip (PCM2707). Thanks anyways for the help with setting default sound cards. That is a way better solution that the asoundrc !default statements IMO.


I'm glad setting the module parameter worked for you. Designating a default device might get more complicated if you add a second device that uses snd_usb_audio.
 
Volume Icon seems like a good replacement for volwheel. I was able to create a new volume control and Volume Icon manipulated it without any problems. I even managed to get the new control working with dmix.

Volume Icon's available from the AUR. It can be compiled with support for native desktop notifications (which appears to be disabled at the moment in the AUR package according to that page's comments) but I didn't like it. Its notification was blank for me.

Not associated with volwheel, I also tried GVolWheel but I didn't get far. It's interface was too kludgy for me (its slider kept popping up behind my AWN bar).

Just a reminder, as it notes on the ALSA softvol wiki, a program has to use your new mixer element before it can be seen (!) by alsamixer or whatnot. That step's really unintuitive for me.
 

Users who are viewing this thread

Back
Top