Firefox YouTube audio in VirtualBox

When listening to music on YouTube’s web site, the audio (even with a static video) has been hit-or-miss. If the audio doesn’t sound normal, it would sound like it’s playing in slow-motion, or it will play too fast. Changing the Playback Speed option up/down as needed, does not correct the bad audio. I also turned on 3D acceleration for the VirtualBox, which didn’t fix this. There is an option in VIrtualBox to use more than one CPU, with this set to the default (1) or changing this to 2, had no affect.

I doubt it’s an issue with OpenMandriva, but could it be because FIrefox is running in a VirtualBox, not natively? Having no other issues with Firefox.

I haven’t tried this with Chromium because of the recent crashes reported, have not reinstalled it.

Thanks in advance.

I would blame it on the virtual machine, on my notebook no problem at all …

1 Like

Host machine for this: Cooker x86_64 using OM VBox virtualbox-6.1.36-1. Host system is using pipewire-pulse sound server rather than pulseaudio. Do not think that should matter but…

I opened Rolling x86_64 test VBox VM then open Firefox (v. 103 here). Went to YouTube and played something. Sound was OK or normal. I normally set cpu to 2 and memory to 4096 MB.

Audio settings are default I never touch this:

Maybe hardware acceleration settings could affect this? For this some users find the default does not work best, but I use the default here.

Tried in same Rolling VM with chromium-browser-stable-103.0.5060.134-1.x86_64 and sound at YouTube worked OK/normal in Chromium.

So i went for the trifecta and tried in Falkon and YouTube sound was OK in Falkon as well. Edit: (falkon-3.2.0-1.x86_64)

1 Like

VirtualBox (6.1.36 here) defaults to 1 CPU and 1024 MB of memory when creating a new VirtualBox. I always change it to 2 CPU’s and 4096 MB, which is half of the total installed RAM. I used the same RAM setting when I previously used virt-manager - which defaulted to using a virtual CPU, where VirtualBox uses the host.

I’ve been told VirtualBox passes the audio to the host, which is using PulseAudio. One of the other VirtualBoxes uses PulseAudio through PipeWire (same as pipewire-pulse?) and when I tried the same in that, the audio was actually vibrating, so erratic, you couldn’t listen to it!

I could not access the System/Acceleration settings as I type this (currently running - grayed out), but that same box is otherwise checked.

I’ll look at some of the Firefox settings as well.

I do not know that there is anything wrong with using pulseaudio on host or guest. I was just reporting what I have in view of it works_for_me.

I did not check sound server on guest Rolling VM but that is most likely also pipewire-pulse. OMLx currently has two primary choices of sound server pipewire-pulse (default) and pulseaudio-server. My testing method is to use defaults to test what less knowledgeable users are most likely to use.

In VirtualBox I do change 3 things. 2 cpu instead of 1, more memory (4096MB), and I increase video memory to max. or 128MB here.

User-info: I don’t think OMLx (any) would install with 1024MB memory. I believe the OM Calamares installer requires 2024MB or 2GB memory.

When I created this latest Cooker VirtualBox, I put in the same settings, 2 CPU’s, 128 MB video memory and 4096 MB RAM. I’m still setting it up, but will further test this.

1 Like

Can you try select in VB audio outpu as Alsa?

1 Like

Have ALSA set now. It will be fine for a number of minutes, then the audio will suddenly sound like static. If I reload the YouTube tab and restart, the autio goes back to normal. I don’t know if the host may be temporarily (?) using resources when this occurs.

Another VBox setting I changed prior to this, that made the audio a lot better, but not 100% perfect (while on PulseAudio), was on System/Acceleration, changing Default to Legacy. Legacy otherwise should be used for VirtualBoxes created with older VirtualBox versions and will pick a paravirtualization interface while starting the VBox with versions >= 5. With ALSA set, this other setting was put back on Default. I will switch it back to Legacy, leaving ALSA in place and check.

What is the host operating system? Is the VirtualBox software from that operating system or from Oracle web site?

Still had static audio with ALSA. I switched it back to PulseAudio, but on System/Acceleration, I changed it to Minimal (virtualization). This setting announces the presence of virtualization and reports the TSC and APIC frequency to the guest OS.

This might be the best I can get out of the audio, not exactly 100% perfect, but it’s doable. I’ll continue to test with PulseAudio/Minimal.

Host is Mageia 8. VirtualBox software (6.1) is from that OS.

As of this moment (and this is subject to change…), the following settings work with my hardware (which isn’t the latest):

System: Processor: 1 CPU, Acceleration: Minimal (Enable Nested Paging is checked)

Display: Screen: 128MB video memory, VMSVGA (Enable 3D Acceleration is not checked)

Audio: PulseAudio, ICH AC97

I also discovered that on two of the VirtualBoxes where I used a Plasma Lite Cooker image from ABF to install, the image installed kernel-desktop-gcc. The Xfce Cooker image from ABF, installed kernel-desktop. So I installed kernel-desktop on one of them and removed kernel-desktop-gcc. To be honest, I don’t know what the difference is between the two.

Testing continues.

I also discovered that on two of the VirtualBoxes where I used a Plasma Lite Cooker image from ABF to install, the image installed kernel-desktop-gcc.

EDIT - Should read: Slim Plasma Cooker

kernel-desktop is clang compiled.(This is the default kernel for OMLx now.)

kernel-desktop-gcc is gcc compiled.

Hi Ben,

Thank you for the kernel explanation. I had not heard of a gcc kernel prior to this. On the two VirtualBoxes where kernel-desktop-gcc was installed by default, I installed kernel-desktop and removed kernel-desktop-gcc.

On this machine (an older desktop), these VirtualBox settings will successfully have Firefox play audio on YouTube at regular/normal speed. The settings may or may not work for others, but they work for me:





I found what may be a fix for this issue, but I will need to test it across all of my VirtualBoxes.

Apparently, whatever is used to set the AC97 clock, does not work in a virtual machine.

What this required to fix, was the addition of a file named sound.conf to /etc/modprobe.d containing only:

options snd-intel8x0 ac97_clock=48000

Save the file and reboot the VirtualBox.

The kernel module will now manually set the AC97 clock to 48000 Hz. If this frequency is higher than 48000 Hz, the audio will play faster than it should and if the frequency is lower, the audio will play slower.

To confirm that the AC97 clock is on 48000 Hz once performing the above steps and after a reboot, install the sysfsutils package if not already installed and run: systool -vm snd_intel8x0 in a terminal.

The output will include:

Parameters:
    ac97_clock          = "48000"

Reference: https://www.virtualbox.org/ticket/4605?cversion=0&cnum_hist=28#comment:14

3 Likes

Now that this issue has been fixed, I can go back to using the previous VirtualBox settings: number of CPU’s, Acceleration, etc.

1 Like