need your help about quadrature multiplier

I need your help for arduino quadrature multipler sample code. My project is to multiple quadrature pulse input from encoder and generate quadrature pulse output that already multiple by constanta (i.e I have 20 hz quadrature pulse and I need 40 hz quadrature pulse output, multiple by 2).
Thats all my first questions, I hope you can help me.

This is not as easy as you might hope.
We need to know more about this signal.
What frequency range does it go over?
Does it ever stop? Hoe accurate does the multiplication need to be?

There are several techniques you can use. One is to read the samples into a circular buffer and play them out of the buffer at twice the speed. However you can get glitches when the buffer wraps round.

Depending on the nature of the signal you might be better off using a circuit known as a phase locked loop, or PLL for short.