qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] wav output sounds good - what does this mean?
@ 2015-09-06 20:53 Programmingkid
  2015-09-09  9:17 ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Programmingkid @ 2015-09-06 20:53 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel qemu-devel

I have been working on making the sound output from the USB sound card actually sound good. When the audio is sent to CoreAudio, the sound is not very good. But when I use the wav file output option, the sound in the wave file sounds perfect. What does this mean? 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] wav output sounds good - what does this mean?
  2015-09-06 20:53 [Qemu-devel] wav output sounds good - what does this mean? Programmingkid
@ 2015-09-09  9:17 ` Stefan Hajnoczi
  2015-09-09 14:37   ` Programmingkid
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2015-09-09  9:17 UTC (permalink / raw)
  To: Programmingkid; +Cc: Gerd Hoffmann, qemu-devel qemu-devel

On Sun, Sep 06, 2015 at 04:53:29PM -0400, Programmingkid wrote:
> I have been working on making the sound output from the USB sound card actually sound good. When the audio is sent to CoreAudio, the sound is not very good. But when I use the wav file output option, the sound in the wave file sounds perfect. What does this mean? 

You didn't describe or post an example of the "not very good" sound via
CoreAudio.

Perhaps QEMU is not filling playback buffers quickly enough, causing
underruns?  These are drop-outs in the audio and are caused by missing
the real-time deadlines for filling playback audio buffers.

The wav output wouldn't have that problem since data is appended while
QEMU is running but you only listen to it later.  So the timing doesn't
matter and it will sound fine.

Another possibility is that QEMU isn't writing audio samples in the
format that CoreAudio expects, so you hear weird artifacts.

More info is needed...

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] wav output sounds good - what does this mean?
  2015-09-09  9:17 ` Stefan Hajnoczi
@ 2015-09-09 14:37   ` Programmingkid
  2015-09-09 18:04     ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Programmingkid @ 2015-09-09 14:37 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Gerd Hoffmann, qemu-devel qemu-devel


On Sep 9, 2015, at 5:17 AM, Stefan Hajnoczi wrote:

> On Sun, Sep 06, 2015 at 04:53:29PM -0400, Programmingkid wrote:
>> I have been working on making the sound output from the USB sound card actually sound good. When the audio is sent to CoreAudio, the sound is not very good. But when I use the wav file output option, the sound in the wave file sounds perfect. What does this mean? 

What I meant by doesn't sound very good is that the audio has a lot of static in it. It kind of sounds like a vinyl record being played back. There is also this deformed audio sound. Hard to describe in words. I could send you a sample of the audio, but I think it might be easier for you to try it yourself. If you are on Linux, use this command to build QEMU:
./configure --target-list=i386-softmmu --audio-drv-list=alsa --enable-sdl && make

To test the wav output option, use this command before starting QEMU:
export QEMU_AUDIO_DRV=wav

To test out live playback, use this command before starting QEMU:
export QEMU_AUDIO_DRV=alsa

Then to use the usb audio card, just add this to the command options you send to QEMU:
-usb -device usb-audio
or
"device_add usb-audio" in QEMU's monitor

I use qemu-system-ppc, but this problem is also present on qemu-system-i386. I have used Windows XP, Debian Linux, and Mac OS 10.2 as a guest, and they all have problems playing back audio using the usb sound card. So anyone of these operating systems can be used in the guest for testing. Using a Linux guest would probably yield better results. 

My attempts to 'make' QEMU on a Linux host haven't been very good lately, so I can't test it out right now. I probably need to reinstall Linux. It would be interesting to see how the usb-audio card sounds for you on Linux. If you do try, could you let us know how it sounds?


> You didn't describe or post an example of the "not very good" sound via
> CoreAudio.
> 
> Perhaps QEMU is not filling playback buffers quickly enough, causing
> underruns?  These are drop-outs in the audio and are caused by missing
> the real-time deadlines for filling playback audio buffers.

I was thinking it was a buffer issue also. :) Maybe increasing the size of the buffer
would help.

> 
> The wav output wouldn't have that problem since data is appended while
> QEMU is running but you only listen to it later.  So the timing doesn't
> matter and it will sound fine.
> 
> Another possibility is that QEMU isn't writing audio samples in the
> format that CoreAudio expects, so you hear weird artifacts. 

I have tried every other format I could find. By that I mean these:
AUD_FMT_U8
AUD_FMT_S8
AUD_FMT_S16
AUD_FMT_U16
AUD_FMT_U32
AUD_FMT_S32

The best sounding one is the one that is currently being used: AUD_FMT_S16.

> 
> More info is needed...
> 
> Stefan

On second thought, I will send you audio samples of both live playback and wav output in a second email.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] wav output sounds good - what does this mean?
  2015-09-09 14:37   ` Programmingkid
@ 2015-09-09 18:04     ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2015-09-09 18:04 UTC (permalink / raw)
  To: Programmingkid; +Cc: Gerd Hoffmann, qemu-devel qemu-devel

On Wed, Sep 9, 2015 at 3:37 PM, Programmingkid
<programmingkidx@gmail.com> wrote:
> On second thought, I will send you audio samples of both live playback and wav output in a second email.

Thanks.  In my reply I mentioned that there is definitely a timing
problem because the song was at a slower tempo in the live audio
capture.  That is either caused by buffer timing issues or by a bad
sample rate conversion algorithm (I haven't checked how QEMU does it).

There's a third possibility if you're using the ALSA sound system on
the host.  Make sure no other applications are accessing the ALSA
device.  This includes PulseAudio.

I've heard weird issues like this when multiple applications use a
sound device and change settings (e.g. sample rate) at the same time.
You can use pavucontrol to disable PulseAudio on the sound device, if
necessary.

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-09 18:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-06 20:53 [Qemu-devel] wav output sounds good - what does this mean? Programmingkid
2015-09-09  9:17 ` Stefan Hajnoczi
2015-09-09 14:37   ` Programmingkid
2015-09-09 18:04     ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).