Optical Fock-state synthesizer