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

Baseband FM PoC #25

Merged
merged 44 commits into from
Nov 7, 2024
Merged

Baseband FM PoC #25

merged 44 commits into from
Nov 7, 2024

Conversation

drowe67
Copy link
Owner

@drowe67 drowe67 commented Aug 30, 2024

Some experiments in using ML with baseband FM radios.

  1. First pass training command line:

    python3 ./train_bbfm.py --cuda-visible-devices 0 --sequence-length 400 --batch-size 512 --epochs 100 --lr 0.003 --lr-decay-factor 0.0001 --plot_loss ~/Downloads/tts_speech_16k_speexdsp.f32 model_bbfm_01 --range_EbNo --range_EbNo_start 6 --plot_loss
    
  2. Inference (runs encoder and decoder, and outputs symbols z_hat.f32):

    ./bbfm_inference.sh model_bbfm_01/checkpoints/checkpoint_epoch_100.pth wav/brian_g8sez.wav - --write_latent z_hat.f32
    
  3. Stand alone decoder, outputs speech from z_hat.f32 to sound card:

    ./bbfm_rx.sh model_bbfm_01/checkpoints/checkpoint_epoch_100.pth z_hat.f32 -
    
  4. Or save speech out to a wave file:

    ./bbfm_rx.sh model_bbfm_01/checkpoints/checkpoint_epoch_100.pth z_hat.f32 t.wav
    
  5. Plot sequence of received symbols:

    octave:4> radae_plots; do_plots_bbfm('z_hat.f32')
    

z_hat

@drowe67
Copy link
Owner Author

drowe67 commented Sep 5, 2024

HF channel sim (two path Rayleigh) is pretty close to TIA-102.CAAA-E 1.6.33 Faded Channel Simulator. The measured level crossing rate (LCR) seems to meet req (f), for v=60 km/hr, f = 450 MHz, and P=1 when measured over a 10 second sample. We've used Rs=2000 symb/s here, so x-axis of plot is 1 second in time.

lmr_60

octave:39>  multipath_samples("lmr60",8000, 2000, 1, 10, "h_lmr60.f32")
Generating Doppler spreading samples...
fd = 25.000
path_delay_s = 2.0000e-04
Nsecplot = 1
Pav = 1.0366
P = 1
LCR_theory = 23.457
LCR_meas = 24.400

@drowe67
Copy link
Owner Author

drowe67 commented Nov 3, 2024

Using the single carrier modem:

  1. Create a file of BBFM symbols, 80 symbols every 40ms, plays expected output speech:
    ./bbfm_inference.sh model_bbfm_01/checkpoints/checkpoint_epoch_100.pth wav/brian_g8sez.wav - --write_latent z.f32
    
  2. Sanity check of modem, BER test using digital, BPSK symbols, the symbols in z.f32 are replaced with BPSK symbols. t.int16 is a real valued Fs=9600Hz sample file, that could be played into a FM radio.
    cat z.f32 | python3 sc_tx.py --ber_test > t.int16
    cat t.int16 | python3 sc_rx.py --ber_test --plots > /dev/null
    
  3. Send the BBFM symbols over the modem, and listen to results:
    cat z.f32 | python3 sc_tx.py > t.int16
    cat t.int16 | python3 sc_rx.py > z_hat.f32
    ./bbfm_rx.sh model_bbfm_01/checkpoints/checkpoint_epoch_100.pth z_hat.f32 -
    
  4. Compare MSE of features passed through the system, first with z == z_hat, then with z passed through modem to get z_hat:
      python3 loss.py features_in.f32 features_out.f32
      loss: 0.033
      python3 loss.py features_in.f32 features_rx_out.f32
      loss: 0.035
    

This is a really good result, and likely inaudible. The feature*.f32 files are produced as intermediate outputs form the bbfm_inference.sh and bbfm_rx.sh scripts.

@drowe67 drowe67 merged commit 490dfcc into main Nov 7, 2024
1 check passed
@drowe67 drowe67 mentioned this pull request Nov 11, 2024
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.

1 participant