EI. Integration in (raspberry pi) (Twilio Example Node.js)

Hi everyone,
I’m able to run an EI audio recognition model on my rpi model 4b (Locally and on the browser) i want to integrate the model and change it so it sends data to ( twilio / telegram ) when it detects specific sounds, i followed this tutorial GitHub - edgeimpulse/example-linux-with-twilio: Object detection which sends a message over Twilio but it’s for Object recognition and i don’t know how to change it or where to start to make it for audio Classification. Any Help will be much appreciated
Thank you

Hello @Junior.F,

You can have a look at the Audio examples here: linux-sdk-python/examples at master · edgeimpulse/linux-sdk-python · GitHub

This is using the Python SDK but Twilio also provides libraries for Python: The Twilio Python Helper Library | Twilio

If you prefer to stick with NodeJS, here you have two examples:

You’ll need to add something like in the example your provided:

try {
                        await twilioClient.messages.create({
                            body: 'Danger! Both human and elephant seen in close proximity!',
                            to: process.env.TWILIO_TO || '',
                            from: process.env.TWILIO_FROM || ''
                        });
                    }
                    catch (ex2) {
                        let ex = <Error>ex2;
                        console.warn('Failed to send a message via Twilio', ex.message || ex.toString());
                    }

In the audioClassifier.on('result',...) block:

audioClassifier.on('result', (ev, timeMs, audioAsPcm) => {
            if (!ev.result.classification) return;

            // Put your custom Twilio logic here

            // print the raw predicted values for this frame
            // (turn into string here so the content does not jump around)
            let c = ev.result.classification;
            for (let k of Object.keys(c)) {
                c[k] = c[k].toFixed(4);
            }
            console.log('classification', timeMs + 'ms.', c);
        });

I hope that helps.

Regards,

Louis

@Junior.F Have you integrated EI with Twilio? If so please let me know.
Regards,
Sanjay