# WebSDR

# ShinySDR

# OpenWebRX

# How to set up your own server?

    #!/bin/bash
    git clone https://github.com/simonyiszk/openwebrx.git
    git clone https://github.com/simonyiszk/csdr.git
    cd csdr
    make
    sudo make install
    cd ../openwebrx
    vim config_webrx.py #edit config or leave defaults
    ./openwebrx.py

# Story

And now I'm going to tell you a story.
At one of our workshops at the radio club, I told the guys about the basics of SDR: what is A/D conversion, how to deal with signals, and how do some analog and digital modulations work.

# minidemod.c

    #include <math.h>
    #include <stdio.h>

    int main()
    {
    	double i, q, i_last=q_last=0, s;
    	for(;;)
    	{
    		i=((unsigned char)getchar()-127);
    		q=((unsigned char)getchar()-127);
    		// s = ???
    		putchar((unsigned char)(s+127));
    		i_last=i; q_last=q;
    	}
    }

# minidemod.c

    #include <math.h>
    #include <stdio.h>

    int main()
    {
    	double i, q, i_last=0, q_last=0, s;
    	for(;;)
    	{
    		i=((unsigned char)getchar()-127);
    		q=((unsigned char)getchar()-127);
    		s=100*(atan2(i,q)-atan2(i_last,q_last));
    		putchar((unsigned char)(s+127));
    		i_last=i; q_last=q;
    	}
    }

# minidemod.c

    #include <math.h>
    #include <stdio.h>

    int main()
    {
    	double i, q, i_last=0, q_last=0, s;
    	for(;;)
    	{
    		i=((unsigned char)getchar()-127);
    		q=((unsigned char)getchar()-127);
    		s=70*((i*(q-q_last)) - (q*(i-i_last)))/(i*i+q*q);
    		putchar((unsigned char)(s+127));
    		i_last=i; q_last=q;
    	}
    }

# Running minidemod

    #!/bin/bash
    rtl_sdr -s 240000 -f 89500000 -g 20 - | \  # taking I/Q samples
    tcc -lm -run minidemod.c | \           # FM demodulation
    sox -t raw -r 240000 -e unsigned -b 8 \	   # decimation
       -c 1 - -t raw - rate 48000 | \
    mplayer -quiet -rawaudio \                 # sound card output
       samplesize=1:channels=1:rate=48000
       -demuxer rawaudio -

https://github.com/simonyiszk/minidemod/

# lib csdr

    #!/bin/bash

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - |

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \ #shift by -0.350 MHz

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \
    csdr fmdemod_quadri_cf |

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \
    csdr fmdemod_quadri_cf | csdr limit_ff |

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \
    csdr fmdemod_quadri_cf | csdr limit_ff | csdr deemphasis_nfm_ff 48000 | \

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \
    csdr fmdemod_quadri_cf | csdr limit_ff | csdr deemphasis_nfm_ff 48000 | \
    csdr fastagc_ff |

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \
    csdr fmdemod_quadri_cf | csdr limit_ff | csdr deemphasis_nfm_ff 48000 | \
    csdr fastagc_ff | csdr convert_f_i16 |

    #!/bin/bash
    rtl_sdr -s 2400000 -f 145000000 -g 20 - | csdr convert_u8_f | \
    csdr shift_addition_cc -0.145833 | \
    csdr fir_decimate_cc 50 0.005 HAMMING | \
    csdr fmdemod_quadri_cf | csdr limit_ff | csdr deemphasis_nfm_ff 48000 | \
    csdr fastagc_ff | csdr convert_f_i16 | mplayer -cache 1024 -quiet \
       -rawaudio samplesize=2:channels=1:rate=48000 -demuxer rawaudio -

- Small

- Fast to build

- Allows using multiple cores

It is good for embedded systems - is smaller, and is easier and faster to build than GNU Radio. If you ever tried to build GNU Radio from source, you know what I'm talking about. But GNU Radio is much more capable. csdr is good for ham radio needs: AM/FM/SSB It is also a very easy way to do a DSP on multiple CPU cores. Scheduling: key point in dataflow systems like this. When I first tried this, I thought that it will lag, it won't work. But it does, and

# Acceleration

SIMD

GPGPU

FPGA

Image by Gareth Halfacree, flickr user ghalfacree [CC BY-SA 2.0], via Wikimedia Commons

# SIMD

# SSE

# NEON

# Using SIMD

Auto-vectorization (-O3)

C intrinsics

Hand-coded assembly

# sdr.js

libcsdr compiled to ASM.js

# Just one last crazy idea...

Audio: 1D vector of samples

Waterfall: 1D vector of dBm values

...compress both with ADPCM?

# Acknowledgement

János Selmeczi, PhD (HA5FT)

Péter Horváth, PhD (HA5CQA)