[pulseaudio-discuss] Merging soxr
Alexander E. Patrakov
patrakov at gmail.com
Wed Jan 7 09:48:49 PST 2015
07.01.2015 15:14, Alexander E. Patrakov wrote:
> I will retest with qemu (via its alsa backend) later today.
Done, both for "pa" and "alsa" backends. I must say that soxr-based
resamplers break a configuration that worked fine (except the initial
period of several seconds) with speex-float-5. Namely, after some
seconds of initial crackling (which is a KVM limitation), speex-float-5
produces clear sound for at least 5 minutes. soxr-based resamplers
produce a constant stream of underruns.
The (insane) configuration below is the one required to get
somewhat-nonbroken audio from KVM running a Mac OS X guest. You cannot
increase latency here, because we need to emulate the sound card driven
by Mac OS X in their equivalent of tsched mode (which cannot be switched
off) with quite strict scheduling safety margin (which cannot be
configured). I.e., increasing latency would lead to qemu-level underruns
where it fails to copy the sound data from the memory belonging to the
emulated device in time and copies a piece of silence instead.
Inside the guest, an mp3 file (44100 Hz stereo) was played using afplay
through the VoodooHDA driver. On the host (which has an onboard
snd-hda-intel card), pulseaudio was restricted to 48000 Hz using
daemon.conf to force resampling.
#!/bin/sh
export QEMU_AUDIO_DRV=pa
export QEMU_PA_SAMPLES=440
export PULSE_LATENCY_MSEC=8 # gets clamped to 2 ms for unknown reason
export QEMU_AUDIO_TIMER_PERIOD=1000
nohup \
flock -n hda.dsk \
qemu-system-x86_64 -enable-kvm -m 2048 -cpu core2duo -smp 2 \
-machine q35 \
-vga std -sdl \
-soundhw hda \
-usb -device usb-kbd -device usb-mouse \
-device isa-applesmc,osk="...(c)AppleComputerInc" \
-smbios type=2 \
-device ide-drive,bus=ide.2,drive=MacHDD \
-drive id=MacHDD,if=none,file=hda.dsk \
-netdev user,id=hub0port0 \
-device virtio-net,netdev=hub0port0,id=mac_vnet0 \
-monitor stdio \
</dev/null >/dev/null 2>&1 &
(search Google for OSK0 and OSK1, the command line was mostly
copy-pasted from
http://blog.ostanin.org/2014/02/11/playing-with-mac-os-x-on-kvm/ )
Also, with PulseAudio forced to 44.1 kHz, FooBar2000 v1.2 (which uses
DirectSound and thus, by default, resamples everything to 48 kHz) just
plays silence (with a neverending stream of underruns in pulseaudio log)
over soxr-vhq and works fine over speex-float-5. soxr-hq and soxr-mq
also work fine with wine.
If you don't have Mac OS X, you can also reproduce the first bug (which,
BTW, also applies to -mq and -hq) with paplay:
paplay --latency-msec=8 any-44100hz-stereo-file.flac
Note again: there are constant underruns in this case in the pulseaudio
log, which are not present with speex-based resamplers.
Or you can just dismiss the issue, because the testcases just request
latency that cannot be satisfied with soxr.
--
Alexander E. Patrakov
More information about the pulseaudio-discuss
mailing list