We investigate the effects of permeability, frequency, and fluid distribution on the viscoelastic behavior of rock. The viscoelastic response of rock to seismic waves depends on the relative motion of pore fluid with respect to the solid phase. Fluid motion depends, in part, on the internal wave-induced pore pressure distribution that relates to the pore microstructure of rock and the scales of saturation. We consider wave-induced squirt fluid flow at two scales: (1) local microscopic flow at the smallest scale of saturation heterogeneity (e.g., within a single pore) and (2) macroscopic flow at a larger scale of fluid-saturated and dry patches. We explore the circumstances under which each of these mechanisms prevails. We examine such flows under the conditions of uniform confining (bulk) compression and obtain the effective dynamic bulk modulus of rock. The solutions are formulated in terms of generalized frequencies that depend on frequency, saturation, fluid and gas properties, and on the macroscopic properties of rock such as permeability, porosity, and dry bulk modulus. The study includes the whole range of saturation and frequency; therefore, we provide the missing link between the low-frequency limit (Gassmann's formula) and the high-frequency limit given by Mavko and Jizba. Further, we compare our model with Biot's theory and introduce a geometrical factor whose numeric value gives an indication as to whether local fluid squirt or global (squirt and/or Biot's) mechanisms dominate the viscoelastic properties of porous materials.The important results of our theoretical modeling are: (1) a hysteresis of acoustic velocity versus saturation resulting from variations in fluid distributions, and (2) two peaks of acoustic wave attenuation--one at low frequency (caused by global squirt-flow) and another at higher frequency (caused by local flow). Both theoretical results are compared with experimental data.