[alsa-devel] [Audacity-devel] distortion with alsa I/O - no distortion with oss emulation
simon.lewis at mnet-online.de
Sat Apr 7 12:44:15 CEST 2007
Dear Alsa developers
Audacity seems to work perfectly with AOSS and Jack but not directly
with ALSA on some linux PCs. Trying to use ALSA directly leads to severe
distortion due to lack of sync with Alsa. (I hope that is the correct
I received this reply from the Audacity developers, what tools are
available from ALSA to investigate this problem? How can I determine
what the real "Alsa configuration" is that portaudio has used setting up
communication with Alsa.
Best Regards, Simon
> Markus Meyer schrieb:
> As for Simon's problems with "synchronisation", I'm not so sure that it
> is a Portaudio issue, or a software issue at all. Software issues tend
> to be of the "on/off" type, and Portaudio does work well with ALSA in
> the general case. Apart from being a hardware issue (defective sound
> card, main board or something) this could also well be a race condition
> in the ALSA driver (kernel module) which is only triggered by certain
> buffer sizes, order of driver requests etc. Because Audacity is
> multi-threaded it certainly stresses the driver/kernel subsystem more
> than just, say, "arecord", which just gets blocks from the driver and
> writes it out to disk.
>> Simon Lewis schrieb:
>> The main issue is that on some linux machines, mine included, there is
>> severe distortion when Audacity is used with ALSA drivers.
>> You will be pleased to hear that I have found the root cause of the
>> problem. It is nothing to do with the options with which Audacity is
>> compiled. The root cause is that portaudio loses synchronisation with
>> ALSA's data stream.
>> I was able to verify this yesterday, as I could start Audacity with
>> Jack, and through Jack set up a number of simulation conditions and
>> monitor the results.
>> With my standard Jack settings of 96kHz / 256 Frames per period / 2
>> periods per buffer (latency 5.33 msecs.), ALSA initialises with sample
>> format 32bit little-endian, 2 periods for capture and 2 periods for
>> Under these conditions Audacity cannot synchronise with the data stream
>> and severe distortion is the result.
>> However, increasing the frames per period to 1024 (latency 21.3 msec)
>> and Audacity (1.3.2 with resampling disabled) runs perfectly and I can
>> record for a long time. (CPU load is 9.6%)
>> Reducing the frames per period to 512 and the same version of Audacity
>> starts OK but after a few seconds, sometimes longer losses sync with the
>> data stream.
>> The standard 1.3.2 version of Audacity with resampling enabled does not
>> sync on start with 512 frames per period but runs OK with Jack set to
>> 1024 frames per period.
>> The 1.3.3 version of Audacity complied with libsamplerate without
>> portmixer runs OK with 512 frames per period under jack.
>> NONE of the Audacity versions will run directly with the ALSA drivers.
>> The Version with resampling disabled often starts OK, but after 30 sec
>> to a few minutes of recording sync is lost and naturally distortion is
>> the result.
>> The conclusion is that portaudio is very poor at syncing with the
>> alsadata stream, something which Jack can do with very little buffering.
>> Ciao, Simon
More information about the Alsa-devel