An immersed boundary method of discrete type is tested as a tool for direct numerical simulation of aeroacoustic sound. The numerical method consists of the WENO scheme, the immersed boundary method by Chaudhuri et al. (J. Comp. Phys. Vol. 230, 1731-1748 (2011)), and the perfectly matched layer together with the dyadic mesh refinement and the Runge-Kutta method. The accuracy of the method is shown to be sufficient for four basic problems: propagation of acoustic waves, aeroacoustic sound generation in a flow past a fixed circular cylinder, in a flow past an oscillating square cylinder, and from a vortex pair passing through a circular cylinder. The results confirm that the developed method can deal with moving bodies and it is accurate not only for viscous flows but also for inviscid flows.