Merge remote-tracking branch 'origin/master' into feature/cygwin

This commit is contained in:
ha7ilm 2017-04-12 23:42:36 +02:00
commit 4fb3efb474
7 changed files with 185 additions and 115 deletions

View file

@ -12,7 +12,7 @@ It has the following features:
- waterfall display can be shifted back in time,
- it extensively uses HTML5 features like WebSocket, Web Audio API, and <canvas>.
- it works in Google Chrome, Chromium (above version 37) and Mozilla Firefox (above version 28),
- currently supports RTL-SDR and HackRF; other SDR hardware may be easily added.
- currently supports RTL-SDR, HackRF, SDRplay, AirSpy and many other devices, see the <a href="https://github.com/simonyiszk/openwebrx/wiki/">OpenWebRX Wiki</a>.
**News (2015-08-18)**
- My BSc. thesis written on OpenWebRX is <a href="http://openwebrx.org/bsc-thesis.pdf">available here.</a>
@ -28,6 +28,10 @@ It has the following features:
- OpenWebRX now supports URLs like: `http://localhost:8073/#freq=145555000,mod=usb`
- UI improvements were made, thanks to John Seamons and Gnoxter.
**News (2017-04-04)**
- *ncat* has been replaced with a custom implementation called *nmux* due to a bug that caused regular crashes on some machines. The *nmux* tool is part of the *csdr* package.
- Most consumer SDR devices are supported via <a href="https://github.com/rxseger/rx_tools">rx_tools</a>, see the <a href="https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX">OpenWebRX Wiki</a> on that.
> When upgrading OpenWebRX, please make sure that you also upgrade *csdr*, and install the new dependency, *ncat*!
## OpenWebRX servers on SDR.hu
@ -44,11 +48,6 @@ First you will need to install the dependencies:
- <a href="https://github.com/simonyiszk/csdr">libcsdr</a>
- <a href="http://sdr.osmocom.org/trac/wiki/rtl-sdr">rtl-sdr</a>
- ncat (On Debian/Ubuntu, it is in the *nmap* package).
> By the way, *nmap* is a tool commonly used for auditing network security, and it is not used by OpenWebRX in any way. We need to install it, because the *ncat* command is packaged with it.
>
> *ncat* is a better *netcat* alternative, which is used by OpenWebRX for internally distributing the I/Q data stream. It also solves the problem of having different versions of *netcat* on different Linux distributions, which are not compatible by their command-line arguments.
After cloning this repository and connecting an RTL-SDR dongle to your computer, you can run the server:
@ -62,7 +61,7 @@ Please note that the server is also listening on the following ports (on localho
Now the next step is to customize the parameters of your server in `config_webrx.py`.
Actually, if you do something cool with OpenWebRX (or just have a problem), please drop me a mail:
Actually, if you do something cool with OpenWebRX, please drop me a mail:
*Andras Retzler, HA7ILM &lt;randras@sdr.hu&gt;*
## Usage tips
@ -85,4 +84,4 @@ If you want to run OpenWebRX on a remote server instead of *localhost*, do not f
OpenWebRX is available under Affero GPL v3 license (<a href="https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)">summary</a>).
OpenWebRX is also available under a commercial license on request. Please contact me at the address *&lt;randras@sdr.hu&gt;* for other licensing options.
OpenWebRX is also available under a commercial license on request. Please contact me at the address *&lt;randras@sdr.hu&gt;* for licensing options.

View file

@ -69,9 +69,10 @@ sdrhu_public_listing = False
# ==== DSP/RX settings ====
dsp_plugin="csdr"
fft_fps=9
fft_size=4096
samp_rate = 250000
fft_size=4096 #Should be power of 2
fft_voverlap_factor=0.3 #If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram.
samp_rate = 250000
center_freq = 145525000
rf_gain = 5 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode.
ppm = 0
@ -81,16 +82,25 @@ fft_compression="adpcm" #valid values: "adpcm", "none"
start_rtl_thread=True
"""
Note: if you experience audio underruns while CPU usage is 100%, you can:
- decrease `samp_rate`,
- set `fft_voverlap_factor` to 0,
- decrease `fft_fps` and `fft_size`,
- limit the number of users by decreasing `max_clients`.
"""
# ==== I/Q sources ====
# (Uncomment the appropriate by removing # characters at the beginning of the corresponding lines.)
# There are guides for setting may different SDR hardware including AirSpy, AFEDRI-SDR, RTL-SDR in direct sampling mode, etc. in the Wiki:
# https://github.com/simonyiszk/openwebrx/wiki
#################################################################################################
# Is my SDR hardware supported? #
# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support #
#################################################################################################
# You can use other SDR hardware as well, by giving your own command that outputs the I/Q samples... Some examples of configuration are available here (default is RTL-SDR):
# >> RTL-SDR via rtl_sdr
start_rtl_command="rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm)
format_conversion="csdr convert_u8_f"
@ -126,11 +136,20 @@ To use a HackRF, compile the HackRF host tools from its "stdout" branch:
#start_rtl_command="(while true; do cat my_iq_file.raw; done) | csdr flowcontrol {sr} 20 ".format(sr=samp_rate*2*1.05)
#format_conversion="csdr convert_u8_f"
#>> The rx_sdr command works with a variety of SDR harware: RTL-SDR, HackRF, SDRplay, UHD, Airspy, Red Pitaya, audio devices, etc.
# It will auto-detect your SDR hardware if the following tools are installed:
# * the vendor provided driver and library,
# * the vendor-specific SoapySDR wrapper library,
# * and SoapySDR itself.
# Check out this article on the OpenWebRX Wiki: https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX/
#start_rtl_command="rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm)
#format_conversion=""
# >> gr-osmosdr signal source using GNU Radio (follow this guide: https://github.com/simonyiszk/openwebrx/wiki/Using-GrOsmoSDR-as-signal-source)
#start_rtl_command="cat /tmp/osmocom_fifo"
#format_conversion=""
# ==== Misc options ====
# ==== Misc settings ====
shown_center_freq = center_freq #you can change this if you use an upconverter
@ -146,16 +165,38 @@ iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data ove
#access_log = "~/openwebrx_access.log"
waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]"
waterfall_min_level = -115 #in dB
waterfall_max_level = 0
# ==== Color themes ====
#A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels
#Warning! The settings below are very experimental.
### default theme by teejez:
waterfall_colors = "[0x000000ff,0x0000ffff,0x00ffffff,0x00ff00ff,0xffff00ff,0xff0000ff,0xff00ffff,0xffffffff]"
waterfall_min_level = -88 #in dB
waterfall_max_level = -20
waterfall_auto_level_margin = (5, 40)
### old theme by HA7ILM:
#waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]"
#waterfall_min_level = -115 #in dB
#waterfall_max_level = 0
#waterfall_auto_level_margin = (20, 30)
##For the old colors, you might also want to set [fft_voverlap_factor] to 0.
#Note: When the auto waterfall level button is clicked, the following happens:
# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin[0]]
# [waterfall_max_level] = [current_max_power_level] + [waterfall_auto_level_margin[1]]
#
# ___|____________________________________|____________________________________|____________________________________|___> signal power
# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/
# current_max_power_level __|
# ==== Experimental settings ===
#Warning! These are very experimental.
csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr.
csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes.
csdr_through = False # Setting this True will print out how much data is going into the DSP chains.
nmux_memory = 50 #in megabytes. This sets the approximate size of the circular buffer used by nmux.
#Look up external IP address automatically from icanhazip.com, and use it as [server_hostname]
"""
print "[openwebrx-config] Detecting external IP address..."

View file

@ -33,6 +33,7 @@
var waterfall_colors=%[WATERFALL_COLORS];
var waterfall_min_level_default=%[WATERFALL_MIN_LEVEL];
var waterfall_max_level_default=%[WATERFALL_MAX_LEVEL];
var waterfall_auto_level_margin=%[WATERFALL_AUTO_LEVEL_MARGIN];
</script>
<script src="sdr.js"></script>
<script src="openwebrx.js"></script>

View file

@ -183,8 +183,8 @@ function waterfallColorsDefault()
function waterfallColorsAuto()
{
e("openwebrx-waterfall-color-min").value=(waterfall_measure_minmax_min-20).toString();
e("openwebrx-waterfall-color-max").value=(waterfall_measure_minmax_max+30).toString();
e("openwebrx-waterfall-color-min").value=(waterfall_measure_minmax_min-waterfall_auto_level_margin[0]).toString();
e("openwebrx-waterfall-color-max").value=(waterfall_measure_minmax_max+waterfall_auto_level_margin[1]).toString();
updateWaterfallColors(0);
}
@ -1018,7 +1018,7 @@ function canvas_mousewheel(evt)
zoom_max_level_hps=33; //Hz/pixel
zoom_levels_count=5;
zoom_levels_count=14;
function get_zoom_coeff_from_hps(hps)
{
@ -1040,8 +1040,10 @@ function mkzoomlevels()
zoom_levels=[1];
maxc=get_zoom_coeff_from_hps(zoom_max_level_hps);
if(maxc<1) return;
// logarithmic interpolation
zoom_ratio = Math.pow(maxc, 1/zoom_levels_count);
for(i=1;i<zoom_levels_count;i++)
zoom_levels.push(1+(maxc-1)*(i/(zoom_levels_count-1)));
zoom_levels.push(Math.pow(zoom_ratio, i));
}
function zoom_step(out, where, onscreen)
@ -1297,14 +1299,14 @@ var audio_node;
var audio_input_buffer_size;
// Optimalise these if audio lags or is choppy:
var audio_buffer_size = 4096;//2048 was choppy
var audio_buffer_size;
var audio_buffer_maximal_length_sec=3; //actual number of samples are calculated from sample rate
var audio_buffer_decrease_to_on_overrun_sec=2.2;
var audio_flush_interval_ms=500; //the interval in which audio_flush() is called
var audio_prepared_buffers = Array();
var audio_rebuffer = new sdrjs.Rebuffer(audio_buffer_size,sdrjs.REBUFFER_FIXED);
var audio_last_output_buffer = new Float32Array(audio_buffer_size);
var audio_rebuffer;
var audio_last_output_buffer;
var audio_last_output_offset = 0;
var audio_buffering = false;
//var audio_buffering_fill_to=4; //on audio underrun we wait until this n*audio_buffer_size samples are present
@ -1419,7 +1421,7 @@ var audio_underrun_cnt = 0;
function audio_buffer_progressbar_update()
{
if(audio_buffer_progressbar_update_disabled) return;
var audio_buffer_value=(audio_prepared_buffers.length*audio_buffer_size)/44100;
var audio_buffer_value=(audio_prepared_buffers.length*audio_buffer_size)/audio_context.sampleRate;
audio_buffer_total_average_level_length++; audio_buffer_total_average_level=(audio_buffer_total_average_level*((audio_buffer_total_average_level_length-1)/audio_buffer_total_average_level_length))+(audio_buffer_value/audio_buffer_total_average_level_length);
var overrun=audio_buffer_value>audio_buffer_maximal_length_sec;
var underrun=audio_prepared_buffers.length==0;
@ -1522,6 +1524,7 @@ function parsehash()
harr=x.split("=");
console.log(harr);
if(harr[0]=="mod") starting_mod = harr[1];
if(harr[0]=="sql") { e("openwebrx-panel-squelch").value=harr[1]; updateSquelch(); }
if(harr[0]=="freq") {
console.log(parseInt(harr[1]));
console.log(center_freq);
@ -1542,12 +1545,21 @@ function audio_preinit()
catch(e)
{
divlog('Your browser does not support Web Audio API, which is required for WebRX to run. Please upgrade to a HTML5 compatible browser.', 1);
return;
}
//we send our setup packet
if(audio_context.sampleRate<44100*2)
audio_buffer_size = 4096;
else if(audio_context.sampleRate>=44100*2 && audio_context.sampleRate<44100*4)
audio_buffer_size = 4096 * 2;
else if(audio_context.sampleRate>44100*4)
audio_buffer_size = 4096 * 4;
audio_rebuffer = new sdrjs.Rebuffer(audio_buffer_size,sdrjs.REBUFFER_FIXED);
audio_last_output_buffer = new Float32Array(audio_buffer_size);
//we send our setup packet
parsehash();
//needs audio_context.sampleRate to exist
audio_calculate_resampling(audio_context.sampleRate);
audio_resampler = new sdrjs.RationalResamplerFF(audio_client_resampling_factor,1);

View file

@ -1167,7 +1167,7 @@ function enlargeMemory() {
}
var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880;
var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216;
var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 67108864;
var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152;
var totalMemory = 4096;
@ -7565,7 +7565,7 @@ var asm = (function(global, env, buffer) {
h = a + 12 | 0;
k = +g[h >> 2];
k = +g[a + 24 >> 2] / (o < k ? k : o);
k = k > 65.0e3 ? 65.0e3 : k;
k = k > 50.0 ? 50.0 : k;
if (j) {
j = a + 28 | 0;
l = a | 0;
@ -7741,17 +7741,23 @@ var asm = (function(global, env, buffer) {
break
}
do {
n = d + (k << 2) | 0;
g[n >> 2] = +g[n >> 2] * .340447550238101 / +g[f + (k << 2) >> 2];
o = +g[f + (k << 2) >> 2];
l = d + (k << 2) | 0;
if (o != 0.0) {
o = +g[l >> 2] * .340447550238101 / o
} else {
o = 0.0
}
g[l >> 2] = o;
k = k + 1 | 0;
} while ((k | 0) < (e | 0))
}
} while (0);
m = b + (e - 1 << 3) | 0;
h = b + (e - 1 << 3) | 0;
n = a;
h = c[m + 4 >> 2] | 0;
c[n >> 2] = c[m >> 2];
c[n + 4 >> 2] = h;
m = c[h + 4 >> 2] | 0;
c[n >> 2] = c[h >> 2];
c[n + 4 >> 2] = m;
i = j;
return
}
@ -8047,24 +8053,7 @@ var asm = (function(global, env, buffer) {
return
}
function Rb(a, c, d) {
a = a | 0;
c = c | 0;
d = d | 0;
var e = 0;
if ((d | 0) > 0) {
e = 0
} else {
return
}
do {
g[c + (e << 2) >> 2] = +(b[a + (e << 1) >> 1] | 0) / 32767.0;
e = e + 1 | 0;
} while ((e | 0) < (d | 0));
return
}
function Sb(b, c, d) {
function Rb(b, c, d) {
b = b | 0;
c = c | 0;
d = d | 0;
@ -8081,6 +8070,23 @@ var asm = (function(global, env, buffer) {
return
}
function Sb(a, c, d) {
a = a | 0;
c = c | 0;
d = d | 0;
var e = 0;
if ((d | 0) > 0) {
e = 0
} else {
return
}
do {
g[c + (e << 2) >> 2] = +(b[a + (e << 1) >> 1] | 0) / 32767.0;
e = e + 1 | 0;
} while ((e | 0) < (d | 0));
return
}
function Tb(a, c, d) {
a = a | 0;
c = c | 0;
@ -8381,8 +8387,8 @@ var asm = (function(global, env, buffer) {
var m = 0.0,
n = 0,
o = 0,
p = 0.0,
q = 0,
p = 0,
q = 0.0,
r = 0.0,
s = 0,
t = 0.0;
@ -8393,59 +8399,49 @@ var asm = (function(global, env, buffer) {
}
o = 0;
m = l;
p = d / l;
q = 0;
q = d / l;
p = 0;
n = 1;
while (1) {
do {
l = +g[a + (n << 2) >> 2];
t = +M(+l);
r = d / t - m;
do {
if (l != 0.0) {
do {
if (r < 0.0) {
s = p < t;
o = s ? j : o;
p = s ? t : p;
if (o << 16 >> 16 > 0) {
r = 0.0;
o = o - 1 & 65535;
break
} else {
r = r * e;
q = i;
break
}
if (l != 0.0) {
do {
if (r < 0.0) {
s = q < t;
o = s ? j : o;
q = s ? t : q;
if (o << 16 >> 16 > 0) {
r = 0.0;
o = o - 1 & 65535;
break
} else {
if (q << 16 >> 16 > 0) {
r = 0.0;
q = q - 1 & 65535;
break
} else {
r = r * f;
break
}
r = r * e;
p = i;
break
}
} else {
if (p << 16 >> 16 > 0) {
r = 0.0;
p = p - 1 & 65535;
break
} else {
r = r * f;
break
}
} while (0);
r = m + r;
r = r > h ? h : r;
if (r >= 0.0) {
break
}
r = 0.0
} else {
r = m
}
} while (0);
g[b + (n << 2) >> 2] = (m + r - m * k) * l;
n = n + 1 | 0;
if ((n | 0) < (c | 0)) {
m = r
} while (0);
r = m + r
} else {
break
r = m
}
}
return +r
r = r > h ? h : r;
m = m + (r < 0.0 ? 0.0 : r) - m * k;
g[b + (n << 2) >> 2] = l * m;
n = n + 1 | 0;
} while ((n | 0) < (c | 0));
return +m
}
function _b(d, e, f, g, h) {
@ -10994,7 +10990,7 @@ var asm = (function(global, env, buffer) {
_firdes_wkernel_hamming: lb,
_fir_decimate_cc: ub,
_encode_ima_adpcm_i16_u8: _b,
_convert_i16_f: Rb,
_convert_i16_f: Sb,
_shift_addition_init: Vb,
_decimating_shift_addition_cc: Yb,
_decimating_shift_addition_init: Xb,
@ -11005,7 +11001,7 @@ var asm = (function(global, env, buffer) {
_fmdemod_quadri_cf: Gb,
_amdemod_cf: zb,
_log2n: Lb,
_convert_f_u8: Sb,
_convert_f_u8: Rb,
_rational_resampler_get_lowpass_f: wb,
_apply_fir_fft_cc: yb,
_fractional_decimator_ff: xb,

View file

@ -20,7 +20,8 @@ print "" # python2.7 is required to run OpenWebRX instead of python3. Please run
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
sw_version="v0.14+"
sw_version="v0.15"
#0.15 (added nmux)
import os
import code
@ -131,7 +132,7 @@ def main():
import_all_plugins("plugins/dsp/")
#Pypy
if pypy: print "pypy detected (and now something completely different: a c code is expected to run at a speed of 3*10^8 m/s?)"
if pypy: print "pypy detected (and now something completely different: c code is expected to run at a speed of 3*10^8 m/s?)"
#Change process name to "openwebrx" (to be seen in ps)
try:
@ -144,11 +145,21 @@ def main():
pass
#Start rtl thread
if os.system("ncat --version > /dev/null") == 32512: #check for ncat
print "[openwebrx-main] Error: ncat not detected, please install it! The ncat tool is a netcat alternative, used for distributing the I/Q data stream. It is usually available in the nmap package (sudo apt-get install nmap). For more explanation, look into the README.md"
if os.system("csdr 2> /dev/null") == 32512: #check for csdr
print "[openwebrx-main] You need to install \"csdr\" to run OpenWebRX!\n"
return
if os.system("nmux --help 2> /dev/null") == 32512: #check for nmux
print "[openwebrx-main] You need to install an up-to-date version of \"csdr\" that contains the \"nmux\" tool to run OpenWebRX! Please upgrade \"csdr\"!\n"
return
if cfg.start_rtl_thread:
cfg.start_rtl_command += "| ncat -4l %d -k --send-only --allow 127.0.0.1" % cfg.iq_server_port
nmux_bufcnt = nmux_bufsize = 0
while nmux_bufsize < cfg.samp_rate/4: nmux_bufsize += 4096
while nmux_bufsize * nmux_bufcnt < cfg.nmux_memory * 1e6: nmux_bufcnt += 1
if nmux_bufcnt == 0 or nmux_bufsize == 0:
print "[openwebrx-main] Error: nmux_bufsize or nmux_bufcnt is zero. These depend on nmux_memory and samp_rate options in config_webrx.py"
return
print "[openwebrx-main] nmux_bufsize = %d, nmux_bufcnt = %d" % (nmux_bufsize, nmux_bufcnt)
cfg.start_rtl_command += "| nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (nmux_bufsize, nmux_bufcnt, cfg.iq_server_port)
rtl_thread=threading.Thread(target = lambda:subprocess.Popen(cfg.start_rtl_command, shell=True), args=())
rtl_thread.start()
print "[openwebrx-main] Started rtl_thread: "+cfg.start_rtl_command
@ -287,6 +298,7 @@ def spectrum_thread_function():
dsp.set_samp_rate(cfg.samp_rate)
dsp.set_fft_size(cfg.fft_size)
dsp.set_fft_fps(cfg.fft_fps)
dsp.set_fft_averages(int(round(1.0 * cfg.samp_rate / cfg.fft_size / cfg.fft_fps / (1.0 - cfg.fft_voverlap_factor))) if cfg.fft_voverlap_factor>0 else 0)
dsp.set_fft_compression(cfg.fft_compression)
dsp.set_format_conversion(cfg.format_conversion)
apply_csdr_cfg_to_dsp(dsp)
@ -631,7 +643,8 @@ class WebRXHandler(BaseHTTPRequestHandler):
("%[START_MOD]",cfg.start_mod),
("%[WATERFALL_COLORS]",cfg.waterfall_colors),
("%[WATERFALL_MIN_LEVEL]",str(cfg.waterfall_min_level)),
("%[WATERFALL_MAX_LEVEL]",str(cfg.waterfall_max_level))
("%[WATERFALL_MAX_LEVEL]",str(cfg.waterfall_max_level)),
("%[WATERFALL_AUTO_LEVEL_MARGIN]","[%d,%d]"%cfg.waterfall_auto_level_margin)
)
for rule in replace_dictionary:
while data.find(rule[0])!=-1:

View file

@ -51,14 +51,17 @@ class dsp_plugin:
self.csdr_print_bufsizes = False
self.csdr_through = False
self.squelch_level = 0
self.fft_averages = 50
def chain(self,which):
any_chain_base="ncat -v 127.0.0.1 {nc_port} | "
any_chain_base="nc -v 127.0.0.1 {nc_port} | "
if self.csdr_dynamic_bufsize: any_chain_base+="csdr setbuf {start_bufsize} | "
if self.csdr_through: any_chain_base+="csdr through | "
any_chain_base+=self.format_conversion+(" | " if self.format_conversion!="" else "") ##"csdr flowcontrol {flowcontrol} auto 1.5 10 | "
if which == "fft":
fft_chain_base = any_chain_base+"csdr fft_cc {fft_size} {fft_block_size} | csdr logpower_cf -70 | csdr fft_exchange_sides_ff {fft_size}"
fft_chain_base = any_chain_base+"csdr fft_cc {fft_size} {fft_block_size} | " + \
("csdr logpower_cf -70 | " if self.fft_averages == 0 else "csdr logaveragepower_cf -70 {fft_size} {fft_averages} | ") + \
"csdr fft_exchange_sides_ff {fft_size}"
if self.fft_compression=="adpcm":
return fft_chain_base+" | csdr compress_fft_adpcm_f_u8 {fft_size}"
else:
@ -67,9 +70,9 @@ class dsp_plugin:
chain_end = ""
if self.audio_compression=="adpcm":
chain_end = " | csdr encode_ima_adpcm_i16_u8"
if which == "nfm": return chain_begin + "csdr fmdemod_quadri_cf | csdr limit_ff | csdr fractional_decimator_ff {last_decimation} | csdr deemphasis_nfm_ff 11025 | csdr fastagc_ff 1024 | csdr convert_f_s16"+chain_end
elif which == "am": return chain_begin + "csdr amdemod_cf | csdr fastdcblock_ff | csdr fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
elif which == "ssb": return chain_begin + "csdr realpart_cf | csdr fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
if which == "nfm": return chain_begin + "csdr fmdemod_quadri_cf | csdr limit_ff | csdr old_fractional_decimator_ff {last_decimation} | csdr deemphasis_nfm_ff 11025 | csdr fastagc_ff 1024 | csdr convert_f_s16"+chain_end
elif which == "am": return chain_begin + "csdr amdemod_cf | csdr fastdcblock_ff | csdr old_fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
elif which == "ssb": return chain_begin + "csdr realpart_cf | csdr old_fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
def set_audio_compression(self,what):
self.audio_compression = what
@ -117,8 +120,13 @@ class dsp_plugin:
#to change this, restart is required
self.fft_fps=fft_fps
def set_fft_averages(self,fft_averages):
#to change this, restart is required
self.fft_averages=fft_averages
def fft_block_size(self):
return self.samp_rate/self.fft_fps
if self.fft_averages == 0: return self.samp_rate/self.fft_fps
else: return self.samp_rate/self.fft_fps/self.fft_averages
def set_format_conversion(self,format_conversion):
self.format_conversion=format_conversion
@ -181,7 +189,7 @@ class dsp_plugin:
#run the command
command=command_base.format( bpf_pipe=self.bpf_pipe, shift_pipe=self.shift_pipe, decimation=self.decimation, \
last_decimation=self.last_decimation, fft_size=self.fft_size, fft_block_size=self.fft_block_size(), \
last_decimation=self.last_decimation, fft_size=self.fft_size, fft_block_size=self.fft_block_size(), fft_averages=self.fft_averages, \
bpf_transition_bw=float(self.bpf_transition_bw)/self.if_samp_rate(), ddc_transition_bw=self.ddc_transition_bw(), \
flowcontrol=int(self.samp_rate*2), start_bufsize=self.base_bufsize*self.decimation, nc_port=self.nc_port, \
squelch_pipe=self.squelch_pipe, smeter_pipe=self.smeter_pipe )