Acoustic wave attenuation due to vibrational and rotational molecular relaxation, under simplifying assumptions of near-thermodynamic equilibrium and absence of molecular dissociations, can be accounted for by specifying a bulk viscosity coefficient $mu_B$. In this paper, we propose a simple frequency-dependent bulk viscosity model which, under such assumptions, accurately captures wave attenuation rates from infrasonic to ultrasonic frequencies in Navier--Stokes and lattice Boltzmann simulations. The proposed model can be extended to any gas mixture for which molecular relaxation timescales and attenuation measurements are available. The performance of the model is assessed for air by varying the base temperature, pressure, relative humidity $h_r$, and acoustic frequency. Since the vibrational relaxation timescales of oxygen and nitrogen are a function of humidity, for certain frequencies an intermediate value of $h_r$ can be found which maximizes $mu_B$. The contribution to bulk viscosity due to rotational relaxation is verified to be a function of temperature, confirming recent findings in the literature. While $mu_B$ decreases with higher frequencies, its effects on wave attenuation become more significant, as shown via a dimensionless analysis. The proposed bulk viscosity model is designed for frequency-domain linear acoustic formulations but is also extensible to time-domain simulations of narrow-band frequency content flows.