How does the state of matter of the medium through which the sound waves and light waves travel theough affect their velocity