make the ambe unvoiced quality configurable

This commit is contained in:
Jakob Ketterl 2019-05-18 22:10:43 +02:00
parent e6150e4aca
commit 0629e6c777
3 changed files with 19 additions and 5 deletions

View File

@ -77,6 +77,10 @@ fft_compression="adpcm" #valid values: "adpcm", "none"
digimodes_enable=True #Decoding digimodes come with higher CPU usage. digimodes_enable=True #Decoding digimodes come with higher CPU usage.
digimodes_fft_size=1024 digimodes_fft_size=1024
# determines the quality, and thus the cpu usage, for the ambe codec used by digital voice modes
# if you're running on a Raspi (up to 3B+) you'll want to leave this on 1
digital_voice_unvoiced_quality = 1
""" """
Note: if you experience audio underruns while CPU usage is 100%, you can: Note: if you experience audio underruns while CPU usage is 100%, you can:
- decrease `samp_rate`, - decrease `samp_rate`,

17
csdr.py
View File

@ -70,6 +70,7 @@ class dsp(object):
self.pipe_names=["bpf_pipe", "shift_pipe", "squelch_pipe", "smeter_pipe", "meta_pipe", "iqtee_pipe", "iqtee2_pipe"] self.pipe_names=["bpf_pipe", "shift_pipe", "squelch_pipe", "smeter_pipe", "meta_pipe", "iqtee_pipe", "iqtee2_pipe"]
self.secondary_pipe_names=["secondary_shift_pipe"] self.secondary_pipe_names=["secondary_shift_pipe"]
self.secondary_offset_freq = 1000 self.secondary_offset_freq = 1000
self.unvoiced_quality = 1
self.modification_lock = threading.Lock() self.modification_lock = threading.Lock()
self.output = output self.output = output
@ -105,11 +106,11 @@ class dsp(object):
chain += "dsd -fd" chain += "dsd -fd"
elif which == "nxdn": elif which == "nxdn":
chain += "dsd -fi" chain += "dsd -fi"
chain += " -i - -o - -u 2 -g 10 | " chain += " -i - -o - -u {unvoiced_quality} -g 10 | "
elif which == "dmr": elif which == "dmr":
chain += "rrc_filter | gfsk_demodulator | dmr_decoder --fifo {meta_pipe} | mbe_synthesizer | " chain += "rrc_filter | gfsk_demodulator | dmr_decoder --fifo {meta_pipe} | mbe_synthesizer -u {unvoiced_quality} | "
elif which == "ysf": elif which == "ysf":
chain += "rrc_filter | gfsk_demodulator | ysf_decoder --fifo {meta_pipe} | mbe_synthesizer -y | " chain += "rrc_filter | gfsk_demodulator | ysf_decoder --fifo {meta_pipe} | mbe_synthesizer -y -u {unvoiced_quality} | "
chain += "sox -t raw -r 8000 -e signed-integer -b 16 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - " chain += "sox -t raw -r 8000 -e signed-integer -b 16 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - "
elif which == "am": elif which == "am":
chain += "csdr amdemod_cf | csdr fastdcblock_ff | " chain += "csdr amdemod_cf | csdr fastdcblock_ff | "
@ -347,6 +348,13 @@ class dsp(object):
self.squelch_pipe_file.flush() self.squelch_pipe_file.flush()
self.modification_lock.release() self.modification_lock.release()
def set_unvoiced_quality(self, q):
self.unvoiced_quality = q
self.restart()
def get_unvoiced_quality(self):
return self.unvoiced_quality
def mkfifo(self,path): def mkfifo(self,path):
try: try:
os.unlink(path) os.unlink(path)
@ -393,7 +401,8 @@ class dsp(object):
bpf_transition_bw=float(self.bpf_transition_bw)/self.if_samp_rate(), ddc_transition_bw=self.ddc_transition_bw(), 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, 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, meta_pipe=self.meta_pipe, iqtee_pipe=self.iqtee_pipe, iqtee2_pipe=self.iqtee2_pipe, squelch_pipe=self.squelch_pipe, smeter_pipe=self.smeter_pipe, meta_pipe=self.meta_pipe, iqtee_pipe=self.iqtee_pipe, iqtee2_pipe=self.iqtee2_pipe,
output_rate = self.get_output_rate(), smeter_report_every = int(self.if_samp_rate()/6000) ) output_rate = self.get_output_rate(), smeter_report_every = int(self.if_samp_rate()/6000),
unvoiced_quality = self.get_unvoiced_quality())
logger.debug("[openwebrx-dsp-plugin:csdr] Command = %s", command) logger.debug("[openwebrx-dsp-plugin:csdr] Command = %s", command)
my_env=os.environ.copy() my_env=os.environ.copy()

View File

@ -355,7 +355,8 @@ class DspManager(csdr.output):
self.localProps.getProperty("squelch_level").wire(self.dsp.set_squelch_level), self.localProps.getProperty("squelch_level").wire(self.dsp.set_squelch_level),
self.localProps.getProperty("low_cut").wire(set_low_cut), self.localProps.getProperty("low_cut").wire(set_low_cut),
self.localProps.getProperty("high_cut").wire(set_high_cut), self.localProps.getProperty("high_cut").wire(set_high_cut),
self.localProps.getProperty("mod").wire(self.dsp.set_demodulator) self.localProps.getProperty("mod").wire(self.dsp.set_demodulator),
self.localProps.getProperty("digital_voice_unvoiced_quality").wire(self.dsp.set_unvoiced_quality)
] ]
self.dsp.set_offset_freq(0) self.dsp.set_offset_freq(0)