Espressif DSP Library help

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: Espressif DSP Library help

Postby mikemoy » Mon Dec 04, 2023 12:50 pm

I apologize if that is how my statement came off. It's intention was just to explain I am under the gun on something I know very little about, and could use some help in a big way is all.

You'r expiation was very helpful. Embarrassing obvious now that it was pointed out. If I take the fft example as a starting point. https://github.com/espressif/esp-dsp/bl ... fft_main.c

My A/D data is in bufferA[]. Would I just copy my buffer into x1: memcpy(x1, bufferA, N);
Replacing that with dsps_tone_gen_f32(x1, N, 1.0, 0.16, 0);

FWIW, I realize later in the example it will mix my signal with x2, but just want to start simple with injecting a 1k tone.



Code: Select all

void app_main()
{
    esp_err_t ret;
    ESP_LOGI(TAG, "Start Example.");
    ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE);
    if (ret  != ESP_OK)
    {
        ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret);
        return;
    }

    // Generate hann window
    dsps_wind_hann_f32(wind, N);
    // Generate input signal for x1 A=1 , F=0.1
    dsps_tone_gen_f32(x1, N, 1.0, 0.16,  0);
    // Generate input signal for x2 A=0.1,F=0.2
    dsps_tone_gen_f32(x2, N, 0.1, 0.2, 0);

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: Espressif DSP Library help

Postby mikemoy » Mon Dec 04, 2023 2:51 pm

Seems pretty trivial to me: the functions take int16_t types
FWIW, in the example this function " dsps_tone_gen_f32(x1, N, 1.0, 0.16, 0); "
fills x1 with float values from -1.0 to 1.0. Why do you say it takes int16_t types ?

ESP_Sprite
Posts: 9729
Joined: Thu Nov 26, 2015 4:08 am

Re: Espressif DSP Library help

Postby ESP_Sprite » Tue Dec 05, 2023 2:22 am

That function (dsps_fft2r_fc32) does takes 32-bit floats as the name implies. The function that is used in the other example (dsps_fft2r_sc16_ae32) uses 16-bit signed numbers.

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: Espressif DSP Library help

Postby mikemoy » Tue Dec 05, 2023 3:19 am

I got it working. Thank you guys for the help!

ESP_Sprite
Posts: 9729
Joined: Thu Nov 26, 2015 4:08 am

Re: Espressif DSP Library help

Postby ESP_Sprite » Tue Dec 05, 2023 5:05 am

You're welcome, good luck with the project!

Who is online

Users browsing this forum: Majestic-12 [Bot] and 79 guests