Tagged: pulseaudio

Getting Sound Working From VirtualBox Clients

I got the sound working on my new system (Dell Precision 3640 Tower) with Gentoo after following the steps in Getting Sound (ALSA) Working on Gentoo. However, I couldn't get through from any of VirtualBox clients (Window$10, Manjaro Linux, or Ubuntu)

Some advices on the internet were to change the settings for Host Audio Driver and Audio Controller options on the VirtualBox host side. I tried all combination but couldn't get it working.

Disclaimer:
The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

PulseAudio:

PulseAudio is a general purpose sound server intended to run as a middleware between applications and ALSA. I never needed to install PulseAudio to get the sound working before, so I followed the Gentoo Wiki: PulseAudio.

Kernel Update & Installation:

The Gentoo Wiki: PulseAudio shows which kernel options to turn on using make menuconfig and recompiling the kernel. # cd /usr/src/linux # make menuconfig # make && make modules_install ... # make install ... # grub-mkconfig -o /boot/grub/grub.cfg ...

After rebooting, make sure that the kernel version is updated by uname -r:# uname-v #5 SMP Fri Duc 18 14:46:23 EST 2020

Then, install pulseaudio:# emerge --ask media-sound/pulse

USE flags:

Once pulseaudio is installed, enable the system to support pulseaudio for some applications by updating /etc/portage/make.conf:

FILE /etc/portage/make.conf
USE="... pulseaudio ..."

Then update the system:# emerge --ask --changed-use --deep @world

ALSA Plugin:

ALSA needs to be configured to output to PulseAudio by default:# emerge --ask media-plugins/alsa-plugins

After following the above steps, the next time VirtualBox is started, the sound should be enabled from a client OS.

That's all!
-gibb

Getting Sound (ALSA) Working on Gentoo

I don't think this is limited to only Gentoo setup, but the sound isn't working after the installation. These are the steps I took to get my sound cards recognized by ALSA and got it working.

I use ALSA instead of PulseAudio with no particular reasonings. Some say ALSA is better or vice-versa, but I'm using it since I'm just used to.

I had a suspicion that the sound might not work after the installation. I ran alsamixer to test if my suspicion was right. Well, there was no alsamixer, so I installed media-sound/alsa-utils.# emerge --ask media-sound/alsa-utils

When alsamixer was executed, it returned the following error message as I suspected.$ alsamixer cannot open mixer: No such file or directory

The system recognizes its hardware and the driver seems to be installed but ALSA didn't see them.# lspci -k | grep -iA2 audio 00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) Subsystem: Hewlett-Packard Company SBx00 Azalia (Intel HDA) Kernel driver in use: snd_hda_intel -- 01:00.1 Audio device: NVIDIA Corporation GF106 High Definition Audio Controller (rev a1) Subsystem: eVga.com. Corp. GeForce GTS 450 Kernel driver in use: snd_hda_intel

But, ALSA didn't seem to recognize those sound cards.# cat /proc/asound/cards --- no soundcards ---

I google'd around and found that the HD-audio component consists of two parts, the driver (which I seem to have installed) and codec from the Linux Kernel site as well as some Gentoo forum posts.# dmsg | grep -i codec [ 1.626139] snd_hda_intel 0000:01:00.1: no codecs found!

Yup, I don't have codecs installed. I google'd again and found that conexant for my audio device. So, I searched that codec name in the kernel config file.# grep -i conexant /usr/src/linux/.config CONFIG_SND_HDA_CODEC_CONEXANT=n

I enabled the kernel options following by ALSA in Gentto Wiki, including SND_HDA_CODEC_CONEXANT, and rebuilt the kernel.# cd /usr/src/linux # make menuconfig # make && make modules_install # make install # shudown -r now

After the reboot, kernel version should be incremented/updated.# uname -v #3 SMP Thu Feb 13 14:46:50 EST

Codecs are now installed.# dmesg | grep -i codec [ 1.254990] snd_hda_codec_realtek hdaudioC0D0: ALC888: SKU not ready 0x411111f0 [ 1.255697] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC888: line_outs=4 (0x14/0x15/0x16/0x17/0x0) type:line [ 1.255879] snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.256057] snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0/0x0) [ 1.256231] snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0 [ 1.256361] snd_hda_codec_realtek hdaudioC0D0: dig-out=0x11/0x1e [ 1.256491] snd_hda_codec_realtek hdaudioC0D0: inputs: [ 1.256623] snd_hda_codec_realtek hdaudioC0D0: Front Mic=0x19 [ 1.256768] snd_hda_codec_realtek hdaudioC0D0: Rear Mic=0x18 [ 1.256863] snd_hda_codec_realtek hdaudioC0D0: Line=0x1c [ 1.514180] snd_hda_codec_generic hdaudioC1D0: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.514376] snd_hda_codec_generic hdaudioC1D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.514544] snd_hda_codec_generic hdaudioC1D0: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.514727] snd_hda_codec_generic hdaudioC1D0: mono: mono_out=0x0 [ 1.514829] snd_hda_codec_generic hdaudioC1D0: dig-out=0x5/0x0 [ 1.514967] snd_hda_codec_generic hdaudioC1D0: inputs: [ 1.561175] snd_hda_codec_generic hdaudioC1D1: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.561370] snd_hda_codec_generic hdaudioC1D1: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.561554] snd_hda_codec_generic hdaudioC1D1: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.561738] snd_hda_codec_generic hdaudioC1D1: mono: mono_out=0x0 [ 1.561833] snd_hda_codec_generic hdaudioC1D1: dig-out=0x5/0x0 [ 1.561962] snd_hda_codec_generic hdaudioC1D1: inputs: [ 1.600184] snd_hda_codec_generic hdaudioC1D2: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.600378] snd_hda_codec_generic hdaudioC1D2: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.600563] snd_hda_codec_generic hdaudioC1D2: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.600745] snd_hda_codec_generic hdaudioC1D2: mono: mono_out=0x0 [ 1.600882] snd_hda_codec_generic hdaudioC1D2: dig-out=0x5/0x0 [ 1.601018] snd_hda_codec_generic hdaudioC1D2: inputs: [ 1.638124] snd_hda_codec_generic hdaudioC1D3: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.638271] snd_hda_codec_generic hdaudioC1D3: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.638411] snd_hda_codec_generic hdaudioC1D3: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.638551] snd_hda_codec_generic hdaudioC1D3: mono: mono_out=0x0 [ 1.638690] snd_hda_codec_generic hdaudioC1D3: dig-out=0x5/0x0 [ 1.638822] snd_hda_codec_generic hdaudioC1D3: inputs:

/proc/asound/cards which showed "--- no soundcards ---" now shows found sound cards.# cat /proc/asound/cards 0 [SB ]: HDA-Intel - HDA ATI SB HDA ATI SB at 0xfbff4000 irq 16 1 [NVidia ]: HDA-Intel - HDA NVidia HDA NVidia at 0xfe97c000 irq 19

Yes, ALSA now sees the sound cards. I checked with alsamixer and it seems to be working fine. alsamixer

When I tested with aplay, I heard a noise from my speaker! I now confirmed that the sound is working on my Gentoo.# aplay < /dev/urandom

New: Article about Pulseaudio

Follow the above link to get the sound working from VirtualBox clients.

That's all!
-gibb