We model the acoustics of rocks partially saturated with hydrogen. We compare the acoustic properties of H2 (hydrogen), CO2 (carbon dioxide) and CH4 (methane) and those of rocks saturated with these gases and brine. The gas properties are obtained from the Peng-Robinson equation of state, and we consider the pressure-temperature conditions based on a linear basin modeling with a constant geothermal gradient. The bulk and shear moduli of the dry rock are obtained with the Krief model, while the Athy equation is used to calculate the porosity as a function of depth. Mesoscopic attenuation and velocity dispersion due to fluid effects is quantified using the Johnson model. The viscoelastic Cole-Cole model is used to describe the velocities and attenuation predicted by the Johnson model when synthetic seismograms with an equivalent viscoelastic rheology are to be calculated. In this case, the P-wave velocity as a function of gas saturation is obtained with the Gassmann equation and an effective fluid modulus based on the Brie equation.