average the last n samples and emit the result as a stream