Page 1 of 1

Creating my own custom Audio Processing stream plugin

Posted: Thu Mar 26, 2020 10:14 pm
by birdwes
I realise that there are Audio Processing plugins which exist such as "Downmix" and "Equalizer".

Is there a reference anywhere as to how to create my own custom Audio Processor. I already have my code for the processing part. I just need an indication as to how to integrate it with the I2s streams coming in and going out.

If I could find the source code to the "Equalizer" plugin (not the API example), it would point me in the right direction. Is it publicly available?

If not, a simple demo plugin such as a "null" or "phase invert" demo would do, as long as it has the plumbing.

Re: Creating my own custom Audio Processing stream plugin

Posted: Sat Mar 28, 2020 7:22 pm
by birdwes
OK, I've figured most of it out now.

it turns out that components/esp-adf-libs/esp_codec/equalizer.c IS the glue code.

I've successfully managed to take it and creat a NULL plugin, ready for my insertion of a replacement for the call to esp_equalizer_process, for my transform.

The only thing left for me to take into consideration is to queue the stream bytes into blocks, as my transform expects a fixed block size. I will use a sliding window to mask the block boundaries.

My hardware setup which is PCM1808 ADC->ESP32->PCM5102A is producing stream messages of length 100. What is that? 32+32 bit words times 100?

Re: Creating my own custom Audio Processing stream plugin

Posted: Wed Apr 22, 2020 8:23 pm
by tutuli
Hi, would you kindly share your code here? I'm planning to do some signal processing on LyraT.

Thanks in advance

Re: Creating my own custom Audio Processing stream plugin

Posted: Tue May 05, 2020 3:15 am
by birdwes
Take a good look at https://github.com/espressif/esp-adf-li ... qualizer.c and https://github.com/espressif/esp-adf-li ... qualizer.h.

Replace the calls to anything declared in esp_equalizer.h, to your own replacements.

Oh, top tip... in equalizer.c

#define BUF_SIZE (100)

Change 100 for a multiple of your I2S stereo word size, e.g. 100 is not a multiple of 8 bytes (32 bit stereo), so try 96 or 128? If you don't, you'll get a nasty rasping noise.

My code will be available in due course, but there is a copyright issue I have to sort out before it goes public.

Re: Creating my own custom Audio Processing stream plugin

Posted: Thu Jun 04, 2020 2:28 pm
by tutuli
Thank you for your useful hints. Indeed, it was actually quite easy.
In case anyone is interested, I have implemented a simple nullpipe component which is used in an example (see appendix). I also managed to put an IIR filter from https://github.com/espressif/esp-dsp into the pipe, which is quite simple and straightforward.

Re: Creating my own custom Audio Processing stream plugin

Posted: Mon Mar 15, 2021 1:24 pm
by visionbeast2
hey, can you please share the code with the IIR filter implemented in the nullpipeline.