Sound waves travel faster through denser materials, because the molecules in a tightly packed medium collide more frequently.
The density of a medium affects the speed of sound primarily through its elastic properties and how closely molecules are arranged. In denser materials, the closely packed molecules facilitate quicker transmission of sound waves compared to less dense materials.