[Speex-dev] reducing latency?
Thorvald Natvig
speex at natvig.com
Sat Sep 10 04:32:18 PDT 2005
> How can I reduce latency on the following?
> arecord -r22050 -c2 -fs16_le | speexenc - - | speexdec -
> I have no coding experience in C, so can't write my own stdin/stdout
> wrapper. this is just an echo test, but it's severely lagged. the
> mailing list posts on this subject didn't give a solution.
> I used this over ssh, and managed to have a usable conversation with
> someone, accept for the lag which eliminating from the echo test would
> help somewhat.
> Any suggestions would be appreciated.
Arecord buffers; you can adjust the buffer time with command line
options.
Also, if you're using ALSA on a soundcard where the driver doesn't support
hardware mixing of audio streams, you have two choices; either open the
device exclusively for speexdec (meaning no other sound applications,
including gnome/kde mixers -- you'll find info on this in the ALSA
configs) or accept that ALSA introduces lag in it's mixing buffer.
In addition, there is a miniscule buffer in speexdec, around line 583-585;
it will buffer up to 200 bytes of input at a time, but you probably don't
need to worry about it.
speexenc will buffer, and may actually buffer quite a lot. If you add
fflush(fp) before the return of oe_write_page in speexenc.c (line 73),
this should go away.
All this being said, I don't think these tools were meant for interactive
two-way communication; see http://www.speex.org/projects.html for a list
of working two-way communications apps that use Speex.
More information about the Speex-dev
mailing list