For over a century, models of pitch perception have been based on the frequency composition of the sound. Pitch phenomena can also be explained, however, in terms of the time structure, or temporal regularity, of sounds. To locate the mechanism for the detection of temporal regularity in humans, we used functional imaging and a 'delay-and-add' noise, which activates all frequency regions uniformly, like noise, but which nevertheless produces strong pitch perceptions and tuneful melodies. This stimulus has temporal regularity that can be systematically altered. We found that the activity of primary auditory cortex increased with the regularity of the sound. Moreover, a melody composed of delay-and-add 'notes' produced a distinct pattern of activation in two areas of the temporal lobe distinct from primary auditory cortex. These results suggest a hierarchical analysis of time structure in the human brain.