What Is the Best Way to Pulse Modulate LEDs?

There is a common belief that it is best to drive LEDs with square waves. This idea seems to be related to the use of tuned receiver circuits and the observation that, of all rectangular waveshapes, the squarewave (50% duty factor) has the most energy at the fundamental. However, for LED transmission/reception, much higher SNR is usually possible with smaller DF. This has to do with the nature of the LEDs themselves (you can achieve higher peak power by reducing DF) and with the nature of the dominant noise sources (shot noise in photodetector junction(s), op-amp input noise, and ambient light fluctuations (especially 2x mains freq), which add up to a noise spectrum that tilts up at low frequency. Consequently, a great many photoelectric data channels are operated at low DF with matched filters (or, for cheap systems, peak detectors) which, unlike traditional tuned circuits, do not have maximum output when all the energy is at the fundamental.