[asterisk-dev] Wideband and DSP

Dmitry Andrianov dimas at dataart.com
Wed Nov 4 17:37:44 CST 2009


Hello.
As I understand in 1.6.2 there is support for wideband codecs however the support is not complete yet. Im thinking about one of these incompletnesses:
I know that DSP assumes 8Khz sampling everywhere. It needs to be somehow updated for a higher bitrates. It is doable if you know sample rate of the signal you are processing (which DSP code currently does not know assuming 8 KHz). How this can be solved? I see several options:
1.	Derive sample rate from the format of frame passed. And if it changed since last frame, reset.
2.	Same as previous plus downsample the frame to 8 KHz inside DSP
3.	Add an API to DSP which allows specifying sample rate
4.	Something different (?)

Obviously the benefit of #1 is that no code except for dsp.c need to be touched  if some channel receives wideband audio, it just passes it to the DSP which does the rest. However if a channel can switch between different sample rates (codecs), we will need to reset DSP state on each such change detected. And in imaginary situation where codec changes in the middle of some tone being detected  we wont detect the tone because of DSP reset.

#2 simplifies the solution even more because it even leaves most of DSP code untouched  it still hardcoded to 8 KHz data. The data is just doownsampled to 8 KHZ inside dsp.c before passing them to real detection code. The approach will even handle (imaginary) situation with codec switch in the middle.

#3 is the most complex approach because it requires some architectural changes. The channel driver (or whatever constructs DSP) should know current sample rate and can be notified when any stream properties (here the sample rate) changes. When sample rate changes, channel driver notifies DSP 


I feel really strange about #1 and #2 because to me they look like a hack. Im curious if some of you already thought about the problem and have some solution in mind. Or someone knows the way it implemented in other products.

Any thoughts?

Regards,
Dmitry Andrianov




More information about the asterisk-dev mailing list