Answer:
It depends on the elasticity of the medium
Step-by-step explanation:
If the travelling wave is a longitudinal wave then the speed of the wave is given by the formula

now we know that if the elastic property of medium or the density of medium will change then the wave will change its velocity
for solids we can say that
(Young's Modulus)
and for liquids and gases it is given as
(Bulk Modulus)
so we can say that velocity of the wave will change due to change in medium because it depends on elasticity of the medium and its density