Factors on which the speed of sound depends in a medium are:
Density of the medium: When the medium is dense, the molecules are closely pack to each other and hence lot of force is required by the molecules so as to produce sound wave. Also, the speed of sound decreases with increase in the density of the medium.
Temperature of the medium: Sound waves are directly proportional to the temperature of the medium. Therefore, as the temperature increases, the speed of sound increases and vice versa.