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.