#35 Updates AM & NBFM decoders to use Adaptive Squelch, a power squelch that includes an adaptive noise floor monitor. Implements vectorized magnitude operations for AM & FM decoders. Adds talkgroup assignment and squelch controls to AM channel configuration editor. Implements new AM gain control that attempts to normalize audio gain quickly at beginning of call/transmission and maintains that gain across lifecycle of the call and resets the gain for the next call. (#1540)

Notes on usage:
- When using either AM or FM squelch control use either the Heterodyne channelizer or if using the Polyphase channelizer, avoid using trunk tracking decoders like DMR or P25 or set the squelch threshold high enough to avoid changes in noise floor from polyphase channelizer where it can vary between using the one channel or the two-channel combined channel sources.

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2023-05-07 07:27:44 -04:00
committed by GitHub
parent 5654254cbb
commit 4f8b8e978b
74 changed files with 4630 additions and 2012 deletions

View File

@@ -45,6 +45,7 @@ public class SourceEvent
NOTIFICATION_RECORDING_FILE_LOADED,
NOTIFICATION_SAMPLE_RATE_CHANGE,
NOTIFICATION_SQUELCH_THRESHOLD,
NOTIFICATION_SQUELCH_AUTO_TRACK,
NOTIFICATION_STOP_SAMPLE_STREAM,
NOTIFICATION_TUNER_SHUTDOWN,
NOTIFICATION_ERROR_STATE,
@@ -54,6 +55,8 @@ public class SourceEvent
REQUEST_FREQUENCY_SELECTION,
REQUEST_CHANGE_SQUELCH_THRESHOLD,
REQUEST_CURRENT_SQUELCH_THRESHOLD,
REQUEST_CHANGE_SQUELCH_AUTO_TRACK,
REQUEST_CURRENT_SQUELCH_AUTO_TRACK,
REQUEST_START_SAMPLE_STREAM,
REQUEST_STOP_SAMPLE_STREAM;
@@ -428,12 +431,11 @@ public class SourceEvent
/**
* Requests the current squelch threshold value
* @param source optional
* @return source event
*/
public static SourceEvent requestCurrentSquelchThreshold(Source source)
public static SourceEvent requestCurrentSquelchThreshold()
{
return new SourceEvent(Event.REQUEST_CURRENT_SQUELCH_THRESHOLD, source, 0);
return new SourceEvent(Event.REQUEST_CURRENT_SQUELCH_THRESHOLD, null, 0);
}
/**
@@ -447,6 +449,35 @@ public class SourceEvent
return new SourceEvent(Event.REQUEST_CHANGE_SQUELCH_THRESHOLD, source, thresholdDb);
}
/**
* Creates a new request squelch auto track status source event.
* @return new source event
*/
public static SourceEvent requestCurrentSquelchAutoTrack()
{
return new SourceEvent(Event.REQUEST_CURRENT_SQUELCH_AUTO_TRACK, null, 0);
}
/**
* Creates a new squelch auto-track notification
* @param autoTrack true or false.
* @return source event
*/
public static SourceEvent squelchAutoTrack(boolean autoTrack)
{
return new SourceEvent(Event.NOTIFICATION_SQUELCH_AUTO_TRACK, null, autoTrack ? 1 : 0);
}
/**
* Creates a new squelch auto-track request
* @param autoTrack to enable (true) or disable auto-track.
* @return source event
*/
public static SourceEvent requestSquelchAutoTrack(boolean autoTrack)
{
return new SourceEvent(Event.REQUEST_CHANGE_SQUELCH_AUTO_TRACK, null, autoTrack ? 1 : 0);
}
@Override
public String toString()
{

View File

@@ -1,18 +1,21 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 Dennis Sheirer
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.source.tuner.channel;
/**
@@ -29,8 +32,8 @@ public class ChannelSpecification
* Constructs a channel specification instance.
* @param minimumSampleRate requested for the channel
* @param bandwidth
* @param passFrequency for the pass band of the channel
* @param stopFrequency for the stop band of teh channel
* @param passFrequency for the pass band of the channel, usually half of the bandwidth value.
* @param stopFrequency for the stop band of teh channel, usually slightly more than half of the bandwidth value.
*/
public ChannelSpecification(double minimumSampleRate, int bandwidth, double passFrequency, double stopFrequency)
{

View File

@@ -164,8 +164,11 @@ public abstract class TunerChannelSource extends ComplexSource implements ISourc
case NOTIFICATION_FREQUENCY_ROTATION_SUCCESS:
case NOTIFICATION_CHANNEL_POWER:
case NOTIFICATION_SQUELCH_THRESHOLD:
case NOTIFICATION_SQUELCH_AUTO_TRACK:
case REQUEST_CHANGE_SQUELCH_THRESHOLD:
case REQUEST_CURRENT_SQUELCH_THRESHOLD:
case REQUEST_CHANGE_SQUELCH_AUTO_TRACK:
case REQUEST_CURRENT_SQUELCH_AUTO_TRACK:
//Ignore
break;
default:

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
* Copyright (C) 2014-2023 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,6 +47,7 @@ public class ComplexWaveSource extends Source implements IControllableFileSource
private final static Logger mLog = LoggerFactory.getLogger(ComplexWaveSource.class);
private IFrameLocationListener mFrameLocationListener;
private int mBufferSampleCount = 65536; //Complex samples per buffer
private int mBytesPerFrame;
private int mFrameCounter = 0;
private long mFrequency = 0;
@@ -119,7 +120,8 @@ public class ComplexWaveSource extends Source implements IControllableFileSource
*/
public int getBufferSampleCount()
{
return (int)(getSampleRate() / 20.0d);
return mBufferSampleCount;
// return (int)(getSampleRate() / 20.0d);
}
@Override
@@ -139,12 +141,11 @@ public class ComplexWaveSource extends Source implements IControllableFileSource
if(mAutoReplay)
{
long intervalMilliseconds = 50; //20 intervals per second
double framesPerInterval = getSampleRate() / 20.0d;
mReplayController = ThreadPool.SCHEDULED.scheduleAtFixedRate(new ReplayController(framesPerInterval),
double sampleRate = getSampleRate();
double buffersPerSecond = (sampleRate / mBufferSampleCount);
long intervalMilliseconds = (long)(1000.0 / buffersPerSecond);
mReplayController = ThreadPool.SCHEDULED.scheduleAtFixedRate(new ReplayController(mBufferSampleCount),
0, intervalMilliseconds, TimeUnit.MILLISECONDS);
}
}