This paper concerns the analysis of a multiscale method for wave propagation problems in microscopically nonhomogeneous media. A direct numerical approximation of such problems is prohibitively expensive as it requires resolving the microscopic variations over a much larger physical domain of interest. The heterogeneous multiscale method (HMM) is an efficient framework to approximate the solutions of multiscale problems. In the HMM, one assumes an incomplete macroscopic model which is coupled to a known but expensive microscopic model. The micromodel is solved only locally to upscale the parameter values which are missing in the macromodel. The resulting macroscopic model can then be solved at a cost independent of the small scales in the problem. In general, the accuracy of the HMM is related to how good the upscaling step approximates the right macroscopic quantities. The analysis of the method that we consider here was previously addressed only in purely periodic media, although the method itself is numerically shown to be applicable to more general settings. In the present study, we consider a more realistic setting by assuming a locally periodic medium where slow and fast variations are allowed at the same time. We then prove that the HMM captures the right macroscopic effects. The generality of the tools and ideas in the analysis allows us to establish convergence rates in a multidimensional setting. The theoretical findings here imply an improved convergence rate in one dimension, which also justifies the numerical observations from our earlier study.