FMOD Studio ignores /etc/asound.conf when using ALSA as the back end

Greetings,

I have been using FMOD (3, Ex & Studio) for years on Linux computers, with ALSA as the back end, and never encountered a problem with mixing so far, but I just upgraded my main PC to a Ryzen9 7900X CPU, and I found out that FMOD Studio entirely ignores the /etc/asound.conf ALSA configuration (it is like if FMOD was only opening hw:0,0, at the hardware level, bypassing ALSA configuration).

With this CPU/motherboard, the sound is using usb_audio and got several PCM channels (one for the back panel, which lack a headphone jack, one for the front jacks with the headphone, and one for the SPDIF output); unlike all my previous motherboards which had a HD Audio chipset, the jacks cannot be re-affected and so I had to configure ALSA to redirect the PCM output to both channels 0 & 1 so to be able to get sound in the headphone.

My /etc/asound.conf file is as follow (I found the solution on stackoverflow.com: linux - Alsa: how to duplicate a stream on 2 outputs and save system configs? - Stack Overflow):

pcm.quad {
type multi
slaves.a.pcm “dmix:Audio,0”
slaves.a.channels 2
slaves.b.pcm “dmix:Audio,1”
slaves.b.channels 2
bindings.0 { slave a; channel 0; }
bindings.1 { slave a; channel 1; }
bindings.2 { slave b; channel 0; }
bindings.3 { slave b; channel 1; }
}

pcm.stereo2quad {
type route
slave.pcm “quad”
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}

pcm.!default {
type asym
playback.pcm “plug:stereo2quad”
capture.pcm “plug:dsnoop:Audio”
}

pcm.dsp {
type asym
playback.pcm “plug:stereo2quad”
capture.pcm “plug:dsnoop:Audio”
}

So, my question is: how to tell FMOD Studio to use /etc/asound.conf configuration and the software mixer instead of hw:0,0 ?..

Hi,

Just to clarify, are you using the FMOD Studio application, or the FMOD API? If it’s the former, have you set the Output Device to ALSA under Edit->Preferences->Audio? If it’s the latter, have you followed the instructions in our Linux platform-specific documentation regarding device selection?

I am speaking about applications using the FMOD Studio API (not about the FMOD Studio application, which I never used), here Second Life viewers.
And yes, the said applications properly initialize the FMOD Studio API with setOutput(FMOD_OUTPUTTYPE_ALSA).
I also tried to use the FMOD_ALSA_DEVICE environment variable, but it is of no help at all, since your documentation states it can only get set with what “aplay -L” lists, and these are only hardware devices, not the configured ALSA software mixers:
null
Discard all samples (playback) or generate zero samples (capture)
sysdefault
Default Audio Device
sysdefault:CARD=Audio
USB Audio, USB Audio
Default Audio Device
front:CARD=Audio,DEV=0
USB Audio, USB Audio
Front output / input
surround21:CARD=Audio,DEV=0
USB Audio, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Audio,DEV=0
USB Audio, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
USB Audio, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
USB Audio, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
USB Audio, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
USB Audio, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
USB Audio, USB Audio
IEC958 (S/PDIF) Digital Audio Output
iec958:CARD=Audio,DEV=1
USB Audio, USB Audio #1
IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia,DEV=0
HDA NVidia, Generic Digital
HDMI Audio Output

Thanks for the additional information. I’ve done some testing, and I’ve also run into issue trying to define an output with etc/asound.conf. However, defining an output in ~/home/.asoundrc works fine for me - could you confirm whether or not you run into the same issue after doing so?

For me, it does not make any difference. I tried:

  • With ~/.asoundrc and /etc/asound.conf (configured the same way), for both an unprivileged user and root.
  • With only ~/.asoundrc (/etc/asound.conf removed), for both an unprivileged user and root.

FMOD Studio API still ignores the configuration and does not duplicate the sounds in the headphone channel.

Unfortunately, I still cannot reproduce this issue - after some more testing, I’m able to successfully detect the ALSA configuration located at both ~/.asoundrc and /etc/asound.conf with aplay -L. Unfortunately, I cannot offer much more help, as this is an ALSA/Linux setup issue, and falls outside the scope of FMOD support. The prerequisite for FMOD identifying devices is for the device to be visible in aplay -L, and for aplay -D yourDevice yourAudioFile.wav to play audio successfully. Since the device is not showing up in aplay -L, that will need to be resolved before I can offer any assistance in relation to FMOD.

It is in no way an ALSA/Linux setup issue: any audio software which does comply with ALSA specs (sox, VLC, mplayer, Audacity, Wine, and even Second Life viewers configured to use OpenAL instead of FMOD Studio), and yes, “aplay” as well (e.g. ‘aplay somesound.wav’), does properly use the software mixer overrides configured in /etc/asound.conf (or ~/.asoundrc: both do work fine).
The only type of software that fails is the one only plugging in ALSA at the hardware level (such as ogg123, for example), and, obviously, FMOD Studio API !

aplay -L only lists cards and channels, but never software mixer overrides/names you define in .asounrc/asound.conf, so if the FMOD Studio API only relies on this, it obviously cannot “see” the configuration done at the system level to override hardware defaults.

Conclusion: either there is a bug in the FMOD Studio API, or its ALSA support is, at best, incomplete. You guys should really have a look at what sox/VLC/mplayer/Wine/Audacity are doing in their code to detect ALSA software mixers and implement the same algorithm in FMOD Studio…

It’s possible that defaults.namehint.showall in /usr/share/alsa/alsa.conf is set to off - if it is, you will either need to specify a device namehint i.e.

pcm.quad {
type multi
slaves.a.pcm “dmix:Audio,0”
slaves.a.channels 2
slaves.b.pcm “dmix:Audio,1”
slaves.b.channels 2
bindings.0 { slave a; channel 0; }
bindings.1 { slave a; channel 1; }
bindings.2 { slave a; channel 2; }
bindings.3 { slave a; channel 3; }
hint.description "this is a hint"
}

or change defaults.namehint.showall to on. For some additional context, and to double check whether this is an issue with FMOD, could I get your distro, ALSA version, and FMOD version?

That’s a good guess, Sir ! :smiley:

Indeed, replacing “defaults.namehint.showall off” with “defaults.namehint.showall on” in /usr/share/alsa/alsa.conf allows to see the configured software mixers via aplay -L, and then FMOD Studio API properly picks up one of those (“dsp” or “default”, I suppose): I do not even need to set a FMOD_ALSA_DEVICE environment variable.

FYI, the output for aplay -L is now:

null
	Discard all samples (playback) or generate zero samples (capture)
sysdefault
	Default Audio Device
quad
stereo2quad
dsp
default
sysdefault:CARD=Audio
	USB Audio, USB Audio
	Default Audio Device
front:CARD=Audio,DEV=0
	USB Audio, USB Audio
	Front output / input
surround21:CARD=Audio,DEV=0
	USB Audio, USB Audio
	2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Audio,DEV=0
	USB Audio, USB Audio
	4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
	USB Audio, USB Audio
	4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
	USB Audio, USB Audio
	5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
	USB Audio, USB Audio
	5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
	USB Audio, USB Audio
	7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
	USB Audio, USB Audio
	IEC958 (S/PDIF) Digital Audio Output
iec958:CARD=Audio,DEV=1
	USB Audio, USB Audio #1
	IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia,DEV=0
	HDA NVidia, Generic Digital
	HDMI Audio Output

And like you suggested, instead of modifying /usr/share/alsa/alsa.conf, simply adding ‘hint.description “default”’ into the ‘pcm.!default { }’ block of /etc/asound.conf also does the trick and allows FMOD to pick up that mixer for playback by default.

As for my distro it is PCLinuxOS (a rolling release, with currently libalsa v1.2.9), and FMOD Studio API is the current one too (v2.02.13), but its configuration is no different from other Linux distros in this respect (no special “patch” changing /usr/share/alsa/alsa.conf, in the SRPMS for libalsa), so users of other distros would encounter the same issue as I did, when using bare metal ALSA (granted, most people use a dispensable “sound daemon” such as PulseAudio).

If anything, and since FMOD, unlike other programs using ALSA, appears to rely on this specific feature, you might want to add a note about it in your (user & devel) documentation…

Happy to hear that you’ve resolved your problem. I agree that adding a note regarding this to our documentation would be a good idea - I’ve flagged some changes internally.