Oss/Alsa/Pulseaudio: never-ending wars (VBox)

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
I can't play audio from my VBox.  The host system only plays audio through the second sound card (1).  The VBox offers me OSS or the null driver.  The Alsa and pulseaudio pages  say OSS is "deprecated".   Is Oracle out of the picture?  I can't find the straight dope.

Do I have to convince VBox to talk to a different sound card?

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

Adam Carter
On Wed, Feb 19, 2020 at 8:06 PM <[hidden email]> wrote:
I can't play audio from my VBox.  The host system only plays audio through the second sound card (1).  The VBox offers me OSS or the null driver.  The Alsa and pulseaudio pages  say OSS is "deprecated".   Is Oracle out of the picture?  I can't find the straight dope.

Do I have to convince VBox to talk to a different sound card?

 
Which vbox version and what are your use flags?

FWIW, for me;
app-emulation/virtualbox-6.1.2::gentoo was built with the following:
USE="alsa opengl opus pam pulseaudio qt5 sdk udev -debug -doc -dtrace -headless -java -libressl -lvm -pax_kernel -python -vboxwebsrv -vnc" ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_6 -python2_7 -python3_7 -python3_8" PYTHON_TARGETS="python2_7 python3_6 -python3_7 -python3_8"

So i can use ALSA or pulse.
Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 10:48, Adam Carter wrote:
On Wed, Feb 19, 2020 at 8:06 PM <[hidden email]> wrote:
I can't play audio from my VBox.  The host system only plays audio through the second sound card (1).  The VBox offers me OSS or the null driver.  The Alsa and pulseaudio pages  say OSS is "deprecated".   Is Oracle out of the picture?  I can't find the straight dope.

Do I have to convince VBox to talk to a different sound card?

 
Which vbox version and what are your use flags?

FWIW, for me;
app-emulation/virtualbox-6.1.2::gentoo was built with the following:
USE="alsa opengl opus pam pulseaudio qt5 sdk udev -debug -doc -dtrace -headless -java -libressl -lvm -pax_kernel -python -vboxwebsrv -vnc" ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_6 -python2_7 -python3_7 -python3_8" PYTHON_TARGETS="python2_7 python3_6 -python3_7 -python3_8"

So i can use ALSA or pulse.


Okay, that's a good tip.  I'll try those use flags - I have none set.

I'm at virtualbox-5.2.32, which I just emerged in the last couple of days, using this profile:

    [16]  default/linux/amd64/17.1 (stable) *

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 15:37, n952162 wrote:
On 2020-02-19 10:48, Adam Carter wrote:
On Wed, Feb 19, 2020 at 8:06 PM <[hidden email]> wrote:
I can't play audio from my VBox.  The host system only plays audio through the second sound card (1).  The VBox offers me OSS or the null driver.  The Alsa and pulseaudio pages  say OSS is "deprecated".   Is Oracle out of the picture?  I can't find the straight dope.

Do I have to convince VBox to talk to a different sound card?

 
Which vbox version and what are your use flags?

FWIW, for me;
app-emulation/virtualbox-6.1.2::gentoo was built with the following:
USE="alsa opengl opus pam pulseaudio qt5 sdk udev -debug -doc -dtrace -headless -java -libressl -lvm -pax_kernel -python -vboxwebsrv -vnc" ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_6 -python2_7 -python3_7 -python3_8" PYTHON_TARGETS="python2_7 python3_6 -python3_7 -python3_8"

So i can use ALSA or pulse.


Okay, that's a good tip.  I'll try those use flags - I have none set.

I'm at virtualbox-5.2.32, which I just emerged in the last couple of days, using this profile:

    [16]  default/linux/amd64/17.1 (stable) *


I added alsa and pulseaudio and it didn't help.  Then I noticed that opus has something to do with the soundcard so I emerged that with -vU but nothing needed to be done.

It seems like VBox is interfacing directly with "the" sound card and even working correctly (e.g. aplay some-file takes about the right amount of time until it ends error-free), but unfortunately, I have 2 sound cards and the first doesn't work.

Perhaps I could map the one to the other soundcard using .asoundrc?  Unfortunately, I can find no grammar for that file.



Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

Mick-10
On Wednesday, 19 February 2020 17:32:46 GMT n952162 wrote:

> On 2020-02-19 15:37, n952162 wrote:
> > On 2020-02-19 10:48, Adam Carter wrote:
> >> On Wed, Feb 19, 2020 at 8:06 PM <[hidden email]
> >>
> >> <mailto:[hidden email]>> wrote:
> >>     I can't play audio from my VBox.  The host system only plays
> >>     audio through the second sound card (1).  The VBox offers me OSS
> >>     or the null driver.  The Alsa and pulseaudio pages  say OSS is
> >>     "deprecated".   Is Oracle out of the picture?  I can't find the
> >>     straight dope.
> >>    
> >>     Do I have to convince VBox to talk to a different sound card?
> >>
> >> Which vbox version and what are your use flags?
> >>
> >> FWIW, for me;
> >> app-emulation/virtualbox-6.1.2::gentoo was built with the following:
> >> USE="alsa opengl opus pam pulseaudio qt5 sdk udev -debug -doc -dtrace
> >> -headless -java -libressl -lvm -pax_kernel -python -vboxwebsrv -vnc"
> >> ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_6 -python2_7 -python3_7
> >> -python3_8" PYTHON_TARGETS="python2_7 python3_6 -python3_7 -python3_8"
> >>
> >> So i can use ALSA or pulse.
> >
> > Okay, that's a good tip.  I'll try those use flags - I have none set.
> >
> > I'm at virtualbox-5.2.32, which I just emerged in the last couple of
> > days, using this profile:
> >
> >     [16]  default/linux/amd64/17.1 (stable) *
>
> I added alsa and pulseaudio and it didn't help.  Then I noticed that
> opus has something to do with the soundcard so I emerged that with -vU
> but nothing needed to be done.
>
> It seems like VBox is interfacing directly with "the" sound card and
> even working correctly (e.g. aplay some-file takes about the right
> amount of time until it ends error-free), but unfortunately, I have 2
> sound cards and the first doesn't work.
>
> Perhaps I could map the one to the other soundcard using .asoundrc?
> Unfortunately, I can find no grammar for that file.
Two outputs, one HDMI, the other analogue on this laptop:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: Generic Digital [Generic Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: CX20757 Analog [CX20757 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

This syntax swaps them over, so I can get sound out of the speakers:

$ cat /etc/asound.conf
#pcm_slave.slave_rate48000Hz {
#        pcm "hw:1,0"
## This is the rate the sound card does.
## Any random input rates are resampled to this.
#        rate 48000
#}
#pcm.rate44100Hz {
#        type plug
#        slave slave_rate48000Hz
#}

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 19:49, Mick wrote:
On Wednesday, 19 February 2020 17:32:46 GMT n952162 wrote:
On 2020-02-19 15:37, n952162 wrote:
On 2020-02-19 10:48, Adam Carter wrote:
On Wed, Feb 19, 2020 at 8:06 PM <[hidden email]

[hidden email]> wrote:
    I can't play audio from my VBox.  The host system only plays
    audio through the second sound card (1).  The VBox offers me OSS
    or the null driver.  The Alsa and pulseaudio pages  say OSS is
    "deprecated".   Is Oracle out of the picture?  I can't find the
    straight dope.

    Do I have to convince VBox to talk to a different sound card?

Which vbox version and what are your use flags?

FWIW, for me;
app-emulation/virtualbox-6.1.2::gentoo was built with the following:
USE="alsa opengl opus pam pulseaudio qt5 sdk udev -debug -doc -dtrace
-headless -java -libressl -lvm -pax_kernel -python -vboxwebsrv -vnc"
ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_6 -python2_7 -python3_7
-python3_8" PYTHON_TARGETS="python2_7 python3_6 -python3_7 -python3_8"

So i can use ALSA or pulse.
Okay, that's a good tip.  I'll try those use flags - I have none set.

I'm at virtualbox-5.2.32, which I just emerged in the last couple of
days, using this profile:

    [16]  default/linux/amd64/17.1 (stable) *
I added alsa and pulseaudio and it didn't help.  Then I noticed that
opus has something to do with the soundcard so I emerged that with -vU
but nothing needed to be done.

It seems like VBox is interfacing directly with "the" sound card and
even working correctly (e.g. aplay some-file takes about the right
amount of time until it ends error-free), but unfortunately, I have 2
sound cards and the first doesn't work.

Perhaps I could map the one to the other soundcard using .asoundrc?
Unfortunately, I can find no grammar for that file.
Two outputs, one HDMI, the other analogue on this laptop:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: Generic Digital [Generic Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: CX20757 Analog [CX20757 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

This syntax swaps them over, so I can get sound out of the speakers:

$ cat /etc/asound.conf
#pcm_slave.slave_rate48000Hz {
#        pcm "hw:1,0"
##	This is the rate the sound card does.
##	Any random input rates are resampled to this.
#        rate 48000
#}
#pcm.rate44100Hz {
#        type plug
#        slave slave_rate48000Hz
#}

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

Perhaps coincidentally, that's almost identical to what I have on the host:

01~>cat .asoundrc
defaults.pcm.!card 1
defaults.pcm.!device 0
defaults.pcm.!ctl 1
#pcm.!default {
#    type hw
#    card 1
#}
#ctl.!default {
#    type hw
#    card 1
#}

That works fine there, but aplay in the guest vbox is silent.

But that gave me an idea - I tried deleting the host .asoundrc - but it didn't help

Putting that .asoundrc in the guest won't work, because vbox only reports seeing one sound card - there is no card 1 (i.e. second card).

The documentation that I could find about .asoundrc implies that you can do things like mapping channels but I'm not succeeding with that.

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

Walter Dnes
In reply to this post by n952162
On Wed, Feb 19, 2020 at 06:32:46PM +0100, n952162 wrote
> On 2020-02-19 15:37, n952162 wrote:
>
> It seems like VBox is interfacing directly with "the" sound card and
> even working correctly (e.g. aplay some-file takes about the right
> amount of time until it ends error-free), but unfortunately, I have 2
> sound cards and the first doesn't work.

  From the aplay man page...

       -l, --list-devices
              List all soundcards and digital audio devices

       -D, --device=NAME
              Select PCM by name

  And if you're using alsa, run alsamixer and ensure that the output is
not muted; that's the default.

--
Walter Dnes <[hidden email]>
I don't run "desktop environments"; I run useful applications

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 20:42, Walter Dnes wrote:
On Wed, Feb 19, 2020 at 06:32:46PM +0100, n952162 wrote
On 2020-02-19 15:37, n952162 wrote:

It seems like VBox is interfacing directly with "the" sound card and
even working correctly (e.g. aplay some-file takes about the right
amount of time until it ends error-free), but unfortunately, I have 2
sound cards and the first doesn't work.
  From the aplay man page...

       -l, --list-devices
              List all soundcards and digital audio devices

       -D, --device=NAME
              Select PCM by name

  And if you're using alsa, run alsamixer and ensure that the output is
not muted; that's the default.

Here's the host (with redundant surround devices removed), -l followed by -L, clearly showing two cards:

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic_1 [HD-Audio Generic], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0



null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
hdmi:CARD=Generic,DEV=0
    HD-Audio Generic, HDMI 0
    HDMI Audio Output
hdmi:CARD=Generic,DEV=1
    HD-Audio Generic, HDMI 1
    HDMI Audio Output
hdmi:CARD=Generic,DEV=2
    HD-Audio Generic, HDMI 2
    HDMI Audio Output
hdmi:CARD=Generic,DEV=3
    HD-Audio Generic, HDMI 3
    HDMI Audio Output
usbstream:CARD=Generic
    HD-Audio Generic
    USB Stream Output
default:CARD=Generic_1
    HD-Audio Generic, ALC892 Analog
    Default Audio Device
sysdefault:CARD=Generic_1
    HD-Audio Generic, ALC892 Analog
    Default Audio Device
front:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALC892 Analog
    Front speakers
surround21:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALC892 Analog
    2.1 Surround output to Front and Subwoofer speakers
...
usbstream:CARD=Generic_1
    HD-Audio Generic
    USB Stream Output

Here's the guest, similarly reduced:

**** List of PLAYBACK Hardware Devices ****
card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=I82801AAICH
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Default Audio Device
sysdefault:CARD=I82801AAICH
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Default Audio Device
front:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    Front speakers
surround21:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    2.1 Surround output to Front and Subwoofer speakers
...
iec958:CARD=I82801AAICH,DEV=0
    Intel 82801AA-ICH, Intel 82801AA-ICH
    IEC958 (S/PDIF) Digital Audio Output

VirtualBox only sees one card, and the card it sees behaves just like card 0 on the host - no sound.  So, my theory is, it's not getting to access card 2 (i.e., 1).

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

Mick-10
In reply to this post by n952162
On Wednesday, 19 February 2020 19:31:08 GMT n952162 wrote:
> Perhaps coincidentally, that's almost identical to what I have on the host:
>
>     01~>cat .asoundrc
>     defaults.pcm.!card 1
>     defaults.pcm.!device 0
>     defaults.pcm.!ctl 1

Isn't the exclamation mark "!" negating what follows it?

If you are disabling all of them, you'll end up with the default setting, I
think.
--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 22:43, Mick wrote:
On Wednesday, 19 February 2020 19:31:08 GMT n952162 wrote:
Perhaps coincidentally, that's almost identical to what I have on the host:

    01~>cat .asoundrc
    defaults.pcm.!card 1
    defaults.pcm.!device 0
    defaults.pcm.!ctl 1
Isn't the exclamation mark "!" negating what follows it?

If you are disabling all of them, you'll end up with the default setting, I
think.

Do you have a reference for that?  I haven't been able to work out the logic of what that might mean.

That "defaults.pcm.!card 1" might "disable" card 1 doesn't seem plausible to me.  If the default is 0, how is that improved by "disabling" card 1?  And, how do you assign card 1 to defaults, in that case?

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 22:58, n952162 wrote:
On 2020-02-19 22:43, Mick wrote:
On Wednesday, 19 February 2020 19:31:08 GMT n952162 wrote:
Perhaps coincidentally, that's almost identical to what I have on the host:

    01~>cat .asoundrc
    defaults.pcm.!card 1
    defaults.pcm.!device 0
    defaults.pcm.!ctl 1
Isn't the exclamation mark "!" negating what follows it?

If you are disabling all of them, you'll end up with the default setting, I
think.

Do you have a reference for that?  I haven't been able to work out the logic of what that might mean.

That "defaults.pcm.!card 1" might "disable" card 1 doesn't seem plausible to me.  If the default is 0, how is that improved by "disabling" card 1?  And, how do you assign card 1 to defaults, in that case?

$ cat /etc/alsa/conf.d/99-pulseaudio-default.conf.example
# Default to PulseAudio

pcm.!default {
    type pulse
    hint {
        show on
        description "Default ALSA Output (currently PulseAudio Sound Server)"
    }
}

ctl.!default {
    type pulse
}

What would the bangs here mean?

Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

Mick-10
On Wednesday, 19 February 2020 22:08:28 GMT n952162 wrote:
> On 2020-02-19 22:58, n952162 wrote:
> > On 2020-02-19 22:43, Mick wrote:
> >> On Wednesday, 19 February 2020 19:31:08 GMT n952162 wrote:
> >>> Perhaps coincidentally, that's almost identical to what I have on the
host:

> >>>      01~>cat .asoundrc
> >>>      defaults.pcm.!card 1
> >>>      defaults.pcm.!device 0
> >>>      defaults.pcm.!ctl 1
> >>
> >> Isn't the exclamation mark "!" negating what follows it?
> >>
> >> If you are disabling all of them, you'll end up with the default setting,
> >> I
> >> think.
> >
> > Do you have a reference for that?  I haven't been able to work out the
> > logic of what that might mean.
> >
> > That "defaults.pcm.!card 1" might "*disable*" card 1 doesn't seem
> > plausible to me.  If the default is 0, how is that improved by
> > "/disabling/" card 1?  And, how do you assign card 1 to defaults, in
> > that case?
>
> *$ cat /etc/alsa/conf.d/99-pulseaudio-default.conf.example *
> # Default to PulseAudio
>
> pcm.!default {
>      type pulse
>      hint {
>          show on
>          description "Default ALSA Output (currently PulseAudio Sound
> Server)"
>      }
> }
>
> ctl.!default {
>      type pulse
> }
>
> What would the bangs here mean?
I understand the exclation mark in the above statements to mean "change the
default" to "type pulse", but it has been years since I hacked asoundrc.  Have
a look here:

https://alsa.opensrc.org/Asoundrc

--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox)

n952162
On 2020-02-19 23:24, Mick wrote:

> On Wednesday, 19 February 2020 22:08:28 GMT n952162 wrote:
>> On 2020-02-19 22:58, n952162 wrote:
>>> On 2020-02-19 22:43, Mick wrote:
>>>> On Wednesday, 19 February 2020 19:31:08 GMT n952162 wrote:
>>>>> Perhaps coincidentally, that's almost identical to what I have on the
> host:
>>>>>       01~>cat .asoundrc
>>>>>       defaults.pcm.!card 1
>>>>>       defaults.pcm.!device 0
>>>>>       defaults.pcm.!ctl 1
>>>> Isn't the exclamation mark "!" negating what follows it?
>>>>
>>>> If you are disabling all of them, you'll end up with the default setting,
>>>> I
>>>> think.
>>> Do you have a reference for that?  I haven't been able to work out the
>>> logic of what that might mean.
>>>
>>> That "defaults.pcm.!card 1" might "*disable*" card 1 doesn't seem
>>> plausible to me.  If the default is 0, how is that improved by
>>> "/disabling/" card 1?  And, how do you assign card 1 to defaults, in
>>> that case?
>> *$ cat /etc/alsa/conf.d/99-pulseaudio-default.conf.example *
>> # Default to PulseAudio
>>
>> pcm.!default {
>>       type pulse
>>       hint {
>>           show on
>>           description "Default ALSA Output (currently PulseAudio Sound
>> Server)"
>>       }
>> }
>>
>> ctl.!default {
>>       type pulse
>> }
>>
>> What would the bangs here mean?
> I understand the exclation mark in the above statements to mean "change the
> default" to "type pulse", but it has been years since I hacked asoundrc.  Have
> a look here:
>
> https://alsa.opensrc.org/Asoundrc
>

Yes, I've seen that, and it's the best there is out there, but it
doesn't describe the grammar or semantics.  It just gives a few random
examples but the grammar is complicated enough that I can't interpolate
from those.

That's why I asked elsewhere about retaining the sources of an emerge -
at some point I guess I'll have to go into ... I guess alsamixer ... and
reverse engineer it.



Reply | Threaded
Open this post in threaded view
|

Re: Oss/Alsa/Pulseaudio: never-ending wars (VBox) [RESOLVED]

n952162
In reply to this post by n952162
I finally understood, more or less, this web page:

   https://bbs.archlinux.org/viewtopic.php?id=186597

and added this line to the end of /etc/modprobe.d/alsa.conf and now I
have sound from both the host and the guest:

   options snd-hda-intel index=1,0


On 2020-02-19 10:06, [hidden email] wrote:
> I can't play audio from my VBox.  The host system only plays audio through the second sound card (1).  The VBox offers me OSS or the null driver.  The Alsa and pulseaudio pages  say OSS is "deprecated".   Is Oracle out of the picture?  I can't find the straight dope.
>
> Do I have to convince VBox to talk to a different sound card?
>