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

Advise in piping sound stream to RPITX #37

Open
UgoPoddine opened this issue Jun 15, 2018 · 9 comments
Open

Advise in piping sound stream to RPITX #37

UgoPoddine opened this issue Jun 15, 2018 · 9 comments

Comments

@UgoPoddine
Copy link

Hello,

I'm trying to pipe audio from ALSA_LOOPBACK to RPITX using csdr libraries, and to transmit it on USB, using the following statement :

arecord -c1 -r 48000 -D hw:Loopback,1,0 -f S16_LE - | csdr convert_s16_f | csdr dsb_fc | csdr bandpass_fir_fft_cc 0 0.1 0.01 | csdr gain_ff 2.0 | csdr shift_addition_cc 0.2 | sudo rpitx -i- -m IQ -f $FREQUENCY

...on Frequency 28150 KHz.

The effect is to trasmit noise.

Please consider :
A) that audio recorded from alsa_loopback after the "arecord -c1 -r 48000 -D hw:Loopback,1,0 -f S16_LE" statement is correct.
B) that test audio USB transmissions from RPITX on the same frequency using :

rpitx -m IQ -i /home/pi/pat/ssbIQ.wav -f $FREQUENCY -l

... after having created ssbIQ.wav with the RPITX pissb utility, are correctly transmitted over radio channel.

I'm probably making some mistake in using csdr : can you put me on the right way ?

Thank-you
73
Best regards
Ugo IU1IOB

@ha7ilm
Copy link
Owner

ha7ilm commented Jun 15, 2018

Ugo,

I don't know. You should test the DSP chain manually, part by part.

Andras

@UgoPoddine
Copy link
Author

UgoPoddine commented Jun 15, 2018 via email

@ki7oxa
Copy link

ki7oxa commented Jun 15, 2018 via email

@UgoPoddine
Copy link
Author

UgoPoddine commented Jun 16, 2018 via email

@k8wu
Copy link

k8wu commented Jan 3, 2022

I found this open issue on a search. When you use the bandpass_fir_fft_cc method in CSDR, one of the things it does is to initialize four different FFT plans (one for taps, one for forward, and two for backward). The forward and backward FFT plans are all benchmarked on initialization. On just about any desktop/laptop PC with an Intel or AMD x86_64 processor, there will be no delay at all.

However, on the Raspberry Pi single board computers with ARM processors, that's where there is a huge delay. On a Raspberry Pi 4 with 4 GiB of memory running in 64 bit mode, it takes about 20 seconds for bandpass_fir_fft_cc to become ready and start processing data with a transition bandwidth of 0.01 * sample rate. During this time, RPiTX will transmit a dead carrier on the given frequency. If I increase this to 0.1 * sample rate, the delay of start drops to 5 seconds.

I haven't yet figured out a workaround for this, as removing the bandpass filter will result in both sidebands being transmitted.

@ha7ilm
Copy link
Owner

ha7ilm commented Jan 4, 2022

I see. What happens if you recompile the code with benchmarking off?

@k8wu
Copy link

k8wu commented Jan 4, 2022

Running this command with the unmodified csdr gives me this IQ file, which was later demodulated to provide the audio file with the benchmarking on:

cat wx.wav | sox - -t s16 -e signed-integer -b 16 -c 1 -r 48000 - bandpass 1.5k 2.4k | csdr convert_i16_f | csdr fastagc_ff | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.01 0.1 0.001 | csdr shift_addition_cc 0.25 | csdr convert_f_i16 | sox -t s16 -e signed-integer -b 16 -c 2 -r 48000 - wx-benchmark-on.wav

Running this command with the version of csdr that I compiled with the benchmarking in bandpass_fir_fft_cc off gives me this IQ file, which was later demodulated to provide the audio file with the benchmarking off:

cat wx.wav | sox - -t s16 -e signed-integer -b 16 -c 1 -r 48000 - bandpass 1.5k 2.4k | csdr-dbg-no-bm convert_i16_f | csdr-dbg-no-bm fastagc_ff | csdr-dbg-no-bm dsb_fc | csdr-dbg-no-bm bandpass_fir_fft_cc 0.01 0.1 0.001 | csdr-dbg-no-bm shift_addition_cc 0.25 | csdr-dbg-no-bm convert_f_i16 | sox -t s16 -e signed-integer -b 16 -c 2 -r 48000 - wx-benchmark-off.wav

I will provide the demodulated output for both in the attached ZIP file. I did it this way so we can hear what it sounds like before being sent to RPiTX. The bandpass was tuned to try to better manage the SSB bandwidth. The reason there's noise is because it was a weather radio recording originally, and fastagc_ff also amplifies noise (as is expected if there is any).

wx-audio-demod.zip

@ha7ilm
Copy link
Owner

ha7ilm commented Jan 4, 2022

Is there a considerable difference between the two?

@k8wu
Copy link

k8wu commented Jan 5, 2022

I didn't notice any difference. Because I trust my eyes more than my ears, here are the frequency plots from both using Audacity's "Plot Spectrum":

Benchmark on:
benchmark_on

Benchmark off:
benchmark_off

I don't see much of a difference aside from a little bit of rolloff after 7 kHz, but by that point, that's -80 to -90 dBc.

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

No branches or pull requests

4 participants