Effects of acoustic waves on stick–slip in granular media and implications for earthquakes