[Home]

Summary:ASTERISK-04625: [patch] Speex preprocessor + fixed-point compatibility etc
Reporter:James Cowling (jcowling)Labels:
Date Opened:2005-07-20 00:29:25Date Closed:2008-01-15 15:45:48.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/CodecInterface
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) speex_preproc_all_versions.patch
( 1) speex_preproc.patch
( 2) speex_preprocreally_fixed.patch
Description:This patch integrates the Speex preprocessor, configurable via codecs.conf and disabled by default.  This provides very good voice activity detection (*much* better than native Speex DTX) along with automatic gain control, denoise and dereverb.


Additional changes made:

- codec_speex now handles all audio as spx_int16_t datatype.  speex_encode_int converts to floating point for us where necessary.  This avoids a small amount of overhead and gives users the option of compiling speex in fixed-point mode, for CPUs with poor floating-point capability.

- speex_slin_ex.h has been changed to half a second of real speech, rather than dummy input like the other XXX_slin_ex.h's.  The old dummy input would be interpreted as silence when preprocessor VAD is enabled, causing calc_cost in translate.c to crash when it didn't get the expected number of frames returned.  (PS. Do I need to change the copyright statement in the header comment?)

- descriptive comments for codecs.conf

- few minor bug fixes in parsing floats from config file

- fixed formatting from previous codec_speex update

****** ADDITIONAL INFORMATION ******

A lot of this is similar to the functionality of iaxclient, which I unfortunately only discovered after making the changes :P

The timestamp bug in 0004707 still stands and will affect quality when preprocessor VAD is enabled, particularly with the jitterbuffer.  Performance is no worse than for DTX implemented in 0004608 however.
Comments:By: Clod Patry (junky) 2005-07-20 01:23:56

Normally, we increase version, not decreasing.
-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.17 $")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.16 $")

And that line is automatiquely updated by itself, just ignore it.

Like i dont know that codec, i'll leave someone else post comments on it, that's just my 2 cents.

By: James Cowling (jcowling) 2005-07-20 01:44:12

Ignore that line - it wasn't edited manually, just an accidental 'diff' artifact from me creating version 1.18 from my copy of 1.16 (the formatting was a bit screwed in version 1.17).  I think it's quite clear I didn't intend for the version number to decrement.

I'll upload a new patch...

By: James Cowling (jcowling) 2005-07-25 20:07:40

I've patched the timestamp problems in 0004707 and they've been merged into the CVS, so VAD should function very well now.

By: Michael Jerris (mikej) 2005-07-25 22:47:29

ok, so where does this stand then?  ready for testing and review?

By: James Cowling (jcowling) 2005-07-26 00:01:46

Ready to go as far as I'm concerned.

By: Michael Jerris (mikej) 2005-07-26 06:28:07

can you please gather up some outside testing on this and get comments from those testers on the bug please.

By: James Cowling (jcowling) 2005-07-28 03:09:00

I'm moving overseas in a few days so hopefully this gets sorted before then - there's a post on the Asterisk-Dev list at the moment.

Just a quick note to people trying this out - I've modified slin_speex_ex.h so you'll need to do a 'make clean' before compiling.  Be sure to check the new codecs.conf.sample and enable the preprocess and pp_vad settings.

By: James Cowling (jcowling) 2005-07-28 20:51:51

Just checked the old Speex 1.0.x stable branch and it doesn't include the preprocessor.  I'll try and post a patch soon to check for this.

By: nick (nick) 2005-07-28 20:56:55

Let's remember to increment the cleancount when we put this in then.

By: James Cowling (jcowling) 2005-07-31 20:04:15

I'm going to be away for a week so this might have to go on hold for a while unfortunately...

By: Jason Sjöbeck (sjobeck) 2005-08-11 12:37:32

FYI
from speex.org
Current Stable Release  1.0.5
Current Unstable Release 1.1.10

By: James Cowling (jcowling) 2005-08-15 04:03:59

Alrighty, I added some #ifdef's to (automatically) avoid loading the speex_preprocess and speex_types libraries for versions of Speex below 1.1.8.  It *would* be possible to load a partial set of this functionality in slightly older versions, but we'd end up with some very messy source code - if users want advanced functionality they aught to be using a newish version of Speex anyway.

I tested this for Speex 1.1.8+ (unstable) and Speex 1.0 (stable) - functionality is limited in the old versions but everything will compile and run fine.  This is all transparent to the user so it shouldn't introduce any problems.

By: Kevin P. Fleming (kpfleming) 2005-08-26 16:12:36

Committed to CVS HEAD, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:45:48.000-0600

Repository: asterisk
Revision: 6426

U   trunk/codecs/codec_speex.c
U   trunk/codecs/slin_speex_ex.h
U   trunk/configs/codecs.conf.sample

------------------------------------------------------------------------
r6426 | kpfleming | 2008-01-15 15:45:48 -0600 (Tue, 15 Jan 2008) | 2 lines

update to use Speex 1.1.x features and doc cleanups (issue ASTERISK-4625)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=6426