Sound waves travel faster through denser materials, because the molecules in a tightly packed medium collide more frequently.
In general, while sound can travel through gases, liquids, and solids, it travels fastest in solids due to their closely packed molecules, which allow for quicker transmission of the sound waves through more frequent collisions.