[op25-dev] Re: OP25 GRC - Almost but not quite working

argilo314 argilo at gmail.com
Mon Jun 11 23:58:04 UTC 2012


I found the correct fix for the phase issue in the fine transition code.  There was pi^2 in a couple places where it should have been 2*pi.  Here's a patch that includes all my fixes so far:

Index: blocks/src/lib/software_imbe_decoder.cc
===================================================================
--- blocks/src/lib/software_imbe_decoder.cc	(revision 301)
+++ blocks/src/lib/software_imbe_decoder.cc	(working copy)
@@ -757,6 +757,7 @@
 {
    int i,j;
 	//initialize
+   OldL = 0;
    Old = 1; New = 0;
    psi1 = 0.0;
    for(i=0; i < 58; i++) {
@@ -931,7 +932,7 @@
 //         if(abs((int)sample) > 32767) {
 //            sample = 32767 * (sample < 0) ? -1 : 1; // * sgn(sample)
 //         }
-         sample /= 16384.0; /* 32768.0 - but audio amplitude is not full range of int16  */
+         sample /= 65536.0;
          samples->push_back(sample);
       }
    }
@@ -1394,10 +1395,8 @@
       if(vee[ell][ New]) {
          if ( vee[ell][ Old]) {
             if(ell < 8 && fabsf(w0 - Oldw0) < .1 * w0) { // (fine transition)
-               const double PI_SQUARED = M_PI * M_PI;
-               const double INV_PI_SQUARED = 1.0 / PI_SQUARED;
                Dpl = phi[ell][ New] - phi[ell][ Old] -(Oldw0 + w0) * ell * 80;
-               Dwl = .00625 * (Dpl - PI_SQUARED * floorf((Dpl + M_PI) * INV_PI_SQUARED));
+               Dwl = .00625 * (Dpl - 2 * M_PI * floorf((Dpl + M_PI) / (2 * M_PI)));
                THa = (Oldw0 * (float)ell + Dwl);
                THb = (w0 - Oldw0) * ell * .003125;
                Mb = .00625 *(MNew - MOld);

--- In op25-dev at yahoogroups.com, "rrgsti" <bobrich at ...> wrote:
>
> I admire your tenacity Clayton!
> 
> The change to software_imbe_decoder does improve audio quality at this end as well.  I added a small amount of logging and noted that the code is going back and forth between the fine and coarse transition operations, so it doesn't seem like something is just 'pegged' at a wrong value.  This is all magic to me, however, so I have no intuition about what is or is not correct.
> 
> This is running on 11.10 with itpp 4.07 built from source, latest copies of op25 and fairly recent gnuradio and gr-baz.
> 
> Thanks!
> 
> --- In op25-dev at yahoogroups.com, "argilo314" <argilo@> wrote:
> >
> > I've made a bit of progress.  It appears that the phase calculation in  software_imbe_decoder::synth_voiced is not correct in the "fine transition" case, resulting in abrupt phase shifts between the 20ms frames.  I'm not sure yet how to correct it, but by commenting out the "fine transition" case completely so that the "coarse transition" case always runs instead, I've eliminated most of the warble.
> > 
> > Another problem I noticed is that the audio output is sometimes greater than 1.0, resulting in clipping if connected directly to an audio sink.  I corrected this by changing the "sample /= 16384.0;" line at the end of software_imbe_decoder::decode_audio back to "sample /= 32768.0;".
> > 
> > - Clayton
> > 
> > --- In op25-dev at yahoogroups.com, "argilo314" <argilo@> wrote:
> > >
> > > I'm getting the same issue with the sound: speech is intelligible but with a strong warble that makes it sound like talking through a fan.  I had a quick look at the waveform and spectrum of the output but didn't spot any obvious problems there.  Not knowing IMBE, I couldn't get far with the code.  Any ideas?
> > > 
> > > - Clayton
> > > 
> > > --- In op25-dev at yahoogroups.com, "rrgsti" <bobrich@> wrote:
> > > >
> > > > Basically looking at bit 113 (only) seems to indicate whether or not it's a voice frame of some sort.  The audio still sounds like everyone is talking through a fan, but there are no dropouts, no clicks, no stutters, etc.  
> > > > 
> > > > I could not find anything resembling a DUID or NAC in the headers.  If anyone has a suggestion to de-warble the audio, I would greatly appreciate it.
> > >
> >
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/op25-dev/attachments/20120611/296a440c/attachment.html>


More information about the op25-dev mailing list