Amorphous CNx and CNx:H have been prepared by the ion beam assisted deposition technique. Samples were characterized through X-ray and UV photoemission, IR absorption and Raman spectroscopies. These spectra have been interpreted with the aid of quantum chemical calculations based upon the Hartree-Fock theory on several molecular models. The understanding of the electronic and structural properties of the amorphous alloy as a function of nitrogen content could help in the task of synthesizing the metastable silicon-nitride like-phase beta-C3N4 , a solid which has been predicted to be as hard as diamond. The physical picture emerging from the present study helps to clarify the difficulties in obtaining the crystalline phase of the material, suggesting new experimental directions for syntheses.