A method and system for controlling optical signal to noise ratio (OSNR) of an optical signal at a receiver end of an optical link. A multi-bit sample stream is generated using a compensation function adapted to compensate impairments of the optical link A digital noise signal is generated and added to the multi-bit sample stream, and the resulting signal used to generate a degraded optical signal, which is then transmitted through the optical link.