The major aim of this proposal is to promote transcranial alternating current stimulation (tACS) from an exploratory method of basic research to a standard tool in neuroscience. Results of the past project period have shown that small changes in anatomy or physiology can result in significant changes of outcomes. First of all, the individual anatomy of the human head with its multiple tissue compartments has to be taken into account in order to target a specific brain region. Second, the individual conductivity of the skull varies severely across subjects and shall be estimated by comparing the EEG responses that depend upon skull conductivity with MEG responses that show no such dependency. Third, the individual frequency of the targeted brain oscillations has to be accounted for in order to achieve entrainment. Therefore, we will develop a closedloop stimulation system which adapts itself to the parameters of individual subjects. This aim requires the development of new mixed finite element methods for hd-tCS and combined EEG/MEG source analysis using application-friendly hexahedral meshes in order to work on automatically segmented MRI images without manual adjustments and to allow highest numerical accuracies while avoiding model errors. In addition, we will apply amplitude-modulated (AM) tACS with a high-frequency carrier frequency in order to separate the artefact and the physiological brain response for on-line processing of EEG data via a simple low-pass filter. New algorithms for on-line preprocessing and on-line learning will be developed. The new methods will be simulated in artificial neural networks before they will be evaluated in human EEG and MEG studies. Finally, the new methods will be applied to test whether modulations of brain oscillations via closed-loop tACS can in turn modulate spatial and temporal aspects of human attention. This would ultimately demonstrate a causal link between brain oscillations and cognition.