Here are a few ways contrasting is achieved in music:
Melody: Different melodies or melodic phrases may be contrasted by varying the pitch range, contour, rhythm, or character of the melodies.
Harmony: Harmonic contrast can be created by using different chord progressions, key changes, or dissonant harmonies against consonant ones.
Rhythm: Contrasting rhythms can be achieved by changing the tempo, meter, or rhythmic patterns.
Texture: Texture contrast involves varying the thickness, density, or layering of musical sounds.
Dynamics: Dynamic contrast refers to the alternation of loud (forte) and soft (piano) passages.
Instrumentation: Different instruments or groups of instruments can be contrasted by using various timbres or instrumental combinations.
By employing contrasting elements, composers can create sections that are distinct and varied, preventing a piece of music from becoming monotonous. Contrasting also helps shape the musical narrative, emphasize important themes or moments, and generate tension and release.
Contrasting is a fundamental technique in music composition, contributing significantly to the richness, expressiveness, and overall appeal of a musical work.