add integrations for dmr, d-star and nxdn via dsd

This commit is contained in:
Jakob Ketterl 2016-10-15 14:30:30 +00:00
parent 875b1a5384
commit ddac30db63
5 changed files with 41 additions and 6 deletions

View File

@ -88,6 +88,9 @@
<div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('lsb');">LSB</div> <div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('lsb');">LSB</div>
<div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('usb');">USB</div> <div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('usb');">USB</div>
<div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('cw');">CW</div> <div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('cw');">CW</div>
<div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('dmr');">DMR</div>
<div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('dstar');">DStar</div>
<div class="openwebrx-button openwebrx-demodulator-button" onclick="demodulator_analog_replace('nxdn');">NXDN</div>
</div> </div>
<div class="openwebrx-panel-line"> <div class="openwebrx-panel-line">
<div title="Mute on/off" id="openwebrx-mute-off" class="openwebrx-button" onclick="toggleMute();"><img src="gfx/openwebrx-speaker.png" class="openwebrx-sliderbtn-img" id="openwebrx-mute-img"></div> <div title="Mute on/off" id="openwebrx-mute-off" class="openwebrx-button" onclick="toggleMute();"><img src="gfx/openwebrx-speaker.png" class="openwebrx-sliderbtn-img" id="openwebrx-mute-img"></div>

View File

@ -560,7 +560,7 @@ input[type=range]:focus::-ms-fill-upper
.openwebrx-demodulator-button .openwebrx-demodulator-button
{ {
width: 35px; width: 50px;
height: 19px; height: 19px;
font-size: 12pt; font-size: 12pt;
text-align: center; text-align: center;

View File

@ -429,6 +429,11 @@ function demodulator_default_analog(offset_frequency,subtype)
this.low_cut=-4000; this.low_cut=-4000;
this.high_cut=4000; this.high_cut=4000;
} }
else if(subtype=="dmr" || subtype=="dstar" || subtype=="nxdn")
{
this.low_cut=-6500;
this.high_cut=6500;
}
else if(subtype=="am") else if(subtype=="am")
{ {
this.low_cut=-4000; this.low_cut=-4000;

View File

@ -469,9 +469,13 @@ class WebRXHandler(BaseHTTPRequestHandler):
# ========= send audio ========= # ========= send audio =========
if dsp_initialized: if dsp_initialized:
myclient.loopstat=10 myclient.loopstat=10
temp_audio_data=dsp.read(256) temp_audio_data=dsp.read_async(256)
if (temp_audio_data is not None):
myclient.loopstat=11 myclient.loopstat=11
rxws.send(self, temp_audio_data, "AUD ") rxws.send(self, temp_audio_data, "AUD ")
else:
#time.sleep((256.0 * 32) / 11025)
time.sleep(.01)
# ========= send spectrum ========= # ========= send spectrum =========
while not myclient.spectrum_queue.empty(): while not myclient.spectrum_queue.empty():

View File

@ -26,6 +26,7 @@ import os
import code import code
import signal import signal
import fcntl import fcntl
import select
class dsp_plugin: class dsp_plugin:
@ -53,6 +54,10 @@ class dsp_plugin:
self.squelch_level = 0 self.squelch_level = 0
def chain(self,which): def chain(self,which):
if which in [ "dmr", "dstar", "nxdn" ]:
self.set_output_rate(48000)
else:
self.set_output_rate(11025)
any_chain_base="ncat -v 127.0.0.1 {nc_port} | " any_chain_base="ncat -v 127.0.0.1 {nc_port} | "
if self.csdr_dynamic_bufsize: any_chain_base+="csdr setbuf {start_bufsize} | " if self.csdr_dynamic_bufsize: any_chain_base+="csdr setbuf {start_bufsize} | "
if self.csdr_through: any_chain_base+="csdr through | " if self.csdr_through: any_chain_base+="csdr through | "
@ -67,7 +72,19 @@ class dsp_plugin:
chain_end = "" chain_end = ""
if self.audio_compression=="adpcm": if self.audio_compression=="adpcm":
chain_end = " | csdr encode_ima_adpcm_i16_u8" 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 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 convert_f_s16"+chain_end
if which in [ "dmr", "dstar", "nxdn" ]:
c = chain_begin
c += "csdr fmdemod_quadri_cf | csdr convert_f_s16"
if which == "dmr":
c += " | dsd -i - -o - -mg -fr -u 1"
elif which == "dstar":
c += " | dsd -i - -o - -fd"
elif which == "nxdn":
c += " | dsd -i - -o -"
c += " | sox -t raw -r 8000 -e signed-integer -b 16 -c 1 --buffer 256 - -t raw -r 11025 -e signed-integer -b 16 -c 1 -"
c += chain_end
return c
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 == "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 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
@ -85,7 +102,7 @@ class dsp_plugin:
#to change this, restart is required #to change this, restart is required
self.samp_rate=samp_rate self.samp_rate=samp_rate
self.decimation=1 self.decimation=1
while self.samp_rate/(self.decimation+1)>self.output_rate: while self.samp_rate/(self.decimation+1)>=self.output_rate:
self.decimation+=1 self.decimation+=1
self.last_decimation=float(self.if_samp_rate())/self.output_rate self.last_decimation=float(self.if_samp_rate())/self.output_rate
@ -211,6 +228,12 @@ class dsp_plugin:
def read(self,size): def read(self,size):
return self.process.stdout.read(size) return self.process.stdout.read(size)
def read_async(self, size):
if (select.select([self.process.stdout], [], [], 0)[0] != []):
return self.process.stdout.read(size)
else:
return None
def stop(self): def stop(self):
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM) os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
#if(self.process.poll()!=None):return # returns None while subprocess is running #if(self.process.poll()!=None):return # returns None while subprocess is running