1. A system comprising: a processor configured to receive information from a hard disk drive (HDD) via a read channel and recover data from the HDD using maximum transition run (MTR) modulation code; and a memory having computer executable instructions stored thereon, the computer executable instructions configured for execution by the processor to: model a magnetic recording channel as a partial response channel, model a source of information to the magnetic recording channel to provide an optimized Markov source, and construct an MTR modulation code to mimic the optimized Markov source based upon a finite state machine (FSM) having a limited transition run length and a multi-level periodic structure, the FSM providing at least two different sets of penalties in a period.