The study of the sound patterns of a language, including the rules governing the combination and distribution of phonemes.