code 12 is low battery voltage, but with both the code and the audible tones, I would just find another module and try it . Just bolt the new module to the brackets and plug it in , should work if there are no other problems.
there is No code 31. check it to be sure what you have , there is 21, 41, and 51 but no 31.
the left and right sensors plug in on the strut tower, the left connector is just below the ignition coil and the right is just below the mass air meter. look for a white two wire connector.