Changeset 2162
- Timestamp:
- 11/26/11 22:06:19 (18 months ago)
- Location:
- branches/improved_tone_detector/src
- Files:
-
- 6 modified
-
svxlink/remotetrx/remotetrx.conf (modified) (2 diffs)
-
svxlink/svxlink/svxlink.conf (modified) (1 diff)
-
svxlink/trx/SquelchCtcss.h (modified) (5 diffs)
-
svxlink/trx/ToneDetector.cpp (modified) (5 diffs)
-
svxlink/trx/ToneDetector.h (modified) (1 diff)
-
versions (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/improved_tone_detector/src/svxlink/remotetrx/remotetrx.conf
r1928 r2162 51 51 VOX_FILTER_DEPTH=20 52 52 VOX_THRESH=1000 53 #CTCSS_MODE=3 53 54 CTCSS_FQ=136.5 54 55 CTCSS_THRESH=10 56 CTCSS_SNR_OPEN_THRESH=16 57 CTCSS_SNR_CLOSE_THRESH=10 55 58 SERIAL_PORT=/dev/ttyS0 56 59 SERIAL_PIN=CTS:SET … … 103 106 VOX_FILTER_DEPTH=20 104 107 VOX_THRESH=1000 108 #CTCSS_MODE=3 105 109 CTCSS_FQ=136.5 106 110 CTCSS_THRESH=10 111 CTCSS_SNR_OPEN_THRESH=16 112 CTCSS_SNR_CLOSE_THRESH=10 107 113 SERIAL_PORT=/dev/ttyS0 108 114 SERIAL_PIN=CTS:SET -
branches/improved_tone_detector/src/svxlink/svxlink/svxlink.conf
r2010 r2162 135 135 VOX_FILTER_DEPTH=20 136 136 VOX_THRESH=1000 137 #CTCSS_MODE=3 137 138 CTCSS_FQ=136.5 138 139 CTCSS_THRESH=10 140 CTCSS_SNR_OPEN_THRESH=16 141 CTCSS_SNR_CLOSE_THRESH=10 139 142 SERIAL_PORT=/dev/ttyS0 140 143 SERIAL_PIN=CTS:SET -
branches/improved_tone_detector/src/svxlink/trx/SquelchCtcss.h
r2146 r2162 161 161 int ctcss_mode = 1; 162 162 cfg.getValue(rx_name, "CTCSS_MODE", ctcss_mode); 163 164 float snr_open_thresh = 16; 165 cfg.getValue(rx_name, "CTCSS_SNR_OPEN_THRESH", snr_open_thresh); 166 167 float snr_close_thresh = 10; 168 cfg.getValue(rx_name, "CTCSS_SNR_CLOSE_THRESH", snr_close_thresh); 163 169 164 170 det = new ToneDetector(ctcss_fq, 8.0f); … … 170 176 { 171 177 case 2: 172 std::cout << "### CTCSS mode: Center to total passband power\n";178 std::cout << "### CTCSS mode: Estimated SNR\n"; 173 179 //det->setDetectBw(6.0f); 174 180 det->setDetectUseWindowing(false); 175 181 det->setDetectPeakThresh(0.0f); 176 det->setDetectPeakToTotPwrThresh(0.6f); 182 //det->setDetectPeakToTotPwrThresh(0.6f); 183 det->setDetectSnrThresh(snr_open_thresh, 210.0f); 177 184 det->setDetectStableCountThresh(1); 178 185 … … 180 187 det->setUndetectUseWindowing(false); 181 188 det->setUndetectPeakThresh(0.0f); 182 det->setUndetectPeakToTotPwrThresh(0.3f); 189 //det->setUndetectPeakToTotPwrThresh(0.3f); 190 det->setUndetectSnrThresh(snr_close_thresh, 210.0f); 183 191 det->setUndetectStableCountThresh(2); 184 192 … … 190 198 191 199 case 3: 192 std::cout << "### CTCSS mode: Phase\n";200 std::cout << "### CTCSS mode: Estimated SNR + Phase\n"; 193 201 //det->setDetectUseWindowing(false); 194 202 det->setDetectBw(16.0f); 195 203 det->setDetectPeakThresh(0.0f); 196 det->setDetectPeakToTotPwrThresh(0.6f); 204 //det->setDetectPeakToTotPwrThresh(0.6f); 205 det->setDetectSnrThresh(snr_open_thresh, 210.0f); 197 206 det->setDetectStableCountThresh(1); 198 207 det->setDetectPhaseBwThresh(2.0f, 2.0f); … … 201 210 det->setUndetectUseWindowing(false); 202 211 det->setUndetectPeakThresh(0.0f); 203 det->setUndetectPeakToTotPwrThresh(0.3f); 212 //det->setUndetectPeakToTotPwrThresh(0.3f); 213 det->setUndetectSnrThresh(snr_close_thresh, 210.0f); 204 214 det->setUndetectStableCountThresh(2); 205 215 //det->setUndetectPhaseBwThresh(4.0f, 16.0f); -
branches/improved_tone_detector/src/svxlink/trx/ToneDetector.cpp
r2154 r2162 104 104 float peak_to_tot_pwr_thresh; 105 105 float passband_energy_thresh; 106 float snr_thresh; 107 float passband_bw; 106 108 }; 107 109 … … 156 158 det_par->peak_to_tot_pwr_thresh = 0.0f; 157 159 det_par->passband_energy_thresh = 0.0f; 160 det_par->snr_thresh = 0.0f; 161 det_par->passband_bw = 0.0f; 158 162 159 163 setDetectBw(width_hz); … … 376 380 377 381 382 void ToneDetector::setDetectSnrThresh(float thresh_db, float passband_bw_hz) 383 { 384 det_par->snr_thresh = thresh_db; 385 det_par->passband_bw = passband_bw_hz; 386 } /* ToneDetector::setDetectSnrThresh */ 387 388 389 void ToneDetector::setUndetectSnrThresh(float thresh_db, float passband_bw_hz) 390 { 391 undet_par->snr_thresh = thresh_db; 392 undet_par->passband_bw = passband_bw_hz; 393 } /* ToneDetector::setUndetectSnrThresh */ 394 395 378 396 void ToneDetector::setDetectPhaseBwThresh(float bw_hz, float stddev_hz) 379 397 { … … 556 574 // are doing: 557 575 // 558 // float Ptone = res_center / ((par->block_len*par->block_len) / 2);576 // float Ptone = 2.0f * res_center / (par->block_len*par->block_len); 559 577 // float Ppassband = passband_energy / par->block_len; 560 578 // float peak_to_tot_pwr = Ptone / Ppassband; … … 565 583 } 566 584 585 if (par->passband_bw > 0.0f) 586 { 587 // Calculate mean tone power 588 float Ptone = 2.0f * res_center / (par->block_len*par->block_len); 589 590 // Calculate mean passband power 591 float Ppassband = passband_energy / par->block_len; 592 593 // Estimate the mean noise floor over the whole passband 594 float Pnoise = (Ppassband - Ptone) / ((par->passband_bw-par->bw) / par->bw); 595 596 // Calculate the signal to noise ratio 597 float snr = 10 * log10(Ptone / Pnoise); 598 599 // Check if the SNR is over the threshold 600 active = active && (snr > par->snr_thresh); 601 } 602 567 603 // If phase checking is active, check the phase 568 604 if (phase_check_left > 0) -
branches/improved_tone_detector/src/svxlink/trx/ToneDetector.h
r2154 r2162 292 292 */ 293 293 void setUndetectPeakToTotPwrThresh(float thresh); 294 295 /** 296 * @brief Set the peak to noise floor SNR threshold when inactive 297 * @param thresh_db The threshold in dB 298 * @param passband_bw_hz Passband bandwidth in Hz 299 * 300 * This function is used to set the signal to noise ratio 301 * threshold when the tone detector is in its inactive state, that is 302 * when a tone is not being detected. 303 * This will compare the narrow band Goertzel tone detector power to 304 * an estimated noise floor. The noise floor estimation is deduced from 305 * the total passband power where the tone has been removed. This will 306 * be a mean value of the noise floor for the whole passband. If the 307 * amplitude response for the passband is not flat, the noise floor will 308 * have an offset and so will the tone. This will mean that the SNR will 309 * also have an offset. So, for example, if the part of the passband where 310 * the tone is expected to appear is attenuated by 6dB in comparision to 311 * the mean passband gain, the threshold need to also be lowered by 6dB. 312 */ 313 void setDetectSnrThresh(float thresh_db, float passband_bw_hz); 314 315 /** 316 * @brief Set the peak to noise floor SNR threshold when active 317 * @param thresh_db The threshold in dB 318 * @param passband_bw_hz Passband bandwidth in Hz 319 * 320 * This function is used to set the signal to noise ratio 321 * threshold when the tone detector is in its active state, that is 322 * when a tone is being detected. 323 * This will compare the narrow band Goertzel tone detector power to 324 * an estimated noise floor. The noise floor estimation is deduced from 325 * the total passband power where the tone has been removed. This will 326 * be a mean value of the noise floor for the whole passband. If the 327 * amplitude response for the passband is not flat, the noise floor will 328 * have an offset and so will the tone. This will mean that the SNR will 329 * also have an offset. So, for example, if the part of the passband where 330 * the tone is expected to appear is attenuated by 6dB in comparision to 331 * the mean passband gain, the threshold need to also be lowered by 6dB. 332 */ 333 void setUndetectSnrThresh(float thresh_db, float passband_bw_hz); 294 334 295 335 /** -
branches/improved_tone_detector/src/versions
r2144 r2162 12 12 13 13 # SvxLink versions 14 SVXLINK=0.13.99. 014 SVXLINK=0.13.99.1 15 15 SVXLINK_RPM_RELEASE=1 16 16 MODULE_HELP=0.7.0.99.0