A mechanism of temporal variation of seismicity and acoustic emission prior to macrofailure