ABSTRACT
Brain oscillations reflect system-level neural dynamics and capture the current brain state. These brain rhythms can be measured noninvasively in humans with electroencephalography (EEG). Up and down states of brain oscillations capture local changes in neuronal excitability. This makes them a promising target for non-invasive brain stimulation methods such as Transcranial Magnetic Stimulation (TMS). Real-time EEG-TMS systems record ongoing brain signals, process the data, and deliver TMS stimuli at a specific brain state. Despite their promise to increase the temporal specificity of stimulation, best practices and technical solutions are still under development. Here, we implement and compare state-of-the-art methods (Fourier based, Autoregressive Prediction) for real-time EEG-TMS and evaluate their performance both in silico and experimentally. We further propose a new robust algorithm for delivering real-time EEG phase-specific stimulation based on short prerecorded EEG training data (Educated Temporal Prediction). We found that Educated Temporal Prediction performs at the same level or better than Fourier-based or Autoregressive methods both in silico and in vivo, while being computationally more efficient. Further, we document a dependency of EEG signal-to-noise ratio (SNR) on algorithm accuracy across all algorithms. In conclusion, our results can give important insights for real-time TMS-EEG technical development as well as experimental design.