Авто нотч
43025 просмотров, 22 ответов — стр. 2 из 2
13 октября 2020 г. в 06:40#16
Мы срисовали откуда то...
14 октября 2020 г. в 06:37#17
Исправил mu с 2 на 0.0001
Как то заработало. Каряво конечно, но хоть так пока. Шум теперь постоянно. Во времени артефакты всякие вылазят.
Сильно все во времени растянуто. Тон когда появляется то система его начинает гасить крайне медленно.
На фото лучший вариант.
Тональник у меня подается и исчезает по 1 сек, от него остается яма, когда его нет.
Как то заработало. Каряво конечно, но хоть так пока. Шум теперь постоянно. Во времени артефакты всякие вылазят.
Сильно все во времени растянуто. Тон когда появляется то система его начинает гасить крайне медленно.
На фото лучший вариант.
Тональник у меня подается и исчезает по 1 сек, от него остается яма, когда его нет.
14 октября 2020 г. в 07:32#18
Ну понятно, что я все не правильно делаю.
14 октября 2020 г. в 09:01#19
Запустил. Надо было референс обновлять.
Красные точки это появление тональника.
Красные точки это появление тональника.
14 октября 2020 г. в 09:06#20
Тест работы авто нотч
https://drive.google.com/file/d/1zLI6Nf6rTqPYlmVtQIBQwNlEY4gQ4s7Q/view?usp=sharing
https://drive.google.com/file/d/1zLI6Nf6rTqPYlmVtQIBQwNlEY4gQ4s7Q/view?usp=sharing
14 октября 2020 г. в 09:15#21
У UA3REO не спрашивал разрешения, надеюсь он не обидится.
https://github.com/XGudron/UA3REO-DDC-Transceiver/tree/master/STM32/Src
Код: [Выделить]#include "auto_notch.h"
#include <arm_math.h>
// Private variables
static AN_Instance RX1_AN_instance = {0}; // filter instances for two receivers
// initialize the automatic notch filter
void InitAutoNotchReduction(void)
{
arm_lms_norm_init_f32(&RX1_AN_instance.lms2_Norm_instance, AUTO_NOTCH_TAPS,RX1_AN_instance.lms2_normCoeff_f32 , RX1_AN_instance.lms2_stateF32, AUTO_NOTCH_STEP, AUTO_NOTCH_BLOCK_SIZE);
AUTO_NOTCH_STEP, AUTO_NOTCH_BLOCK_SIZE);
arm_fill_f32(0.0f, RX1_AN_instance.lms2_reference, AUTO_NOTCH_REFERENCE_SIZE);
arm_fill_f32(0.0f, RX1_AN_instance.lms2_normCoeff_f32, AUTO_NOTCH_TAPS);
}
// start automatic notch filter
void processAutoNotchReduction(float32_t *buffer)
{
AN_Instance *instance = &RX1_AN_instance;
for (uint32_t i = 0; i < AUTO_NOTCH_REFERENCE_SIZE; i++)
if (isnanf(instance->lms2_reference[i]))
InitAutoNotchReduction();
arm_copy_f32(buffer, &instance->lms2_reference[instance->reference_index_new], AUTO_NOTCH_BLOCK_SIZE); // save the data to the reference buffer
arm_lms_norm_f32(&instance->lms2_Norm_instance, buffer, &instance->lms2_reference[instance->reference_index_old], instance->lms2_errsig2, buffer, AUTO_NOTCH_BLOCK_SIZE); // start LMS filter
instance->reference_index_old += AUTO_NOTCH_BLOCK_SIZE; // move along the reference buffer
if (instance->reference_index_old >= AUTO_NOTCH_REFERENCE_SIZE)
instance->reference_index_old = 0;
instance->reference_index_new = instance->reference_index_old + AUTO_NOTCH_BLOCK_SIZE;
if (instance->reference_index_new >= AUTO_NOTCH_REFERENCE_SIZE)
instance->reference_index_new = 0;
}
.h
от красного зависит качество фильтра
от зеленого скорость
#define AUTO_NOTCH_TAPS 40 // filter order
#define AUTO_NOTCH_STEP 0.0005f
Код: [Выделить]#define AUTO_NOTCH_BLOCK_SIZE 1024 // block size for processing
#define AUTO_NOTCH_TAPS 40 // filter order
#define AUTO_NOTCH_REFERENCE_SIZE (AUTO_NOTCH_BLOCK_SIZE * 2) // size of the reference buffer
#define AUTO_NOTCH_STEP 0.0005f // LMS algorithm step
typedef struct // filter instance
{
arm_lms_norm_instance_f32 lms2_Norm_instance;
float32_t lms2_stateF32[AUTO_NOTCH_TAPS + AUTO_NOTCH_BLOCK_SIZE - 1];
float32_t lms2_normCoeff_f32[AUTO_NOTCH_TAPS];
float32_t lms2_reference[AUTO_NOTCH_REFERENCE_SIZE];
float32_t lms2_errsig2[AUTO_NOTCH_BLOCK_SIZE];
uint_fast16_t reference_index_old;
uint_fast16_t reference_index_new;
} AN_Instance;
// Public methods
extern void InitAutoNotchReduction(void); // initialize the automatic notch filter
extern void processAutoNotchReduction(float32_t *buffer); // start automatic notch filter
https://github.com/XGudron/UA3REO-DDC-Transceiver/tree/master/STM32/Src
Код: [Выделить]#include "auto_notch.h"
#include <arm_math.h>
// Private variables
static AN_Instance RX1_AN_instance = {0}; // filter instances for two receivers
// initialize the automatic notch filter
void InitAutoNotchReduction(void)
{
arm_lms_norm_init_f32(&RX1_AN_instance.lms2_Norm_instance, AUTO_NOTCH_TAPS,RX1_AN_instance.lms2_normCoeff_f32 , RX1_AN_instance.lms2_stateF32, AUTO_NOTCH_STEP, AUTO_NOTCH_BLOCK_SIZE);
AUTO_NOTCH_STEP, AUTO_NOTCH_BLOCK_SIZE);
arm_fill_f32(0.0f, RX1_AN_instance.lms2_reference, AUTO_NOTCH_REFERENCE_SIZE);
arm_fill_f32(0.0f, RX1_AN_instance.lms2_normCoeff_f32, AUTO_NOTCH_TAPS);
}
// start automatic notch filter
void processAutoNotchReduction(float32_t *buffer)
{
AN_Instance *instance = &RX1_AN_instance;
for (uint32_t i = 0; i < AUTO_NOTCH_REFERENCE_SIZE; i++)
if (isnanf(instance->lms2_reference[i]))
InitAutoNotchReduction();
arm_copy_f32(buffer, &instance->lms2_reference[instance->reference_index_new], AUTO_NOTCH_BLOCK_SIZE); // save the data to the reference buffer
arm_lms_norm_f32(&instance->lms2_Norm_instance, buffer, &instance->lms2_reference[instance->reference_index_old], instance->lms2_errsig2, buffer, AUTO_NOTCH_BLOCK_SIZE); // start LMS filter
instance->reference_index_old += AUTO_NOTCH_BLOCK_SIZE; // move along the reference buffer
if (instance->reference_index_old >= AUTO_NOTCH_REFERENCE_SIZE)
instance->reference_index_old = 0;
instance->reference_index_new = instance->reference_index_old + AUTO_NOTCH_BLOCK_SIZE;
if (instance->reference_index_new >= AUTO_NOTCH_REFERENCE_SIZE)
instance->reference_index_new = 0;
}
.h
от красного зависит качество фильтра
от зеленого скорость
#define AUTO_NOTCH_TAPS 40 // filter order
#define AUTO_NOTCH_STEP 0.0005f
Код: [Выделить]#define AUTO_NOTCH_BLOCK_SIZE 1024 // block size for processing
#define AUTO_NOTCH_TAPS 40 // filter order
#define AUTO_NOTCH_REFERENCE_SIZE (AUTO_NOTCH_BLOCK_SIZE * 2) // size of the reference buffer
#define AUTO_NOTCH_STEP 0.0005f // LMS algorithm step
typedef struct // filter instance
{
arm_lms_norm_instance_f32 lms2_Norm_instance;
float32_t lms2_stateF32[AUTO_NOTCH_TAPS + AUTO_NOTCH_BLOCK_SIZE - 1];
float32_t lms2_normCoeff_f32[AUTO_NOTCH_TAPS];
float32_t lms2_reference[AUTO_NOTCH_REFERENCE_SIZE];
float32_t lms2_errsig2[AUTO_NOTCH_BLOCK_SIZE];
uint_fast16_t reference_index_old;
uint_fast16_t reference_index_new;
} AN_Instance;
// Public methods
extern void InitAutoNotchReduction(void); // initialize the automatic notch filter
extern void processAutoNotchReduction(float32_t *buffer); // start automatic notch filter
14 октября 2020 г. в 09:21#22
Морзянка взрывает мозг
Нужна задержка.
Нужна задержка.