Yes. The velocity of a longitudinal wave is inversely proportional to the root of the density of the medium.
Basically, the velocity decreases as the medium gets denser - but the frequency stays the same. We know f = v/lamda is constant. So as the wave goes through a denser medium, the velocity will decrease and the wavelength will also decrease proportionally.