Cold atoms are loaded into an optical cavity and pumped into two opposite Zeeman states of the F=3 cesium D2 line. (top) An input light pulse with arbitrary polarization state is fed into the ensemble. Due to a spontaneous Raman process, the input superposition of right and left circularly polarization is converted to a single-collective-excitation superposition and a heralding photon is emitted into the resonator mode. (bottom) After a user-defined delay, a read beam converts the atomic state into a single photon, also into the resonator mode, with good efficiency and the same polarization as the input. These successive steps require rotating the atomic spin with a static magnetic field.