How to record and playback but with a specified delay

do you have a code snipet i can have to be able to reference from?