what factors affect the speed of a wave?