DerekRowell / AudioSDR

A Teensy Audio Library class for a complete SDR demod/processor
24 stars 9 forks source link

Converted to F32 for OpenAudio_Library #1

Open K7MDL2 opened 2 years ago

K7MDL2 commented 2 years ago

I converted your AudioSDRpreProcessor to F32 to work on Teensy 4.0/4.1 with the 32bit floating point OpenAudio_Library for my Teensy SDR project.

A copy of these 2 new file versions are distributed in my SDR builds. Thank you for your efforts to create this, it is a significant problem solved.

I would like to contribute the changed files to you. AudioSDRpreProcessor_F32.h AudioSDRpreProcessor)F32.cpp

I am not a GitHub guru and Pull Requests are mystery to me so jsut linking to my GitHub

K7MDL2 GitHub Link to files

Edited Feb 26 2022: Removed the pasted code form original post as I found some bugs in it (and the original version). See next post.

Mike K7MDL

K7MDL2 commented 2 years ago

I have since fixed a couple wrong data types I missed.

There is a small bug I found in the original 16bit version where the saved sample for the Q channel is saved in the I channel instead. See next to the last line below.

if (I2Scorrection == 1){
int16_t temp = blockI->data[n_block-1]; // save the most recent sample for the next buffer
for(int16_t i=n_block-1; i>0; i--) blockI->data[i] = blockI->data[i-1];
blockI->data[0] = savedSample;
savedSample = temp;}
else if (I2Scorrection == -1){
int16_t temp = blockQ->data[n_block-1]; // save the most recent sample for the next buffer
for(int16_t i=n_block-1; i>0; i--) blockQ->data[i] = blockQ->data[i-1];
blockI->data[0] = savedSample;
savedSample = temp;
}

I looked at the raw data of the FFT output in both the 16 and 32 bit versions and they look the same whcih is good. I found that raising the imbalance ratio threshold from 10 to 100 provided more reliable correction detection.

The latest updates are on my GitHub.