Skip to contentSkip to conversation

Audio latency

Qemu-devel Alberich de megres 2 participants 11 messages Feb 10, 2010 – Feb 11, 2010

lore
Share & tools
lore
#0 lore raw

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.
On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

thanks guys!!

#1 lore raw
Quoted 8 lines · Alberich de megres

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.
On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

Quoted 7 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

Signature · 1 line
mailto:[email protected]
#2 lore raw

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Quoted 24 lines · malc
Quoted 8 lines · Alberich de megres

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.
On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

Quoted 7 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

--
mailto:[email protected]

#3 lore raw
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Please do not top post.

Quoted 10 lines · malc
Quoted 7 lines · Alberich de megres
Quoted 6 lines

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.

How do you measure it?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

As in: with setpci?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

Lowering video resolution of what? Guest, host?

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

It would also help to know which version of QEMU you run and exactly how you invoke it.

Signature · 1 line
mailto:[email protected]
#4 lore raw
Quoted 7 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Please do not top post.

Sorrry!!

Quoted 6 lines
Quoted 6 lines · malc
Quoted 2 lines · Alberich de megres
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.

How do you measure it?

With a program called dpc latency, it's for windows.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

As in: with setpci?

Yes. I also tired, on host, to low latency to VGA to 10.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

Lowering video resolution of what? Guest, host?

Yes, it was on guest. Even for example if i change the desktop or switch to a text terminal when things works better what suggested me that could be something with painting the screen. But i'm not shure if its just only a side effect of a bad launch command, or something else.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

It would also help to know which version of QEMU you run and exactly how you invoke it.

You're right..sorry:

qemu-kvm -cpu core2duo -smp 2 -m 1024 -hda /home/nine/imgs/hda1.img -vga std -usbdevice tablet

               -name t1  -net nic,macaddr=55:54:00:12:34:56 -net

tap,ifname=tap1,script=no
-soundhw ac97

Quoted 4 lines

--
mailto:[email protected]

Thanks!!

#5 lore raw
Quoted 24 lines · Alberich de megres
Quoted 7 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Please do not top post.

Sorrry!!

Quoted 6 lines
Quoted 6 lines · malc
Quoted 2 lines · Alberich de megres
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.

How do you measure it?

Quoted 8 lines

With a program called dpc latency, it's for windows.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

As in: with setpci?

Yes. I also tired, on host, to low latency to VGA to 10.

That's completely unrelated latency [1]

Quoted 25 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

Lowering video resolution of what? Guest, host?

Yes, it was on guest. Even for example if i change the desktop or switch to a text terminal when things works better what suggested me that could be something with painting the screen. But i'm not shure if its just only a side effect of a bad launch command, or something else.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

It would also help to know which version of QEMU you run and exactly how you invoke it.

Quoted 7 lines

You're right..sorry:

qemu-kvm -cpu core2duo -smp 2 -m 1024 -hda /home/nine/imgs/hda1.img -vga std -usbdevice tablet

               -name t1  -net nic,macaddr=55:54:00:12:34:56 -net

tap,ifname=tap1,script=no
-soundhw ac97

I can't help you with kvm and windows, that said here are the things to try:
a. Vanilla qemu
b. No smp

And i'm not saying that those will help, just trying to collect more data points.

P.S. 4 seconds of latency is sortof insane, especially given that
default buffering for ALSA is nowhere near that, not by a longest shot.

[1] http://www.reric.net/linux/pci_latency.html

Signature · 1 line
mailto:[email protected]
#6 lore raw
Quoted 70 lines · malc
Quoted 24 lines · Alberich de megres
Quoted 7 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Please do not top post.

Sorrry!!

Quoted 6 lines
Quoted 6 lines · malc
Quoted 2 lines · Alberich de megres
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.

How do you measure it?

Quoted 8 lines

With a program called dpc latency, it's for windows.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

As in: with setpci?

Yes. I also tired, on host, to low latency to VGA to 10.

That's completely unrelated latency [1]

Quoted 25 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

Lowering video resolution of what? Guest, host?

Yes, it was on guest. Even for example if i change the desktop or switch to a text terminal when things works better what suggested me that could be something with painting the screen. But i'm not shure if its just only a side effect of a bad launch command, or something else.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

It would also help to know which version of QEMU you run and exactly how you invoke it.

Quoted 7 lines

You're right..sorry:

qemu-kvm -cpu core2duo -smp 2 -m 1024 -hda /home/nine/imgs/hda1.img -vga std  -usbdevice tablet
               -name t1  -net nic,macaddr=55:54:00:12:34:56 -net tap,ifname=tap1,script=no
               -soundhw ac97

Quoted 5 lines

I can't help you with kvm and windows, that said here are the things to try:
 a. Vanilla qemu
 b. No smp

The same thing.
When playing sounds, i get little cuts.

Quoted 12 lines

And i'm not saying that those will help, just trying to collect more data points.

P.S. 4 seconds of latency is sortof insane, especially given that default buffering for ALSA is nowhere near that, not by a longest shot.

[1] http://www.reric.net/linux/pci_latency.html

--
mailto:[email protected]

#7 lore raw

Another interesting thing:

on guest side,
when i leave the screen quiet, for example just showing desktop with no animations at all (so there's no change in what should be drawed) things improve a lot of, and then i coudl hear a song perfectly. The screen is 1680x1050. the same thing happens when i low screen resolution to 800x600

Could be the emulated VGA graphic adapter latency? I suppose that i haven't 2D acceleration so CPU has to paint the screen everytime a change is done.

Quoted 93 lines · Alberich de megres
Quoted 70 lines · malc
Quoted 24 lines · Alberich de megres
Quoted 7 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Please do not top post.

Sorrry!!

Quoted 6 lines
Quoted 6 lines · malc
Quoted 2 lines · Alberich de megres
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Hi!

I'm running qemu on suse, and i got a very high audio latency. For example, using windows latency is about 4s and audio gets distorted with little cuts.

How do you measure it?

Quoted 8 lines

With a program called dpc latency, it's for windows.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On the host side (suse), i changed the audio pci device latency to 99 but this only improves a little bit.

As in: with setpci?

Yes. I also tired, on host, to low latency to VGA to 10.

That's completely unrelated latency [1]

Quoted 25 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Other thing i noticed is when lowering video resolution, the audio latency gets better and better.

Lowering video resolution of what? Guest, host?

Yes, it was on guest. Even for example if i change the desktop or switch to a text terminal when things works better what suggested me that could be something with painting the screen. But i'm not shure if its just only a side effect of a bad launch command, or something else.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I started played with source code, but i'm just a newbie on qemu. Anyone can point some light to me please?

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

thanks guys!!

-audio-help is your friend, from there you can deduce (at the very least) which audio driver your qemu uses.

It would also help to know which version of QEMU you run and exactly how you invoke it.

Quoted 7 lines

You're right..sorry:

qemu-kvm -cpu core2duo -smp 2 -m 1024 -hda /home/nine/imgs/hda1.img -vga std  -usbdevice tablet
               -name t1  -net nic,macaddr=55:54:00:12:34:56 -net tap,ifname=tap1,script=no
               -soundhw ac97

Quoted 5 lines

I can't help you with kvm and windows, that said here are the things to try:
 a. Vanilla qemu
 b. No smp

The same thing.
When playing sounds, i get little cuts.

Quoted 12 lines

And i'm not saying that those will help, just trying to collect more data points.

P.S. 4 seconds of latency is sortof insane, especially given that default buffering for ALSA is nowhere near that, not by a longest shot.

[1] http://www.reric.net/linux/pci_latency.html

--
mailto:[email protected]

#8 lore raw
Quoted 9 lines · Alberich de megres

Another interesting thing:

on guest side,
when i leave the screen quiet, for example just showing desktop with no animations at all (so there's no change in what should be drawed) things improve a lot of, and then i coudl hear a song perfectly. The screen is 1680x1050. the same thing happens when i low screen resolution to 800x600

Quoted 20 lines

Could be the emulated VGA graphic adapter latency? I suppose that i haven't 2D acceleration so CPU has to paint the screen everytime a change is done.

Quoted 13 lines · Alberich de megres
Quoted 12 lines · malc
Quoted 10 lines · Alberich de megres
Quoted 7 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Please do not top post.

Sorrry!!

And there you go again :)

[..snip..]

QEMU is synchronous, if it takes too much time doing the video stuff audio will be starved, i don't think i can help with that, what you can do to test this theory of yours is to use VNC, set things up start the song and then disconnect, if the audio is playing normally then you are right.

Signature · 1 line
mailto:[email protected]
#9 lore raw
Quoted 28 lines · malc
Quoted 26 lines · Alberich de megres

Another interesting thing:

on guest side,
when i leave the screen quiet, for example just showing desktop with no animations at all (so there's no change in what should be drawed) things improve a lot of, and then i coudl hear a song perfectly. The screen is 1680x1050. the same thing happens when i low screen resolution to 800x600

Could be the emulated VGA graphic adapter latency? I suppose that i haven't 2D acceleration so CPU has to paint the screen everytime a change is done.

Quoted 10 lines · Alberich de megres
Quoted 9 lines · malc
Quoted 7 lines · Alberich de megres
Quoted 6 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Please do not top post.

Sorrry!!

And there you go again :)

:( sorry once again

Quoted 8 lines

[..snip..]

QEMU is synchronous, if it takes too much time doing the video stuff audio will be starved, i don't think i can help with that, what you can do to test this theory of yours is to use VNC, set things up start the song and then disconnect, if the audio is playing normally then you are right.

You mean VNC conecting to guest OS? (windows in this case?)

Quoted 3 lines

--
mailto:[email protected]

Qemu, uses some kind of 2D hardware acceleration to draw? or simply it does with CPU?

It would be hard for me to implement a patch to make qemu asynchronous? (i mean, if the qemu soft architecture allows it on a easy way or not).

Thanks for all :))

#10 lore raw
Quoted 39 lines · Alberich de megres
Quoted 28 lines · malc
Quoted 26 lines · Alberich de megres

Another interesting thing:

on guest side,
when i leave the screen quiet, for example just showing desktop with no animations at all (so there's no change in what should be drawed) things improve a lot of, and then i coudl hear a song perfectly. The screen is 1680x1050. the same thing happens when i low screen resolution to 800x600

Could be the emulated VGA graphic adapter latency? I suppose that i haven't 2D acceleration so CPU has to paint the screen everytime a change is done.

Quoted 10 lines · Alberich de megres
Quoted 9 lines · malc
Quoted 7 lines · Alberich de megres
Quoted 6 lines · malc
Quoted 3 lines · Alberich de megres

I'm using the alsa driver.
Even I tried to change some values using the export and some flags that -audio-help shows, but nothing significant.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Please do not top post.

Sorrry!!

And there you go again :)

:( sorry once again

Quoted 2 lines

[..snip..]

Quoted 7 lines
Quoted 6 lines

QEMU is synchronous, if it takes too much time doing the video stuff audio will be starved, i don't think i can help with that, what you can do to test this theory of yours is to use VNC, set things up start the song and then disconnect, if the audio is playing normally then you are right.

You mean VNC conecting to guest OS? (windows in this case?)

No i mean QEMU's builtin vnc server:

I.e. n one terminal:

$ qemu [..args..] -vnc :0

And elsehwere:

$ vncclient localhost:0
Quoted 3 lines

Qemu, uses some kind of 2D hardware acceleration to draw? or simply it does with CPU?

Almost none with std-vga, btw you can also try -vga vmware

Quoted 4 lines

It would be hard for me to implement a patch to make qemu asynchronous? (i mean, if the qemu soft architecture allows it on a easy way or not).

Yes, it would be hard for you, for anyone even.

Signature · 1 line
mailto:[email protected]