In this study, a direct numerical simulation procedure for the cavitating flow noise is presented. The compressible Navier-Stokes equations are written for the two-phase fluid, employing a density-based homogeneous equilibrium model with a linearly-combined equation of state. To resolve the linear and non-linear waves in the cavitating flow, a sixth-order compact central scheme is utilized with the selective spatial filtering technique. The present cavitation model and numerical methods are validated for two benchmark problems: linear wave convection and acoustic saturation in a bubbly flow. The cavitating flow noise is then computed for a 2D circular cylinder flow at Reynolds number based on a cylinder diameter, 200 and cavitation numbers, σ = 0.7 ~ 2. It is observed that, at sub- and super-critical cavitation numbers (σ = 1 and 0.7), the cavitating flow and noise characteristics are significantly changed by the shock waves due to the coherent collapse of the cloud cavitation in the wake. To verify the present direct simulation and further analyze the sources of cavitation noise, an acoustic analogy based on a classical theory of Fitzpatrik and Strasberg is derived. The far-fleld noise predicted by direct simulation is well compared with that of acoustic analogy, and it also confirms the f-2 decaying rate in the spectrum, as predicted by the model of Fitzpatrik and Strasberg with the Rayleigh-Plesset equation.