Gather the information you need to memorize in a list format. If the material you want to memorize isn't in list form, rewrite it as a list. In the case of a piece of music, of course, making it into a list isn't possible, but the rest of the steps can be altered to fit in the case of music.
Decide how many items (or measure of a piece of music) you can memorize in the first few seconds. Study these items briefly, then try to recite them (or play them) from memory.
Add additional items (or measures of music) one or two at a time and recite (play) the list again from the first item. Continue until you have memorized the entire list or thing you are memorizing.
Rehearse your memorized list or piece until you can recite it (or play it) all without pausing to think about what comes next.