How to Create Music Codes?

You are probably talking about MIDI — Musical Instrument Digital Interface. You can capture MIDI codes from played music and then use that information to write out sheet music, using special software. For more information, look here: