This provides the MATLAB based source code for fMRI data processing on the auditory time window experiment using SPM12 package. 
Natural sounds including all animal vocalisations have a distinct temporal structure consisting of individual segments that vary with time either slowly or rapidly. The ability to extract, represent, and detect an acoustic feature depends on the time window used for processing the acoustic signal. The optimal duration of analysis window depends upon the underlying acoustic feature that needs to be processed. A slowly varying signal requires a longer analysis window while a rapidly varying signal requires a shorter analysis window. For instance in human speech, phonemes and syllables vary differently and thus require different time windows. Use of different durations of analysis windows requires distinct neuronal populations with appropriate time constants. Thus different regions of the auditory cortex are employed that utilize different time windows. So there exists an anatomical organisation of time window processing in auditory cortex. We aimed to identify the cortical organisation of analysis window in primates since such a comparative study might reveal interesting similarities and differences between humans and non-human primates.
We examined the brain basis for the processing of auditory time windows using synthetic stimuli with similar spectro-temporal complexity to human speech or macaque vocalisations as they enable a controlled parametric manipulation of window duration. We created a synthetic stimulus by manipulating spectral flux, a timbral dimension, to systematically vary the time window duration required to analyse it. Time window of analysis was characterised in terms of the Pearson correlation (r1) between amplitude spectra of adjacent timeframes or equivalently the duration of a stimulus with fixed r1 within which any two acoustic frames show a specified minimum level of correlation (r_min) thus shorter windows have lower r1 while longer windows have higher r1.
We conducted non-invasive functional magnetic resonance imaging in awake three rhesus macaques while they passively listened to these synthetic stimuli whose spectral flux was systematically manipulated to test how the anatomy of their response patterns of time window processing compares to humans. Sparse EPI images were acquired on a 4.7T vertical scanner whilst they carried out visual fixation for a fluid reward. Using SPM12, a general linear model (GLM) analysis allowed single-subject inference to determine the relationship between BOLD and r1 in individual core and belt auditory areas.
Despite a similar overall pattern of changing preference, from shorter time windows in postero-medial areas to longer time windows in antero-lateral areas, monkeys exhibited a reduced sensitivity to longer time windows as compared to humans [PMID 19052218]. This difference in sensitivity is in line with certain behavioural results and might be explained by a specialization of the human brain for speech processing which requires sensitivity to longer time windows.
If you use this code then **please cite this paper**:
 Pradeep Dheerendra, Simon Baumann, Olivier Joly, Fabien Balezeau, Christopher I Petkov, Alexander Thiele, Timothy D Griffiths, "The representation of time windows in primate auditory cortex", Cerebral Cortex, 2021