This job can be easily done with a microcontroller ..
For example, PICAXE has a command called PULSIN .. I allows you to measure the length of a pulse .. see attachement below ..
The BASIC program may look like this:
..
pulsin 3, 0, w1 ‘ record the length of a pulse on pin 3 into w1 ..
if w1<135 and w1>125 then story1 ' 135 = 1.35ms
if w1>145 and w1<135 then story2
if w1>145 and w1<155 then story3
goto story2
..
story1:
high1
low2
..
story2:
low1
low2
..
story3:
low1
high2
.. or something similar ..
Regards,
IanP