This provides the MATLAB based source code for generating spectral flux acoustic stimulus  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. A short analysis window provides higher temporal resolution and enables quicker response while a long analysis window provides higher spectral resolution, better signal to noise ratio (SNR) which enables an accurate behavioural response. Use of optimal duration of analysis window enables the right trade-off between reaction time and accuracy of the response of an animal. This aspect of auditory perception is ecologically important since a fast and accurate response to acoustic stimuli is critical to the success of many animals, for instance, survival depends on the ability to hunt prey and avoid predators. 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. To examine the processing of auditory time windows, we can employ synthetic stimuli with similar spectro-temporal complexity to human speech or animal 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. 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
OSF does not support the use of Internet Explorer. For optimal performance, please switch to another browser.