speed=frequency x wavelength
if the medium is the same density and chemical make up all the way through then the speed is fixed because frequency is always unaffected. If density increases then speed decreases which means wavelength will decrease too.