Return-Path: Received: from post.thorcom.com (post.thorcom.com [195.171.43.25]) by klubnl.pl (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id wBTL0caU026385 for ; Sat, 29 Dec 2018 22:00:46 +0100 Received: from majordom by post.thorcom.com with local (Exim 4.14) id 1gdLfQ-00068F-8p for rs_out_1@blacksheep.org; Sat, 29 Dec 2018 20:57:08 +0000 Received: from [195.171.43.32] (helo=relay1.thorcom.net) by post.thorcom.com with esmtp (Exim 4.14) id 1gdLfP-000686-F5 for rsgb_lf_group@blacksheep.org; Sat, 29 Dec 2018 20:57:07 +0000 Received: from mout3.freenet.de ([195.4.92.93]) by relay1.thorcom.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91_59-0488984) (envelope-from ) id 1gdLfN-0007Xb-49 for rsgb_lf_group@blacksheep.org; Sat, 29 Dec 2018 20:57:06 +0000 Received: from [195.4.92.165] (helo=mjail2.freenet.de) by mout3.freenet.de with esmtpa (ID dl4yhf@freenet.de) (port 25) (Exim 4.90_1 #2) id 1gdLfK-0006J3-1k for rsgb_lf_group@blacksheep.org; Sat, 29 Dec 2018 21:57:02 +0100 Received: from [::1] (port=49168 helo=mjail2.freenet.de) by mjail2.freenet.de with esmtpa (ID dl4yhf@freenet.de) (Exim 4.90_1 #2) id 1gdLfK-0003rF-0n for rsgb_lf_group@blacksheep.org; Sat, 29 Dec 2018 21:57:02 +0100 Received: from sub0.freenet.de ([195.4.92.119]:39156) by mjail2.freenet.de with esmtpa (ID dl4yhf@freenet.de) (Exim 4.90_1 #2) id 1gdLcW-0003Mw-7F for rsgb_lf_group@blacksheep.org; Sat, 29 Dec 2018 21:54:08 +0100 Received: from dslb-088-070-149-160.088.070.pools.vodafone-ip.de ([88.70.149.160]:53005 helo=[192.168.178.26]) by sub0.freenet.de with esmtpsa (ID dl4yhf@freenet.de) (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256) (port 587) (Exim 4.90_1 #2) id 1gdLcV-0001U5-Gf for rsgb_lf_group@blacksheep.org; Sat, 29 Dec 2018 21:54:08 +0100 To: rsgb_lf_group@blacksheep.org References: <340063417.10486355.1546075700695.ref@mail.yahoo.com> <340063417.10486355.1546075700695@mail.yahoo.com> <1546076873573.21670@kuleuven.be> From: =?UTF-8?Q?Wolfgang_B=c3=bcscher?= Message-ID: <005b0259-df03-2249-3996-2828834a0072@freenet.de> Date: Sat, 29 Dec 2018 21:54:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1546076873573.21670@kuleuven.be> Content-Language: en-US X-Originated-At: 88.70.149.160!53005 X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "relay1.thorcom.net", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Hi Rik, >  (maybe I should ask Wolf for advice) You're welcome. The "image rejecting up/down converter" is written in plain C. It should be easily portable. Uses a 37-tap FIR filter for the Hilbert transformer that rejects the "unwanted" mixing pro [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [195.4.92.93 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dl4yhf[at]freenet.de) 0.0 HTML_MESSAGE BODY: HTML included in message X-Scan-Signature: dc4c36868242ef73973efaa240b71891 Subject: Re: LF: JT9-5 decodes in km07ks Content-Type: multipart/alternative; boundary="------------42E7BE7773076CCD3178DA12" X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on post.thorcom.com X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=HTML_MESSAGE autolearn=no version=2.63 X-SA-Exim-Scanned: Yes Sender: owner-rsgb_lf_group@blacksheep.org Precedence: bulk Reply-To: rsgb_lf_group@blacksheep.org X-Listname: rsgb_lf_group X-SA-Exim-Rcpt-To: rs_out_1@blacksheep.org X-SA-Exim-Scanned: No; SAEximRunCond expanded to false This is a multi-part message in MIME format. --------------42E7BE7773076CCD3178DA12 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Hi Rik, >  (maybe I should ask Wolf for advice) You're welcome. The "image rejecting up/down converter" is written in plain C. It should be easily portable. Uses a 37-tap FIR filter for the Hilbert transformer that rejects the "unwanted" mixing product. Not sure if the sourcecode (indentation) survives the emailing process, but fyi it's attached below. If you think it's usable for your project, I can send everything (including the data type definitions and the filter coefficient table). Cheers,   Wolf . Below: Core of the "universal frequency converter / mixer" as currently used in Spectrum Lab (this is the simple one, without forward and reverse FFT). void SOUND_RunThroughMixer(       T_SOUND_FREQ_CONVERTER *pcnv,  // contains all parameters for a converter       T_Float *input_samples,  T_Float *input_samples_q,       T_Float *output_samples, T_Float *output_samples_q,       int    number_of_samples )  /* Frequency mixer. May transform the frequency for some kind of RX.   * Can optionally cancel one sideband using a Hilbert transformer,   * I/Q-mixer etc.   */ {  int    sample_i, j;  T_Float d, y, dbl_i, dbl_q;  const T_Float* coeff_ptr;  T_Float* queue_ptr;  T_Float* input_queue_end;  double  dblPhzInc;  int     iCosTableIndex, iSineTableOffset = 0;  T_Float dblNcoI, dblNcoQ;  double  dblNcoPhase = pcnv->dblNcoPhase;  // use local var for speed   // Prepare the NCO for the "mixer" frequency ...   // Note: SoundTab_fltCosTable[SOUND_COS_TABLE_LEN] contains exactly ONE PERIOD.   //       "Negative" frequencies are possible by inverting the Q-channel .   if(pcnv->dblFSample!=0)       dblPhzInc = (double)SOUND_COS_TABLE_LEN * pcnv->dblOscillatorFreq / pcnv->dblFSample;     else       dblPhzInc = 0;   // mixer frequency is ZERO, so noo phase increment   if(dblPhzInc > 0)    { // array index offset to read a SINE WAVE from a COSINE TABLE :      iSineTableOffset = (int) (0.499 + 3.0 * (T_Float)SOUND_COS_TABLE_LEN / 4.0);    }   else   // phase increment negative, "negative" mixer frequency ....    {      dblPhzInc = -dblPhzInc; // Make sure the table reading index INCREMENTS,                              // because the wrap test will not look for negative indices.      // Get array index offset to read a NEGATIVE SINE WAVE from a COSINE TABLE :      iSineTableOffset = (int)(0.499 + (T_Float)SOUND_COS_TABLE_LEN / 4.0);    } // end if   if(dblNcoPhase<0) dblNcoPhase = 0;   if(pcnv->fDcReject)    { // Accumulate & remove a bit DC offset from the new chunk:      for(sample_i=0; sample_idblMixerDcOffset =                      pcnv->dblMixerDcOffset  * 0.9999                    + input_samples[sample_i] * 0.0001;          // bad style to modifying the INPUT samples          //  but this won't hurt anyone :>          input_samples[sample_i] -= pcnv->dblMixerDcOffset;        }    }   if(pcnv->iMixerScheme==CFG_FREQ_MIX_DSB)    { // No sideband rejection:      //   This is a simple and very fast mixer without sideband-rejection.      //   No complicated broadband 90° phase shifter required.     for(sample_i=0; sample_i=(T_Float)SOUND_COS_TABLE_LEN) // "while", not "if" !!             dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap       d = SoundTab_fltCosTable[(int)dblNcoPhase];       // DSB mixer: simply multiply the input signal with the NCO output :       *output_samples++ = (*input_samples++) * d;      }    }  // end if   else   if(pcnv->iMixerScheme==CFG_FREQ_MIX_COMPLEX)    { // Complex multiplication of complex input :      //   (a + j*b ) * ( c + j*d )  =  a*c - b*d + j * ( a*d + b*c )      // To do this, SOUND_RunThroughMixer() must be called with      //   TWO source-  and TWO destination blocks.      //  (real and imaginary parts are in sepearate blocks)      if(  (input_samples!=NULL) && (input_samples_q!=NULL)         &&(output_samples!=NULL) && (output_samples_q!=NULL) )       {         T_Float inp_i, inp_q, outp_i, outp_q;         for(sample_i=0; sample_i=(T_Float)SOUND_COS_TABLE_LEN) // "while", not "if" !!                 dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap           iCosTableIndex = (int)dblNcoPhase;           dblNcoI = SoundTab_fltCosTable[iCosTableIndex];           dblNcoQ = SoundTab_fltCosTable[(iCosTableIndex+iSineTableOffset) % SOUND_COS_TABLE_LEN];           // Get complex input sample, multiply with complex oscillator, and put into output buffers:           inp_i = *(input_samples++);           inp_q = *(input_samples_q++);           outp_i = inp_i * dblNcoI - inp_q * dblNcoQ;           outp_q = inp_i * dblNcoQ + inp_q * dblNcoI;           *output_samples++   = outp_i;           *output_samples_q++ = outp_q;          }      }    }  // end if   else   if(   (pcnv->iMixerScheme == CFG_FREQ_MIX_LSB_DOWNCONVERTER )      || (pcnv->iMixerScheme == CFG_FREQ_MIX_USB_DOWNCONVERTER ) )    {   // Optimized mixer for "downconversion".        // Based on a schematic diagram from the ARRL handbook 1996,        // page 17.73:   "The R2: An image-rejecting D-C Receiver"        // Principle: Splitter, TWO Mixers (with I and Q output),        //            audio phase shift network, summer, filter.        // Note: 90° phase shifting is done AFTER mixing (in contrast to the        //           schemes  CFG_FREQ_MIX_LSB_UP  and CFG_FREQ_MIX_USB_UP.     for(sample_i=0; sample_i=(T_Float)SOUND_COS_TABLE_LEN)  // "while", not "if" !!             dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap       iCosTableIndex = (int)dblNcoPhase;       dblNcoI = SoundTab_fltCosTable[iCosTableIndex];       dblNcoQ = SoundTab_fltCosTable[(iCosTableIndex+iSineTableOffset) % SOUND_COS_TABLE_LEN];       // Now mix the incoming (higher-frequency) signal ..input_samples[]..       //         with a sine and a cosine signal from the NCO ("LO").       dbl_i = input_samples[sample_i];   // this is the INPUT signal       if(pcnv->iMixerScheme == CFG_FREQ_MIX_LSB_DOWNCONVERTER)        {         dbl_q =  dbl_i * dblNcoI;   // LSB (below NCO freq) moved DOWN         dbl_i =  dbl_i * dblNcoQ;        }       else  // the "other" sideband with reversed oscillator phases:        {         dbl_q =  dbl_i * dblNcoQ;   // USB (above NCO freq) moved DOWN         dbl_i =  dbl_i * dblNcoI;        }       // arrived here: dbl_i is the output of the "I"-mixer,       //               dbl_q is the output of the "Q"-mixer.       // Let the I-channel run through a delay line [ length (N-1)/2 ]       //  to compensate the delay from the hilbert trafo (see below).       if(  (pcnv->iDelayQIndex < 0)          ||(pcnv->iDelayQIndex >= ((SOUND_Hilbert_filter_length-1)/2)) )             pcnv->iDelayQIndex = 0;       y = pcnv->dblDelayQueue[pcnv->iDelayQIndex];       pcnv->dblDelayQueue[pcnv->iDelayQIndex++] = dbl_i;       dbl_i = y;       // Let the Q-channel run through a broadband 90° phase shifter       // (hilbert transformer, implemented as FIR filter here).       //    keep the circular buffer pointer 'valid' all the time :       input_queue_end = &pcnv->dblHilbertQueue[SOUND_Hilbert_filter_length-1];       if(  (pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0])          ||(pcnv->pdblHilbertQPointer > input_queue_end) )             pcnv->pdblHilbertQPointer = &pcnv->dblHilbertQueue[0];       if( --pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0] )             pcnv->pdblHilbertQPointer = input_queue_end; // deal with wraparound       *pcnv->pdblHilbertQPointer = dbl_q;     // hilbert trafo input       queue_ptr = pcnv->pdblHilbertQPointer;  // pointer to read from input queue       coeff_ptr = &SOUND_HilbertCoeffs[0]; // pointer to read from coeff table       y = 0.0;                  // clear the 'global adder'       j = (SOUND_Hilbert_filter_length+1)/2 -1;  // j=12 for 25th-order filter       while( j-- )              // do the MAC's (with every 2nd coeff ZERO)         {          // coeffs[0], [2], [4].. are (almost) zero and are not calculated          //                       so just skip the 'queue' pointer          ++queue_ptr;  ++coeff_ptr;          if( queue_ptr > input_queue_end ) // deal with wraparound              queue_ptr = &pcnv->dblHilbertQueue[0];          // odd coefficients, non-zero, do a MAC-operation :          y += ( (*queue_ptr++) * (*coeff_ptr++) );          if( queue_ptr > input_queue_end ) // deal with wraparound              queue_ptr = &pcnv->dblHilbertQueue[0];         }       dbl_q = y;    // filter output = sum from all 'taps'       // finally add the output of the "audio phase-shift network"...       output_samples[sample_i] = dbl_i + dbl_q;      } // end for (sample_i ... )    } // end if <..mixer_scheme == CFG_FREQ_MIX_USB_DOWNCONVERTER >   else // neither "double side band" nor "USB DOWNCONVERTER"....    {     for(sample_i=0; sample_iiDelayQIndex < 0)          ||(pcnv->iDelayQIndex >= ((SOUND_Hilbert_filter_length-1)/2)) )             pcnv->iDelayQIndex = 0;       dbl_i = pcnv->dblDelayQueue[pcnv->iDelayQIndex];       pcnv->dblDelayQueue[pcnv->iDelayQIndex++]             = input_samples[sample_i];       // Generate the Q-value by passing the real input through a       // hilbert transformer (which is implemented as an FIR filter here).       //    keep the circular buffer pointer 'valid' all the time :       input_queue_end = &pcnv->dblHilbertQueue[SOUND_Hilbert_filter_length-1];       if(  (pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0])          ||(pcnv->pdblHilbertQPointer > input_queue_end) )             pcnv->pdblHilbertQPointer = &pcnv->dblHilbertQueue[0];       if( --pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0] )             pcnv->pdblHilbertQPointer = input_queue_end; // deal with wraparound       *pcnv->pdblHilbertQPointer = input_samples[sample_i];  // filter input = "X"       queue_ptr = pcnv->pdblHilbertQPointer;  // pointer to read from input queue       coeff_ptr = &SOUND_HilbertCoeffs[0]; // pointer to read from coeff table       y = 0.0;                  // clear the 'global adder'       j = (SOUND_Hilbert_filter_length+1)/2 -1;  // j=12 for 25th-order filter       while( j-- )              // do the MAC's (with every 2nd coeff ZERO)         {          // coeffs[0], [2], [4].. are (almost) zero and are not calculated          //                       so just skip the 'queue' pointer #if(0)   // not optimized:          y += ( (*queue_ptr++) * (*coeff_ptr++) );  // here's the MAC #else    // optimized:          ++queue_ptr;  ++coeff_ptr; #endif          if( queue_ptr > input_queue_end ) // deal with wraparound              queue_ptr = &pcnv->dblHilbertQueue[0];          // odd coefficients, non-zero, do a MAC-operation :          y += ( (*queue_ptr++) * (*coeff_ptr++) );          if( queue_ptr > input_queue_end ) // deal with wraparound              queue_ptr = &pcnv->dblHilbertQueue[0];         }       dbl_q = y;    // filter output = sum from all 'taps'       // Let the NCO (numerical controlled oscillator) produce quadrature-phase signals :       dblNcoPhase += dblPhzInc;       while(dblNcoPhase >=(T_Float)SOUND_COS_TABLE_LEN) // "while", not "if" !!             dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap       iCosTableIndex = (int)dblNcoPhase;       dblNcoI = SoundTab_fltCosTable[iCosTableIndex];       dblNcoQ = SoundTab_fltCosTable[(iCosTableIndex + iSineTableOffset) % SOUND_COS_TABLE_LEN];       if(pcnv->iMixerScheme==CFG_FREQ_MIX_LSB_UP)        {         // multiply the I- and Q- samples with the sin- and cos- output         //     of the local oscillator.         output_samples[sample_i] =               dbl_q * dblNcoI  // multiply with "cosine"             - dbl_i * dblNcoQ; // multiply with "sine"        }       else // not LSB but USB:        {         output_samples[sample_i] =               dbl_i * dblNcoI  // multiply with "cosine"             - dbl_q * dblNcoQ; // multiply with "sine"        }      } // end for (sample_i ... )    } // end if   pcnv->dblNcoPhase = dblNcoPhase;  // save the NCO phase for next block } // end SOUND_RunThroughMixer() On 29.12.2018 10:47, Rik Strobbe wrote: > > Hello Markus, > > > nice copy on N1BUG, this might be a new distance record for Paul. > > > Thanks for your help with the JT9-2 and JT9-5 resampling. > > Lifting the frequency restriction on TX is "peanuts", but on RX I > would need to implement frequency conversion in SpecLab style. > > I will have a look to that (maybe I should ask Wolf for advice). > > > 73, Rik  ON7YD - OR7T > > > > ------------------------------------------------------------------------ > *Van:* owner-rsgb_lf_group@blacksheep.org > namens Markus Vester > > *Verzonden:* zaterdag 29 december 2018 10:28 > *Aan:* rsgb_lf_group@blacksheep.org > *Onderwerp:* Re: LF: JT9-5 decodes in km07ks > Thanks to Rik for the software, and to Spiros and Dionysios for their > reports. This is what I picked up using JT9-2 > > 18-12-28 21:38 2038 -25  0.1  648 2  CQ SV8CS KM07 > 18-12-28 21:40 2040 -25  0.1 1200 2  LA3EQ JO28XJ > 18-12-28 21:42 2042 -26  0.1  648 2  CQ SV8CS KM07 > 18-12-28 21:44 2044 -26  0.2 1200 2  LA3EQ JO28XJ > 18-12-28 21:48 2048 -25  0.1 1250 2  LA3EQ JO28XJ > 18-12-28 21:52 2052 -25  0.2 1250 2  LA3EQ JO28XJ > 18-12-28 21:56 2056 -25  0.2 1250 2  LA3EQ JO28XJ > 18-12-28 22:00 2100 -28  0.3 1250 2  LA3EQ JO28XJ > > and later JT9-5: > > 18-12-29 02:30 0130 -34 -0.7  615 5  VVV N1BUG 5 > 18-12-29 02:40 0140 -34 -0.6  615 5  VVV N1BUG 5 > 18-12-29 03:30 0230 -35 -0.6  615 5  VVV N1BUG 5 > > As my LF transceiver needs to be parked on 135.5 kHz I am always > struggling with audio frequency restrictions in WSJT, WSPR and JT-9 > software. My workaround are frequency conversions in two separate > SpecLab instances for RX and TX, connected to the left and right > channels of a single VB-Audio virtual cable instance. However there is > a noticable latency in this process. > > Best 73, > Markus (DF6NM) > > > -----Ursprüngliche Mitteilung----- > Von: Dionysios Vlachiotis > An: rsgb_lf_group ; rsgb_lf_group > > Verschickt: Sa, 29. Dez 2018 8:39 > Betreff: LF: JT9-5 decodes in km07ks > > 245 -28 -0.4  650 5  CQ DF6NM JN59 > 2255 -27 -0.4  650 5  CQ DF6NM JN59 > 2315 -27 -0.5  650 5  CQ DF6NM JN59 > 2325 -24 -0.3  650 5  CQ DF6NM JN59 > 0035 -23 -0.2  650 5  CQ DF6NM JN59 > 0045 -21 -0.3  650 5  CQ DF6NM JN59 > 73 de SV8RV > Zakynthos isl. GREECE (km07ks) > > -----Ursprüngliche Mitteilung----- > Von: SV8CS-Spiros Chimarios > An: rsgb_lf_group > Verschickt: Sa, 29. Dez 2018 5:56 > Betreff: LF: SV8CS SlowJT9 > > Good morning. > Decoded only DF6NM during the night (JT9-5) – 136 KHz. > 2245 -30 -0.4  650 5  CQ DF6NM JN59 > 2255 -29 -0.4  650 5  CQ DF6NM JN59 > 2315 -27 -0.4  650 5  CQ DF6NM JN59 > 2325 -26 -0.4  650 5  CQ DF6NM JN59 > 0035 -21 -0.6  650 5  CQ DF6NM JN59 > 0045 -20 -0.4  650 5  CQ DF6NM JN59 > 73, Spiros/SV8CS --------------42E7BE7773076CCD3178DA12 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit Hi Rik,

>  (maybe I should ask Wolf for advice)

You're welcome. The "image rejecting up/down converter" is written in plain C. It should be easily portable. Uses a 37-tap FIR filter for the Hilbert transformer that rejects the "unwanted" mixing product.
Not sure if the sourcecode (indentation) survives the emailing process, but fyi it's attached below.
If you think it's usable for your project, I can send everything (including the data type definitions and the filter coefficient table).

Cheers,
  Wolf .

Below: Core of the "universal frequency converter / mixer" as currently used in Spectrum Lab (this is the simple one, without forward and reverse FFT).


void SOUND_RunThroughMixer(
      T_SOUND_FREQ_CONVERTER *pcnv,  // contains all parameters for a converter
      T_Float *input_samples,  T_Float *input_samples_q,
      T_Float *output_samples, T_Float *output_samples_q,
      int    number_of_samples )
 /* Frequency mixer. May transform the frequency for some kind of RX.
  * Can optionally cancel one sideband using a Hilbert transformer,
  * I/Q-mixer etc.
  */
{
 int    sample_i, j;
 T_Float d, y, dbl_i, dbl_q;
 const T_Float* coeff_ptr;
 T_Float* queue_ptr;
 T_Float* input_queue_end;
 double  dblPhzInc;
 int     iCosTableIndex, iSineTableOffset = 0;
 T_Float dblNcoI, dblNcoQ;
 double  dblNcoPhase = pcnv->dblNcoPhase;  // use local var for speed


  // Prepare the NCO for the "mixer" frequency ...
  // Note: SoundTab_fltCosTable[SOUND_COS_TABLE_LEN] contains exactly ONE PERIOD.
  //       "Negative" frequencies are possible by inverting the Q-channel .
  if(pcnv->dblFSample!=0)
      dblPhzInc = (double)SOUND_COS_TABLE_LEN * pcnv->dblOscillatorFreq / pcnv->dblFSample;
    else
      dblPhzInc = 0;   // mixer frequency is ZERO, so noo phase increment

  if(dblPhzInc > 0)
   { // array index offset to read a SINE WAVE from a COSINE TABLE :
     iSineTableOffset = (int) (0.499 + 3.0 * (T_Float)SOUND_COS_TABLE_LEN / 4.0);
   }
  else   // phase increment negative, "negative" mixer frequency ....
   {
     dblPhzInc = -dblPhzInc; // Make sure the table reading index INCREMENTS,
                             // because the wrap test will not look for negative indices.
     // Get array index offset to read a NEGATIVE SINE WAVE from a COSINE TABLE :
     iSineTableOffset = (int)(0.499 + (T_Float)SOUND_COS_TABLE_LEN / 4.0);
   } // end if <produce NEGATIVE frequencies ... possible only with I/Q mult. >
  if(dblNcoPhase<0) dblNcoPhase = 0;


  if(pcnv->fDcReject)
   { // Accumulate & remove a bit DC offset from the new chunk:
     for(sample_i=0; sample_i<number_of_samples; ++sample_i)
       {
         pcnv->dblMixerDcOffset =
                     pcnv->dblMixerDcOffset  * 0.9999
                   + input_samples[sample_i] * 0.0001;
         // bad style to modifying the INPUT samples
         //  but this won't hurt anyone :>
         input_samples[sample_i] -= pcnv->dblMixerDcOffset;
       }
   }

  if(pcnv->iMixerScheme==CFG_FREQ_MIX_DSB)
   { // No sideband rejection:
     //   This is a simple and very fast mixer without sideband-rejection.
     //   No complicated broadband 90° phase shifter required.
    for(sample_i=0; sample_i<number_of_samples; ++sample_i)
     {
      // Run the NCO (numerical controlled oscillator)
      dblNcoPhase += dblPhzInc;
      while(dblNcoPhase >=(T_Float)SOUND_COS_TABLE_LEN) // "while", not "if" !!
            dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap
      d = SoundTab_fltCosTable[(int)dblNcoPhase];

      // DSB mixer: simply multiply the input signal with the NCO output :
      *output_samples++ = (*input_samples++) * d;
     }
   }  // end if <frequency converter WITHOUT sideband rejection>
  else
  if(pcnv->iMixerScheme==CFG_FREQ_MIX_COMPLEX)
   { // Complex multiplication of complex input :
     //   (a + j*b ) * ( c + j*d )  =  a*c - b*d + j * ( a*d + b*c )
     // To do this, SOUND_RunThroughMixer() must be called with
     //   TWO source-  and TWO destination blocks.
     //  (real and imaginary parts are in sepearate blocks)
     if(  (input_samples!=NULL) && (input_samples_q!=NULL)
        &&(output_samples!=NULL) && (output_samples_q!=NULL) )
      {
        T_Float inp_i, inp_q, outp_i, outp_q;
        for(sample_i=0; sample_i<number_of_samples; ++sample_i)
         {
          // Run the NCO (numerical controlled oscillator; here with quadrature output)
          dblNcoPhase += dblPhzInc;
          while(dblNcoPhase >=(T_Float)SOUND_COS_TABLE_LEN) // "while", not "if" !!
                dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap
          iCosTableIndex = (int)dblNcoPhase;
          dblNcoI = SoundTab_fltCosTable[iCosTableIndex];
          dblNcoQ = SoundTab_fltCosTable[(iCosTableIndex+iSineTableOffset) % SOUND_COS_TABLE_LEN];

          // Get complex input sample, multiply with complex oscillator, and put into output buffers:
          inp_i = *(input_samples++);
          inp_q = *(input_samples_q++);
          outp_i = inp_i * dblNcoI - inp_q * dblNcoQ;
          outp_q = inp_i * dblNcoQ + inp_q * dblNcoI;
          *output_samples++   = outp_i;
          *output_samples_q++ = outp_q;
         }
     }
   }  // end if <frequency converter WITHOUT sideband rejection>
  else
  if(   (pcnv->iMixerScheme == CFG_FREQ_MIX_LSB_DOWNCONVERTER )
     || (pcnv->iMixerScheme == CFG_FREQ_MIX_USB_DOWNCONVERTER ) )
   {   // Optimized mixer for "downconversion".
       // Based on a schematic diagram from the ARRL handbook 1996,
       // page 17.73:   "The R2: An image-rejecting D-C Receiver"
       // Principle: Splitter, TWO Mixers (with I and Q output),
       //            audio phase shift network, summer, filter.
       // Note: 90° phase shifting is done AFTER mixing (in contrast to the
       //           schemes  CFG_FREQ_MIX_LSB_UP  and  CFG_FREQ_MIX_USB_UP.
    for(sample_i=0; sample_i<number_of_samples; ++sample_i)
     {
      // Let the NCO (numerical controlled oscillator) produce quadrature-phase signals :
      dblNcoPhase += dblPhzInc;
      while(dblNcoPhase >=(T_Float)SOUND_COS_TABLE_LEN)  // "while", not "if" !!
            dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap
      iCosTableIndex = (int)dblNcoPhase;
      dblNcoI = SoundTab_fltCosTable[iCosTableIndex];
      dblNcoQ = SoundTab_fltCosTable[(iCosTableIndex+iSineTableOffset) % SOUND_COS_TABLE_LEN];

      // Now mix the incoming (higher-frequency) signal ..input_samples[]..
      //         with a sine and a cosine signal from the NCO ("LO").
      dbl_i = input_samples[sample_i];   // this is the INPUT signal

      if(pcnv->iMixerScheme == CFG_FREQ_MIX_LSB_DOWNCONVERTER)
       {
        dbl_q =  dbl_i * dblNcoI;   // LSB (below NCO freq) moved DOWN
        dbl_i =  dbl_i * dblNcoQ;
       }
      else  // the "other" sideband with reversed oscillator phases:
       {
        dbl_q =  dbl_i * dblNcoQ;   // USB (above NCO freq) moved DOWN
        dbl_i =  dbl_i * dblNcoI;
       }
      // arrived here: dbl_i is the output of the "I"-mixer,
      //               dbl_q is the output of the "Q"-mixer.


      // Let the I-channel run through a delay line [ length (N-1)/2 ]
      //  to compensate the delay from the hilbert trafo (see below).
      if(  (pcnv->iDelayQIndex < 0)
         ||(pcnv->iDelayQIndex >= ((SOUND_Hilbert_filter_length-1)/2)) )
            pcnv->iDelayQIndex = 0;
      y = pcnv->dblDelayQueue[pcnv->iDelayQIndex];
      pcnv->dblDelayQueue[pcnv->iDelayQIndex++] = dbl_i;
      dbl_i = y;

      // Let the Q-channel run through a broadband 90° phase shifter
      // (hilbert transformer, implemented as FIR filter here).
      //    keep the circular buffer pointer 'valid' all the time :
      input_queue_end = &pcnv->dblHilbertQueue[SOUND_Hilbert_filter_length-1];
      if(  (pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0])
         ||(pcnv->pdblHilbertQPointer > input_queue_end) )
            pcnv->pdblHilbertQPointer = &pcnv->dblHilbertQueue[0];
      if( --pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0] )
            pcnv->pdblHilbertQPointer = input_queue_end; // deal with wraparound
      *pcnv->pdblHilbertQPointer = dbl_q;     // hilbert trafo input
      queue_ptr = pcnv->pdblHilbertQPointer;  // pointer to read from input queue
      coeff_ptr = &SOUND_HilbertCoeffs[0]; // pointer to read from coeff table
      y = 0.0;                  // clear the 'global adder'
      j = (SOUND_Hilbert_filter_length+1)/2 -1;  // j=12 for 25th-order filter
      while( j-- )              // do the MAC's (with every 2nd coeff ZERO)
        {
         // coeffs[0], [2], [4].. are (almost) zero and are not calculated
         //                       so just skip the 'queue' pointer
         ++queue_ptr;  ++coeff_ptr;
         if( queue_ptr > input_queue_end ) // deal with wraparound
             queue_ptr = &pcnv->dblHilbertQueue[0];
         // odd coefficients, non-zero, do a MAC-operation :
         y += ( (*queue_ptr++) * (*coeff_ptr++) );
         if( queue_ptr > input_queue_end ) // deal with wraparound
             queue_ptr = &pcnv->dblHilbertQueue[0];
        }
      dbl_q = y;    // filter output = sum from all 'taps'

      // finally add the output of the "audio phase-shift network"...
      output_samples[sample_i] = dbl_i + dbl_q;

     } // end for (sample_i ... )
   } // end if <..mixer_scheme == CFG_FREQ_MIX_USB_DOWNCONVERTER >
  else // neither "double side band" nor "USB DOWNCONVERTER"....
   {
    for(sample_i=0; sample_i<number_of_samples; ++sample_i)
     {
      // Let the I-value run through a delay line [ length (N-1)/2 ]
      //  to compensate the delay from the hilbert trafo (see below).
      if(  (pcnv->iDelayQIndex < 0)
         ||(pcnv->iDelayQIndex >= ((SOUND_Hilbert_filter_length-1)/2)) )
            pcnv->iDelayQIndex = 0;
      dbl_i = pcnv->dblDelayQueue[pcnv->iDelayQIndex];
      pcnv->dblDelayQueue[pcnv->iDelayQIndex++]
            = input_samples[sample_i];

      // Generate the Q-value by passing the real input through a
      // hilbert transformer (which is implemented as an FIR filter here).
      //    keep the circular buffer pointer 'valid' all the time :
      input_queue_end = &pcnv->dblHilbertQueue[SOUND_Hilbert_filter_length-1];
      if(  (pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0])
         ||(pcnv->pdblHilbertQPointer > input_queue_end) )
            pcnv->pdblHilbertQPointer = &pcnv->dblHilbertQueue[0];
      if( --pcnv->pdblHilbertQPointer < &pcnv->dblHilbertQueue[0] )
            pcnv->pdblHilbertQPointer = input_queue_end; // deal with wraparound
      *pcnv->pdblHilbertQPointer = input_samples[sample_i];  // filter input = "X"
      queue_ptr = pcnv->pdblHilbertQPointer;  // pointer to read from input queue
      coeff_ptr = &SOUND_HilbertCoeffs[0]; // pointer to read from coeff table
      y = 0.0;                  // clear the 'global adder'
      j = (SOUND_Hilbert_filter_length+1)/2 -1;  // j=12 for 25th-order filter
      while( j-- )              // do the MAC's (with every 2nd coeff ZERO)
        {
         // coeffs[0], [2], [4].. are (almost) zero and are not calculated
         //                       so just skip the 'queue' pointer
#if(0)   // not optimized:
         y += ( (*queue_ptr++) * (*coeff_ptr++) );  // here's the MAC
#else    // optimized:
         ++queue_ptr;  ++coeff_ptr;
#endif
         if( queue_ptr > input_queue_end ) // deal with wraparound
             queue_ptr = &pcnv->dblHilbertQueue[0];
         // odd coefficients, non-zero, do a MAC-operation :
         y += ( (*queue_ptr++) * (*coeff_ptr++) );
         if( queue_ptr > input_queue_end ) // deal with wraparound
             queue_ptr = &pcnv->dblHilbertQueue[0];
        }
      dbl_q = y;    // filter output = sum from all 'taps'

      // Let the NCO (numerical controlled oscillator) produce quadrature-phase signals :
      dblNcoPhase += dblPhzInc;
      while(dblNcoPhase >=(T_Float)SOUND_COS_TABLE_LEN) // "while", not "if" !!
            dblNcoPhase -=(T_Float)SOUND_COS_TABLE_LEN; // table index wrap
      iCosTableIndex = (int)dblNcoPhase;
      dblNcoI = SoundTab_fltCosTable[iCosTableIndex];
      dblNcoQ = SoundTab_fltCosTable[(iCosTableIndex + iSineTableOffset) % SOUND_COS_TABLE_LEN];

      if(pcnv->iMixerScheme==CFG_FREQ_MIX_LSB_UP)
       {
        // multiply the I- and Q- samples with the sin- and cos- output
        //     of the local oscillator.
        output_samples[sample_i] =
              dbl_q * dblNcoI  // multiply with "cosine"
            - dbl_i * dblNcoQ; // multiply with "sine"
       }
      else // not LSB but USB:
       {
        output_samples[sample_i] =
              dbl_i * dblNcoI  // multiply with "cosine"
            - dbl_q * dblNcoQ; // multiply with "sine"
       }
     } // end for (sample_i ... )
   } // end if <frequency UP converter with sideband rejection>

  pcnv->dblNcoPhase = dblNcoPhase;  // save the NCO phase for next block

} // end SOUND_RunThroughMixer()




On 29.12.2018 10:47, Rik Strobbe wrote:

Hello Markus,


nice copy on N1BUG, this might be a new distance record for Paul.


Thanks for your help with the JT9-2 and JT9-5 resampling.

Lifting the frequency restriction on TX is "peanuts", but on RX I would need to implement frequency conversion in SpecLab style.

I will have a look to that (maybe I should ask Wolf for advice).


73, Rik  ON7YD - OR7T




Van: owner-rsgb_lf_group@blacksheep.org <owner-rsgb_lf_group@blacksheep.org> namens Markus Vester <markusvester@aol.com>
Verzonden: zaterdag 29 december 2018 10:28
Aan: rsgb_lf_group@blacksheep.org
Onderwerp: Re: LF: JT9-5 decodes in km07ks
 
Thanks to Rik for the software, and to Spiros and Dionysios for their reports. This is what I picked up using JT9-2

18-12-28 21:38 2038 -25  0.1  648 2  CQ SV8CS KM07        
18-12-28 21:40 2040 -25  0.1 1200 2  LA3EQ JO28XJ         
18-12-28 21:42 2042 -26  0.1  648 2  CQ SV8CS KM07        
18-12-28 21:44 2044 -26  0.2 1200 2  LA3EQ JO28XJ         
18-12-28 21:48 2048 -25  0.1 1250 2  LA3EQ JO28XJ         
18-12-28 21:52 2052 -25  0.2 1250 2  LA3EQ JO28XJ         
18-12-28 21:56 2056 -25  0.2 1250 2  LA3EQ JO28XJ         
18-12-28 22:00 2100 -28  0.3 1250 2  LA3EQ JO28XJ         

and later JT9-5:

18-12-29 02:30 0130 -34 -0.7  615 5  VVV N1BUG 5          
18-12-29 02:40 0140 -34 -0.6  615 5  VVV N1BUG 5          
18-12-29 03:30 0230 -35 -0.6  615 5  VVV N1BUG 5          

As my LF transceiver needs to be parked on 135.5 kHz I am always struggling with audio frequency restrictions in WSJT, WSPR and JT-9 software. My workaround are frequency conversions in two separate SpecLab instances for RX and TX, connected to the left and right channels of a single VB-Audio virtual cable instance. However there is a noticable latency in this process.

Best 73,
Markus (DF6NM)


-----Ursprüngliche Mitteilung-----
Von: Dionysios Vlachiotis <sv8rv@otenet.gr>
An: rsgb_lf_group <rsgb_lf_group@blacksheep.org>; rsgb_lf_group <rsgb_lf_group@yahoogroups.co.uk>
Verschickt: Sa, 29. Dez 2018 8:39
Betreff: LF: JT9-5 decodes in km07ks

245 -28 -0.4  650 5  CQ DF6NM JN59        
2255 -27 -0.4  650 5  CQ DF6NM JN59        
2315 -27 -0.5  650 5  CQ DF6NM JN59        
2325 -24 -0.3  650 5  CQ DF6NM JN59        
0035 -23 -0.2  650 5  CQ DF6NM JN59        
0045 -21 -0.3  650 5  CQ DF6NM JN59     
 
73 de SV8RV
Zakynthos isl. GREECE (km07ks)

-----Ursprüngliche Mitteilung-----
Von: SV8CS-Spiros Chimarios <zante@otenet.gr>
An: rsgb_lf_group <rsgb_lf_group@blacksheep.org>
Verschickt: Sa, 29. Dez 2018 5:56
Betreff: LF: SV8CS SlowJT9

Good morning.
Decoded only DF6NM during the night (JT9-5) – 136 KHz.
 
2245 -30 -0.4  650 5  CQ DF6NM JN59        
2255 -29 -0.4  650 5  CQ DF6NM JN59        
2315 -27 -0.4  650 5  CQ DF6NM JN59        
2325 -26 -0.4  650 5  CQ DF6NM JN59        
0035 -21 -0.6  650 5  CQ DF6NM JN59        
0045 -20 -0.4  650 5  CQ DF6NM JN59 
 
73, Spiros/SV8CS

--------------42E7BE7773076CCD3178DA12--