I Taught My Phone to Answer My Samba Drumming (On-Device AI)

Two AI models running on a phone, no cloud, zero latency, all to answer my samba drumming in real time. Here's how I built it in OutSystems. A talk from OutSystems ONE 2026 in Amsterdam. I wanted a virtual drum section that could hear me play and respond, so I put two machine learning models on-device: a CNN that turns audio into Mel-spectrograms to recognize samba call patterns, and a small on-device LLM that improvises a response when the pattern isn't one it knows. Both run on the phone, no cloud, no latency, orchestrated by an OutSystems (ODC) mobile app through Capacitor plugins. The takeaway behind all of it: it's not the models, it's the engineering. What's inside: Why use a CNN for an audio problem (the Mel-spectrogram trick) A 635k-parameter, 2 MB classifier, smaller than a photo on your phone 100% accuracy on the 20% holdout it never trained on (292/292) From Plan A to Plan C: getting an LLM down to 122 ms with SmolLM2 360M and LoRA Wiring TensorFlow and the LLM into OutSystems with Capacitor plugins A live samba demo, played on the spot Chapters: 0:00 Intro 0:34 Samba, the bateria and the repique 2:51 The idea: a drum partner in your pocket 4:14 AI vs machine learning, fast 5:34 Choosing models by the shape of your data 6:17 Why a CNN for audio: Mel-spectrograms 7:05 From sound to label: classes and confidence 9:15 Two models, one phone: the on-device pipeline 10:00 How I built it: 20 hours, training, mobile 12:03 The data: augmentation and gotchas 13:40 The classifier: 2 MB, 100% accuracy 15:12 The LLM: Plan A, B, C, down to 122 ms 17:18 OutSystems: plugins and orchestration 19:25 Live demo 21:35 Key takeaways 22:57 The Forge and wrap-up Plugins on the OutSystems Forge. More tech and samba:    / @afonsometello   #OnDeviceAI #OutSystems #MachineLearning