f4exb / sdrangel

SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay and FunCube
GNU General Public License v3.0
2.77k stars 424 forks source link

DSD demodulator: bass-cut filter for speech. #112

Closed gm8arv closed 6 years ago

gm8arv commented 6 years ago

Comparing the audio from D-Star on SDRangel and my IC-R8600 receiver, it's clear that the Icom box has significant low cut on the D-Star output, making it more like telephone quality, and rather easier to understand. Would it be possible to add something like a 300 Hz high-pass filter option? This could be a useful option for for all audio outputs.

f4exb commented 6 years ago

It is already here and there. You have it for AM demodulation for example and it's good to have it as an option since you may want the bass for broadcast AM. In NFM it is mandatory and permanent due to the very frequent use of subtone squelch.

So if it is an option for digital speech why not. In fact if you use the default mebelib soft codec the quality is really not as good as with a dongle from DVSI (which is also supported) and with the dongle it is no problem to have the bass frequencies it even makes the voice more natural (so to speak...)

This leaves wide FM (WFM and broadcast) where it is not desirable and the SSB which inherently has it with the low cutoff filter. So really the point is digital speeech (DSD decoder). I am changing the title in that sense.

gm8arv commented 6 years ago

Thanks! Although I write software, and would love to help, my language is Delphi and my OS Windows, so not compatible in two ways. Yes, it's the LF transients from the decoder, and general "make it telephone quality (at the low end) which will improve audibility. An option, of course.

f4exb commented 6 years ago

It turns out that it is a quite complex implementation. Because of the digital processing you only get access to audio samples by packets and these samples are short integers (S16LE) and there is no filter already available that work with integers.

Note: I have tried again listening to D-Star with mbelib and it is almost unbearable and I am not even sure a high pass filter would help. If you are a lot into digital voice I really advise to invest into a DVSI dongle like the Thumb DV. Because DMR and YSF use a different option of the codec it may be slightly better.

gm8arv commented 6 years ago

Thanks for checking. I feel sure that there must be some code available somewhere to do a simple filtering job with integers? All of my DSP work has been with integers (back when they were required for speed!). A very simple filter would do, subtracting a low-pass (averaged) version of the signal from the original?

f4exb commented 6 years ago

In fact it is just a matter of designing the IIR filter used in the upsampling from 8 to 48 kS/s. Python scipy has filter design functions for this. So in fact this might not be as complex as I thought. For mbelib processing I would rather port the process in dsdcc.

Issue: https://github.com/f4exb/dsdcc/issues/8 opened

gm8arv commented 6 years ago

Oh, that's good news. Something cutting below ~300 Hz would be fine, and I don't think it needs to be too sharp, so a relatively small length and little CPU load. Sorry I can't help with the implementation, but you'll know best how to do that.

DG9BFC commented 6 years ago

what about adding treble and bass sliders to audio out (and maybe also to audio in / mic in for tx) or in short a tx and an rx equalizer

f4exb commented 6 years ago

Linux users may use an external package like pulseaudio-equalizer since SDRangel interfaces with pulseaudio.

DG9BFC commented 6 years ago

and what about the win users?? .... by the way ... i finally got the lime working with my old laptop (core2duo) ... can see spectrum and waterfall BUT no audio .. grmbl ... hopefully i can find out what i made wrong here in my setup :-( ...

f4exb commented 6 years ago

I am sure there are options for Windows too but I am not a Windows specialist nor a fan. I simply don't see the point of adding more complexity for audio processing inside the plugin.

gm8arv commented 6 years ago

Perhaps this is making things more complex than needed? A simple bass-cut in the audio output (Preferences, Audio, Audio output) path would be quite enough to remove many of the disturbing artefacts (and sounds like Icom have something similar in their IC-R8600 D-Star decoding). If the cut-off is adjustable (even by a .INI file), even better.

f4exb commented 6 years ago

I am sorry but I will not do this. This makes code excessively complex and inefficient. In the general case it has to be made as an ugly hack on the audio FIFO.

f4exb commented 6 years ago

Done in v3.9.0

DG9BFC commented 6 years ago

i just wanted to give some ideas ... but if that simple low cut is enough ... ok on that ..... could anybody help me with my setup?? i have the same problems with rtl dongle that i have with the lime when i click on plus sign (to ad a receiving filter in spectrum) the soft stops working

gm8arv commented 6 years ago

Only tested on D-Star, but the cut seems enough to me, and a very welcome improvement. If anything, the cut-off frequency could be a little lower, but not by much. Many thanks for this enhancement!

f4exb commented 6 years ago

I know it's a bit high because I just used the coefficients found in this document http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch20.pdf using the lowest cut-off possible (0.01) this is still 480 Hz. I was counting on the relatively slow roll-off with just a 2 pole filter. Maybe the Python scipy's signal package can help there. I was not successful with the bandpass but I know the lowpass and highpass should work.

f4exb commented 6 years ago

I have created a discussion group that would be the right place to ask for help: https://groups.io/g/sdrangel

f4exb commented 6 years ago

Cutoff frequency of high pass filter has been lowered in v3.9.1

gm8arv commented 6 years ago

Excellent, but I wouldn't like to see it any lower than that. Thanks for adding this helpful feature.

f4exb commented 6 years ago

OK great