drowe67 / radae

Radio Autoencoder - transmission of vocoder features over radio channels
BSD 2-Clause "Simplified" License
13 stars 3 forks source link

UnboundLocalError during some decodes #21

Closed tmiw closed 2 months ago

tmiw commented 2 months ago

Got the following error during decode:

266 state: sync       valid: 1 0 25 Dthresh: 44845.00 Dtmax12: 84950.08 20388.43 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
267 state: sync       valid: 1 0 25 Dthresh: 44733.27 Dtmax12: 84862.50 21321.94 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
268 state: sync       valid: 1 0 25 Dthresh: 44601.70 Dtmax12: 84753.28 21953.54 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
269 state: sync       valid: 1 0 25 Dthresh: 44570.43 Dtmax12: 85379.12 22682.92 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
270 state: sync       valid: 1 0 25 Dthresh: 44468.64 Dtmax12: 84869.13 20998.22 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
271 state: sync       valid: 1 0 25 Dthresh: 44372.59 Dtmax12: 84640.53 18784.51 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
272 state: sync       valid: 1 0 25 Dthresh: 44366.61 Dtmax12: 85983.41 15992.07 tmax:  756 fmax:  -0.00 aux: [0 0 0] uw_err: 0
273 state: sync       valid: 0 0 25 Dthresh: 43816.69 Dtmax12: 43183.19 17047.27 tmax:  756 fmax:  -0.00 aux: [0 0 1] uw_err: 1
Traceback (most recent call last):
  File "/Users/mooneer/devel/radae/radae_rx.py", line 158, in <module>
    tmax,fmax_hat = acq.refine(rx_buf, tmax, fmax, tfine_range, ffine_range)
  File "/Users/mooneer/devel/radae/radae/dsp.py", line 226, in refine
    self.D_fine = Dt1[tmax_ind,:]
UnboundLocalError: local variable 'tmax_ind' referenced before assignment

File used for decode: FreeDV_FromRadio_20240820-113011.wav.zip

drowe67 commented 2 months ago

Thanks. Just confirming - you tried to decode a wave file, not the zip file?

drowe67 commented 2 months ago

@tmiw - also, what Git # and command line to reproduce the problem (ota_test.sh -r <filename> I assume)?

drowe67 commented 2 months ago

So I tried:

unzip ~/Downloads/FreeDV_FromRadio_20240820-113011.wav.zip
 ./ota_test.sh -r __MACOSX/._FreeDV_FromRadio_20240820-113011.wav 
-----------------------------------------------
Process receiver sample
-----------------------------------------------
sox FAIL formats: can't open input file `__MACOSX/._FreeDV_FromRadio_20240820-113011.wav': WAVE: RIFF header not found

and:

file __MACOSX/._FreeDV_FromRadio_20240820-113011.wav 
__MACOSX/._FreeDV_FromRadio_20240820-113011.wav: AppleDouble encoded Macintosh file
drowe67 commented 2 months ago

however the bug was real: https://github.com/drowe67/radae/pull/20/commits/49a2244f976d170568b7ccf2841c71bf370a2af2

tmiw commented 2 months ago

@tmiw - also, what Git # and command line to reproduce the problem (ota_test.sh -r <filename> I assume)?

Looks like this got fixed but I was using 99a3f2b2f966ef34c0313d85841366853dbe4798 before. And this was that radae_demo_rx.sh script I was working on over in freedv-gui.

sox FAIL formats: can't open input file `__MACOSX/._FreeDV_FromRadio_20240820-113011.wav': WAVE: RIFF header not found


and:

file __MACOSX/._FreeDV_FromRadio_20240820-113011.wav __MACOSX/._FreeDV_FromRadio_20240820-113011.wav: AppleDouble encoded Macintosh file

FYI the __MACOSX folder is something special because the Apple filesystem has some filesystem-specific stuff that wouldn't get copied over otherwise. The actual .wav file is not in that folder :)

tmiw commented 2 months ago

@drowe67, new issue on 2a382621842cd9175bf5a991c2f42240a2e8977c using radae_demo_rx.sh:

Traceback (most recent call last):
  File "/Users/mooneer/devel/radae/radae_rx.py", line 158, in <module>
    tmax,fmax_hat = acq.refine(rx_buf, tmax, fmax, tfine_range, ffine_range)
  File "/Users/mooneer/devel/radae/radae/dsp.py", line 227, in refine
    self.D_fine = Dt1[tmax_ind,:]
IndexError: index 171 is out of bounds for axis 0 with size 16

Audio file: tx.wav.zip

drowe67 commented 2 months ago

Pls describe how to repeat the issue (e.g. command line)

tmiw commented 2 months ago

Pls describe how to repeat the issue (e.g. command line)

Hmm, I can't seem to duplicate it now with the following:

sox ~/Downloads/tx\ 2.wav -t raw -c 1 -L -e signed-integer -r 8000 - pad 0 2 | python3 -u int16tof32.py --zeropad |     python3 -u radae_rx.py model19_check3/checkpoints/checkpoint_epoch_100.pth -v 2 --auxdata |     build/src/lpcnet_demo -fargan-synthesis - /dev/null

Might have been something not related to the scripts causing the problem. I'll go ahead and close for now.