Although considerable progress has been made recently in our understanding of the coding of complex sounds in the cerebral cortex, the processing and storage of tone sequences is still poorly understood. We have used functional magnetic resonance imaging to identify brain mechanisms involved in the encoding and retrieval of melodies by studying the anticipation of familiar music. The results suggest a specific role for each of the following brain structures: the anterior part of the right superior temporal cortex, the right inferior frontal cortex and anterior insula, the left anterior prefrontal cortex, the lateral cerebellum, and the anterior cingulate. In a separate study, we investigated single-neuron responses in the auditory cortex of awake behaving monkeys to alternating tone sequences that in humans evoke the perception of "streaming." Depending on the frequency separation between the tones, an initial single stream may segregate into two streams after a build-up period of several seconds. The neural responses in the monkeys' primary auditory cortex (A1) mirror the psychophysical time course extremely well, suggesting that habituation within A1 may be one reason for stream segregation. However, the higher auditory and prefrontal areas found to be activated by musical melodies are expected to interact with primary areas in both bottom-up and top-down fashion to bring about the perceptual organization of sound sequences.