This can be derived very generally for any fluid where continuity equation holds. I don't want to think about advection terms in 3D right now, so let's restrict this to a 1D fluid. You can try carrying out all the algebra in 3D yourself. It goes exactly the same. In 1D, continuity is simple enough, ##\frac{\partial \rho}{\partial t} + \frac{\partial}{\partial x}(\rho v) = 0##. Of course, we don't know much about the velocity of the flow from the start, but we know how it changes, so let's differentiate.
\frac{\partial^2 \rho}{\partial t^2} + \frac{\partial}{\partial x}\left(\frac{\partial}{\partial t}(\rho v)\right)
Now, let's look at total time derivative of ##\rho v##. Using chain rule, we arrive at the usual instantaneous change and advection terms.
\frac{d}{dt}(\rho v) = \frac{\partial}{\partial t}(\rho v) + \frac{\partial}{\partial x}(\rho v)\frac{dx}{dt} = \frac{\partial}{\partial t}(\rho v) + v\frac{\partial}{\partial x}(\rho v)
Naturally, I'm interested in that partial time derivative bit, so let me re-arrange things a bit.
\frac{\partial}{\partial t}(\rho v) = \frac{d}{dt}(\rho v) - v\frac{\partial}{\partial x}(\rho v) = \left(\frac{d\rho}{dt}v + \rho\frac{dv}{dt}\right) - \left(v\frac{\partial \rho}{\partial x}v + v\rho \frac{\partial v}{\partial x}\right)
This is probably a good place to linearize. Algebra can be carried on a bit longer to make it a bit more rigorous, but the end result is the same. So long as we are talking about small amplitude vibrations, v is very small, and in fact, we can take it as going to zero. This leaves us with a very simple expression.
\frac{\partial}{\partial t}(\rho v) = \rho \frac{dv}{dt}
This is very fortunate, because ##\rho \frac{dv}{dt}## is the one thing we do know. If I take a small element of fluid of span ##\Delta x##, it experiences a force ##-\Delta P## on it. Taking the limit as ##\Delta x \rightarrow 0##, we get what we are looking for.
\rho \frac{dv}{dt} = -\frac{\partial P}{\partial x} = - \frac{\partial P}{\partial \rho}\frac{\partial \rho}{\partial x}
And now we can put it back into continuity equation.
\frac{\partial^2 \rho}{\partial t^2} - \frac{\partial P}{\partial \rho}\frac{\partial^2 \rho}{\partial x^2} = 0
And that, of course, is just wave equation with ##c^2 = \frac{\partial P}{\partial \rho}##.