This book builds on and in many ways completes the project of Fred Lerdahl and Ray Jackendoff's influential A Generative Theory of Tonal Music. Like the earlier volume, this book is both a music-theoretic treatise and a contribution to the cognitive science of music. After presenting some modifications to Lerdahl and Jackendoff's original framework, the book develops a quantitative model of listeners' intuitions of the relative distances of pitches, chords, and regions from a given tonic. The model is used to derive prolongational structure, trace paths through pitch space at multiple prolongational levels, and compute patterns of tonal tension and attraction as musical events unfold. The consideration of pitch-space paths illuminates issues of musical narrative, and the treatment of tonal tension and attraction provides a technical basis for studies of musical expectation and expression. These investigations lead to a fresh theory of tonal function and reveal an underlying parallel between tonal and metrical structures. Later portions of the book apply these ideas to highly chromatic tonal as well as atonal music. In response to stylistic differences, the shape of pitch space changes and psychoacoustic features become increasingly important, while underlying features of the theory remain constant, reflecting unvarying features of the musical mind. The theory is illustrated throughout by analyses of music from Bach to Schoenberg, and frequent connections are made to the music-theoretic and psychological literature.