[Alsa-user] Recording sound on ARM processor causes 30% CPU load
Brought to you by:
perex
From: Rudi v. d. L. <ru...@an...> - 2006-04-10 07:02:28
|
Hi All, I am writing an application on an ARM based embedded computer. And have found a few difficulties with the process. Any help or explanations on the following points would be appreciated. 1. The hardware is running at an incorrect clock rate. This causes a +-46.8 kHz frame rate to be supplied to the CPU. When I compile the kernel with this value as the ALSA clock I get "double the error" (i.e. an actual data rate of [requested data rate]*(46.8/48)*(46.8/48) bps). But when I compile it with an ALSA clock rate of 49.1 kHz (i.e. fix it with 48000*(desired clock rate)/(actual clock rate)) an actual stream of 48kHz is reproduced (i.e. [requested data rate] * (46.8/48 {hardware fault})*(48/46.8) {49.1kHz setting in kernel}) My question is, why does it work "the wrong way round"? Should one not supply the actual hardware clock rate, instead of a "corrected" clock rate? 2. I have noticed that recording with the "snd_pcm_readi" function uses 30% of the CPU (I have tried blocking and non-blocking modes). As well as registering a callback, again blocking and non-blocking, as well as using poll/select (blocking and non-blocking). The best I can do is 30% CPU load, which seems a lot. 'arecord' also uses 30% CPU (measured with 'top'). The strange thing is that 'aplay' hardly uses any CPU power (2-3%). Any ideas how I can reduce the CPU loading? Is this an ARM limitation? A known ALSA driver/library problem? An implementation problem? Any other ideas? I am not sure what information would be required, but my configuration is as follows: ARM based PC-104 CPU running at 400MHz - The Viper PC-104 SBC from Arcom UK, running a Debian based Linux kernel tailored for the CPU, Linux 2.6.13 (patched) to run on the Viper, to correct the ALSA clock rate and some FLASH issues. I am not sure how to obtain the version of ALSA itself, amixer, aplay and arecord all return a version of 1.0.8. I am a bit reluctant to try and compile a new version of the ALSA drivers and libraries since I do not know what changes would be required to get it to work on this embedded CPU. Regards, Rudi Rudi van der Linde ru...@an... Note: This message (and attachments) is subject to restrictions and a disclaimer. Please refer to http://www.ansys.co.za/index.html or ge...@an... for full details. |