wav output sounds good - what does this mean?
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?
Quoted 1 line · Programmingkid
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
Quoted 2 lines · Stefan Hajnoczi
Quoted 1 line · Programmingkid
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?
Quoted 6 lines
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.
Quoted 7 lines
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_U8AUD_FMT_S8AUD_FMT_S16AUD_FMT_U16AUD_FMT_U32AUD_FMT_S32
The best sounding one is the one that is currently being used: AUD_FMT_S16.
Quoted 4 lines
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.
Quoted 1 line · Programmingkid
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