[pulseaudio-discuss] latency in loopback between different audio devices
Craig Matsuura
cmatsuura at vivint.com
Fri Aug 1 07:01:54 PDT 2014
Here is a followup on my question. (I hope this is the right place to ask these questions)
I have set the rate to force to 8000Hz (So now the codec is set to 8000Hz matches the GSM fixed rate of 8000Hz), which makes pulseaudio to use the resampler of copy, so no resampling is required. This has helped with the latency, reduced significantly.
I do have instances where the audio playback will not play until I suspend and un-suspend the codec sink. (Seems strange). Also noticed when I suspend a sink that has not played anything twice in a row that pulse terminates.
Thanks,
Craig
On 07/25/2014 11:57 PM, Craig Matsuura wrote:
I have a question in regards to latency increasing?
I have an embedded system that is using pulseaudio 1.1 (sorry, this is what is supported at the moment for our platform). We have connected two sound card devices using loopback. One is a GSM modem with a sink/source and the other is a audio codec (AIC3104). Using loopback module to connect the sink/source and source/sink GSM and Codec.
The delay is primarily from the Codec Mic source to the GSM sink. So over the GSM I hear delayed audio from the mic of the codec. After waiting some time after pulse has been running the delay becomes more significant (several secs, minutes even)
The GSM device uses a fixed sample spec: s16le 1ch 8000Hz, the codec is at sample spec: s16le 2ch 44100Hz. (which is programmable according to the datasheet)
The codec can sample at different rates.
>From the datasheet of the aic3104
"The stereo audio DAC supports sampling rates from 8 kHz to 96 kHz and includes programmable digital filtering
in the DAC path for 3D, bass, treble, midrange effects, speaker equalization, and de-emphasis for 32-kHz,
44.1-kHz, and 48-kHz sample rates. The stereo audio ADC supports sampling rates from 8 kHz to 96 kHz and is
preceded by programmable gain amplifiers or AGC that can provide up to 59.5-dB analog gain for low-level
microphone inputs. The TLV320AIC3104 provides an extremely high range of programmability for both attack
(8–1,408 ms) and for decay (0.05–22.4 seconds). This extended AGC range allows the AGC to be tuned for
many types of applications."
So I'm trying to understand why I get this delay. I have setup the loopback as followed.
load-module module-loopback source="alsa_input.codec.input" sink="alsa_output.gsm.output" latency_msec=1
load-module module-loopback source="alsa_input.gsm.input" sink="alsa_output.codec.output" latency_msec=1
My devices are setup in my session file as follow:
load-module module-alsa-source device=hw:0,1 name=gsm.input
load-module module-alsa-sink device=hw:0,1 name=gsm.output
# Load the Codec source and sink given the names below
load-module module-alsa-source device=hw:0,0 name=codec.input control=PGA
load-module module-alsa-sink device=hw:0,0 name=codec.output control=PCM
What is confusing to me is the longer pulse is running seems the latency increase from the codec mic even if when I'm not using the mic. Its like it is always capturing as I hear previous audio when I setup the loopback on the GSM side.
* Should I be setting up the same sample rates?
* So the codec source is forced to be at s16le 1ch 8000Hz to match the GSM so there is no resampling?
* Is it a buffer problem?
* Can I flush the codec mic side to not have any audio data in the buffers so when I connect up via loopback I don't here old audio?
Also to note I have tried several different resample-methods and have had to stick with in trivial (kind of tinny sounding) or src-linear (sounds better) for the best performance as my ARM system does not seems to have enough CPU for any of the other resample methods.
I don't think it matter but I also have a DTMF monitor on the GSM source (alsa_input.gsm.input) so I can detect DTMF (which is working well for me using multimon-ng)
Thanks,
Craig
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss at lists.freedesktop.org<mailto:pulseaudio-discuss at lists.freedesktop.org>
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20140801/71160db8/attachment.html>
More information about the pulseaudio-discuss
mailing list