# Number of wave modes in a cavity

I'm trying to calculate the number of acoustic modes that can exist in a room in a certain range of frequencies. I thought of using the Rayleigh-Jeans formula for the electromagnetic standing wave modes possible in a cavity ($\frac{dN}{d\nu}=\frac{8\pi V}{c^3}\nu^2$), dividing by two to account for the fact that longitudinal waves such as sound do not have two different polarizations.

I'm not sure that this formula is valid for a non-cubical cavity, though, because the development represents the modes as points in 3d "mode space", and counts them by looking how many of the points are included within a sphere. If the cavity is not a cube, wouldn't there be more modes in a direction than in another, stretching the sphere into an ellipsoid?

My book (Eisberg-Resnick, "Quantum Physics") says that the formula is valid for an arbitrary cavity, but doesn't explain that statement. Can someone explain to me why I'm wrong?