Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bandwidth filter #184

Merged
merged 3 commits into from
Sep 12, 2020
Merged

Add bandwidth filter #184

merged 3 commits into from
Sep 12, 2020

Conversation

charlie-foxtrot
Copy link
Owner

Added a configurable bandwidth filter for NFM signals. Can be set either for single channel or scan mode.

Filter is implemented as a low-pass after de-rotating then checking the average power vs squelch.

The calculation of the filter coefficients is based entirely on a simplification of what is posted here: https://www-users.cs.york.ac.uk/~fisher/mkfilter/

NOTE: Also change the default FFT size to 1024 when NFM is enabled.

@szpajder
Copy link
Collaborator

szpajder commented Sep 9, 2020

Just testing it on some rail frequencies and I get quite significant sound distortion, even when lowpassing is disabled. Here is an example: https://drive.google.com/drive/folders/1FZQkPvt5agmqZT6eAytmrknrrmfMSOk0?usp=sharing - the same I/Q file demodulated with the current unstable (old.mp3) and the new code (new_no_lowpass.mp3 and new_lowpass3k.mp3).

@charlie-foxtrot
Copy link
Owner Author

@szpajder I think the bandwidth in your case should be 8 KHz, or maybe 12.5 KHz? The bandwidth parameter is the channel bandwidth, not the filter frequency (the LowpassFilter is created with a frequency of bandwidth/2).

Looking at your signal, it seems to be at least 8 KHz, but that isn't one of the "standard" bandwidths listed here so maybe its 12.5 KHz 🤷

Screen Shot 2020-09-09 at 8 24 15 PM

Running with bandwidth = 8000 on your signal works well, but running with bandwidth not set results in the distortion, will look at it.

@szpajder
Copy link
Collaborator

It's a lot better now, however during strong transmissions distortion is still present. It seems that FFT 1024 is too narrow - I reverted it to 512 and then it sounds fine. See the above link, I've put a new example there (the channel frequency is now 150.1 MHz).

@charlie-foxtrot
Copy link
Owner Author

@szpajder there seems to be something odd going on in your two recordings and FFTs of 512 and 1024 are behaving differently.

Here are the two recordings:

Screen Shot 2020-09-10 at 10 34 53 PM

Both seem to have periods of multiple seconds worth of signals across multiple frequencies coordinated in time.

Using the unstable branch without this PR and comparing FFT of 512 vs 1024 with continuous = true the 512 recording (top) is missing some audio during this period that the 1024 recording (bottom) is picking up. Here is the first iq file:

Screen Shot 2020-09-10 at 10 50 00 PM

And the second:

Screen Shot 2020-09-10 at 10 56 25 PM

Is this the period of distortion you were talking about? If so, it seems that (although the audio quality isn't good) the 1024 is doing "better". Any idea what these periods of strong multi-channel transmissions are?

@szpajder
Copy link
Collaborator

These are spurs caused by some strong digital transmission just outside of the receiver bandwidth. I have plenty of them here, but they are irrelevant to the issue, as the spur occurred in the second half of the recording, while the distorted audio is in the first half (between 4.5 and 9th second on your screenshots).

That initial piece of audio is absent in all three recordings I've shared, which means the squelch didn't open in neither of these cases.

I'd keep the default fft_size at 512 to keep the program behavior unchanged for users that do not wish to enable lowpassing.

@charlie-foxtrot
Copy link
Owner Author

Gotcha, ok, I misunderstood what you meant by "distortion". There is a scratchiness to the audio when using 1024 that isn't there with 512.

For me 1024 is better but that obviously isn't true for everyone, so I shouldn't be changing the default

@szpajder szpajder merged commit 8347d0a into charlie-foxtrot:unstable Sep 12, 2020
@szpajder
Copy link
Collaborator

Merged, thanks.

@szpajder
Copy link
Collaborator

I have enabled this for AM also and I see no adverse effects (so far).

It works incely on HF AM broadcast bands, where channels are densely spaced.

@charlie-foxtrot charlie-foxtrot deleted the bandwidth_final branch October 19, 2020 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants