Creating my own custom Audio Processing stream plugin

birdwes
Posts: 4
Joined: Thu Mar 26, 2020 9:58 pm

Creating my own custom Audio Processing stream plugin

Postby birdwes » Thu Mar 26, 2020 10:14 pm

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.

birdwes
Posts: 4
Joined: Thu Mar 26, 2020 9:58 pm

Re: Creating my own custom Audio Processing stream plugin

Postby birdwes » Sat Mar 28, 2020 7:22 pm

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?

tutuli
Posts: 3
Joined: Wed Apr 22, 2020 8:18 pm

Re: Creating my own custom Audio Processing stream plugin

Postby tutuli » Wed Apr 22, 2020 8:23 pm

Hi, would you kindly share your code here? I'm planning to do some signal processing on LyraT.

Thanks in advance

birdwes
Posts: 4
Joined: Thu Mar 26, 2020 9:58 pm

Re: Creating my own custom Audio Processing stream plugin

Postby birdwes » Tue May 05, 2020 3:15 am

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.

tutuli
Posts: 3
Joined: Wed Apr 22, 2020 8:18 pm

Re: Creating my own custom Audio Processing stream plugin

Postby tutuli » Thu Jun 04, 2020 2:28 pm

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.
Attachments
pipeline_nullpipe.zip
(1.33 MiB) Downloaded 821 times

visionbeast2
Posts: 1
Joined: Mon Mar 15, 2021 1:20 pm

Re: Creating my own custom Audio Processing stream plugin

Postby visionbeast2 » Mon Mar 15, 2021 1:24 pm

hey, can you please share the code with the IIR filter implemented in the nullpipeline.

Who is online

Users browsing this forum: No registered users and 14 guests