diff --git a/README.md b/README.md
index 9717f9db..12d0ab8a 100644
--- a/README.md
+++ b/README.md
@@ -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 OpenWebRX Wiki.
**News (2015-08-18)**
- My BSc. thesis written on OpenWebRX is available here.
@@ -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 rx_tools, see the OpenWebRX Wiki 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:
- libcsdr
- rtl-sdr
-- 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 <randras@sdr.hu>*
## 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 (summary).
-OpenWebRX is also available under a commercial license on request. Please contact me at the address *<randras@sdr.hu>* for other licensing options.
+OpenWebRX is also available under a commercial license on request. Please contact me at the address *<randras@sdr.hu>* for licensing options.
diff --git a/config_webrx.py b/config_webrx.py
index ea693c14..9649f7da 100644
--- a/config_webrx.py
+++ b/config_webrx.py
@@ -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..."
diff --git a/htdocs/index.wrx b/htdocs/index.wrx
index 2debd546..06472103 100644
--- a/htdocs/index.wrx
+++ b/htdocs/index.wrx
@@ -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];
diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js
index a24925eb..9febe02f 100644
--- a/htdocs/openwebrx.js
+++ b/htdocs/openwebrx.js
@@ -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;iaudio_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);
diff --git a/htdocs/sdr.js b/htdocs/sdr.js
index dcc9229d..0ac33ca7 100644
--- a/htdocs/sdr.js
+++ b/htdocs/sdr.js
@@ -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,
diff --git a/openwebrx.py b/openwebrx.py
index 786c853f..98a6a7bd 100755
--- a/openwebrx.py
+++ b/openwebrx.py
@@ -20,7 +20,8 @@ print "" # python2.7 is required to run OpenWebRX instead of python3. Please run
along with this program. If not, see .
"""
-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:
diff --git a/plugins/dsp/csdr/plugin.py b/plugins/dsp/csdr/plugin.py
index be31bfa0..b3214718 100644
--- a/plugins/dsp/csdr/plugin.py
+++ b/plugins/dsp/csdr/plugin.py
@@ -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 )