# EEGSpeech

> A CNN-LSTM research prototype for classifying imagined phonemes from scalp EEG, with 92.67% accuracy in a controlled, limited-phoneme evaluation.

14 June 2025 · Updated 2026-11-25 · [Original on Medium](https://tirthkanani18.medium.com/building-a-brain-computer-interface-how-i-decoded-speech-from-brain-waves-using-deep-learning-91fb86074cbf)

92.67% accuracy on phoneme classification in the reported controlled evaluation.

Controlled conditions, a limited phoneme set and coached participants. The research prototype is not ready for clinical use.

EEGSpeech asks a small question within a much larger problem: can a model tell which speech sound someone is imagining from a recording made at the scalp? The motivation was communication for people who cannot speak. The experiment used a limited set of phonemes, rather than attempting to recover unrestricted speech.

The recordings need considerable work before they reach the model. I filtered the signals between 8 and 30 Hz and rejected trials affected by eye blinks or jaw movement. Each remaining trial is a multichannel time series, a few seconds of measurements while someone imagines a particular sound. Noise and the small dataset constrain almost every decision that follows.

## Two structures in one recording

I used a CNN-LSTM hybrid to handle two structures in the same input. Convolutional layers learn patterns across electrode channels. The LSTM follows how those patterns develop over time. A trial contains both, so reducing it to a static set of measurements would discard part of what the model has to work with.

Training combined stratified cross-validation, time-shift augmentation, noise injection and a weighted loss for the class imbalance. The final model reached 92.67% phoneme-classification accuracy. The scope of that number matters: controlled conditions, coached participants and a limited phoneme set. It is not a measure of everyday communication performance or clinical effectiveness.

## Looking beyond the class label

Grad-CAM adds a view of the channels and time windows associated with a prediction. It helps show which parts of a recording the model relied on. A vision-language model also produces plain-language descriptions of the output. Both sit beside the prediction so a researcher can review more than a class label.

The pipeline runs locally in Docker through a Streamlit interface. A researcher can load a recording, run the preprocessing and model, and review the output in one place. EEGSpeech remains a research prototype. The distance between recognising a phoneme in a controlled experiment and supporting a person’s communication is still substantial.

---

By [Tirth Kanani](https://tirthkanani.com/index.md). Human version: https://tirthkanani.com/writing/eegspeech
