AEC in FreeCalypso

Mychaela Falconia mychaela.falconia at gmail.com
Fri Jul 30 07:22:35 UTC 2021


Hello FC community,

Our dear Calypso includes a rather important feature called AEC:
Acoustic Echo Cancellation.  If you have an FCDEV3B setup complete
with a loudspeaker and microphone and if you ever tried making voice
calls with it, you may have noticed the following quirk: while you
hear call downlink audio in the speaker just fine, your voice may not
sound very good to the person on the far end of the call, and they
will also hear a delayed echo of their own voice, which is highly
annoying.

The issue of your voice sounding well or not-so-well to the person on
the far end of the call has to do with voice uplink tuning, which is
still in need of more work, but the issue of them hearing a delayed
echo of their own voice is the well-known problem of acoustic echo:
the microphone picks up sound from the loudspeaker and sends it back
to the party on the far end of the call.  This problem exists in all
loudspeaker call setups (cellular or otherwise), and is classically
solved by inserting an acoustic echo cancellation (AEC) function into
the loudspeaker calling station's voice uplink path, typically
implemented in a DSP.

Our dear Calypso DSP is no exception to this general principle, and it
also features a working AEC block - after all, Pirelli DP-L10 is a
Calypso-based phone with a hands-free loudspeaker function, and it
works just fine, without people on the far end of the call complaining
about poor voice quality or delayed echo of their own voice.  However,
Calypso AEC is not enabled by default, which is why that unpleasant
echo is present when you play with an FCDEV3B loudspeaker setup - in
order for AEC to work, it needs to be explicitly enabled and
configured.

I am currently in a dialogue with someone who may be receiving more
hardware from me, likely a mix of FCDEV3B and Caramel2 hw, and because
out of the two boards FCDEV3B has much cleaner analog audio, it is the
recommended board for those who need good analog voice call audio
right now, without waiting for a future solution.  But because the
acoustic echo problem has been a known issue for all of the years that
we've had these boards, I decided that now is the time to finally dig
into it and get AEC working - so I dug in, and here is what I
discovered:

1) TI's official TCS211 firmware delivery, the one that was used by
Openmoko, was misconfigured by none other than TI themselves!  Now to
put the blame in the right place, it was not a fault of TI's engineers
- they did their job just fine - instead it was TI's configuration
management and release packaging people who screwed up.  The version
of AEC implemented in Calypso DSP is the "new" one, in the appropriate
relative sense of "new" (in LoCosto they changed AEC implementation
yet again to a very different one), and the L1_NEW_AEC configuration
symbol (C #define) needs to be set to 1 to match the underlying DSP
reality - but TI's TCS211 delivery had it set to 0.  Furthermore, OM
got that part of the code as compiled binary objects, hence they could
not change this config without deblobbing L1 first - a job that was
successfully done by me in 2015-2017, but that was well past OM's
demise.

2) The designers of Pirelli DP-L10 were one of many Calypso-based
phone manufacturers who took it upon themselves to fix TI's blunders:
poking at Pirelli's fw with fc-tmsh reveals that they use the "new"
type of AEC, and furthermore, Pirelli's fw features two different
tuned AEC configs for handheld and loudspeaker modes.  I was able to
read out both of these AEC configs with fc-tmsh aur 12 command, and
after enabling L1_NEW_AEC in FC Tourmaline fw, I took Pirelli's
loudspeaker AEC config and applied it to our FCDEV3B.  Result: much
better voice quality as perceived by the person on the far end of the
call, and no more echo!

If anyone else has an FCDEV3B with a loudspeaker and microphone and
would like to replicate my success with AEC, you will need the
following pieces:

1) Compile and flash the latest Tourmaline firmware - it needs to be
Tourmaline, not Magnetite or Selenite.  When building for a pure modem
like FCDEV3B or non-Luna Caramel2, select stdmodem configuration in
Tourmaline.

2) A ready-to-go audio mode config that can be loaded with AT at AUL has
not been produced yet - see below - but you can enable and configure
AEC manually with fc-tmsh auw 12 commands.  If you pull the latest
updates in fc-audio-config Hg repository, you will find a new directory
named newaec - inside this directory you will find a few one-liners
that execute fc-tmsh auw 12 with different numbers.  If you run
'sh newaec/pirelli-handfree' against the latest Tourmaline fw, you
will get the "good" AEC configuration.

As next steps, I plan on doing the following:

1) I am going to put out new official fw builds for both FCDEV3B and
Tango/Caramel2, based on Tourmaline source tree instead of Magnetite.
The time has come to make the switch, AEC is an important feature to
have working, and it can only work correctly in forward-looking
Tourmaline, not in backward-compatible Magnetite.

2) At some point soon, I will also need to put out a new release of FC
host tools.  The important change here is new ability in tiaud-compile
to create audio mode configs with the new AEC, and new support in
tiaud-decomp to disassemble such audio mode files from binary back to
ASCII.  This new release of FC host tools will need to be put out
before I can create new AEC-enabled audio modes in fc-audio-config,
which will in turn be needed in order to enable AEC and other audio
tunings with AT at AUL, without needing fc-tmsh which is a lab debug tool.
However, I would like to get a few additional developments into the
code before I make the release, so there will be some delay.

Hasta la Victoria, Siempre,
Mychaela aka The Mother


More information about the Community mailing list