How can I convert a pulsed signal to an analog voltage?
I made a circuit for this (different application).  

Use a 555 in a one-shot configuration, circuit diagrams abound for this on the net.

Make the output pulse "relatively" short, that is short for your expected input frequency.  For example, if you expect 100Hz input then your output pulse MUST be shorter than 10ms because, if triggered 100 times per second the output would be ON all the time.  If too short, you lose sensitivity to frequency change.  Figure out your maximum frequency and make your pulse width shorter than 1/maxfrequency.  

Connect your optical circuit to trigger your 555 pulse. Every time you get an optical pulse, the 555 will generate a shaped output of fixed duration.

Couple the output of that pulse to a "smoother" (a low pass filter).  

To build the LP, put a resistor in series with your pulse lead.  Beyond the resistor, tie a capacitor between it and ground.  

The sizing of both the capacitor and resistor are governed by several factors:

1) The 555 output current limit.  Just use a 1K or larger resistor.

2) Response.  The filtered DC output voltage of this will always track the frequency meaning that the motor frequency will change but the DC voltage will lag.  The response is determined by multiplying R*C.  Bigger is slower but also smoother.

3) #2 above should be designed by the input frequency, the higher the input frequency, the smaller The R*C.  Don't worry too much about this, just build it and play with the values until you get what you like.  Good starting values might be 10K resistor and 100uF capacitor.

BTW, I tested this circuit with expensive equipment (equiv to $1000ish equipment in today's dollars) and it was within about 5% linear and accurate.  The trick is the shaped output pulse.