Ideal gas law man. Temperature is a function of pressure and density. The only reason you generally write the speed of sound as a function of temperature is because it’s a simpler equation. You can just as accurately write it as sqrt(bulk modulus / density).