replace audio recoding algorithm