The gamma rhythm has been implicated in neuronal communication, but causal evidence remains indirect. We measured spike output of local neuronal networks and emulated their synaptic input through optogenetics. Opsins provide currents through somato-dendritic membranes, similar to synapses, yet under experimental control with high temporal precision. We expressed Channelrhodopsin‑2 in excitatory neurons of cat visual cortex and recorded neuronal responses to light with different temporal characteristics. Sine waves of different frequencies entrained neuronal responses with a reliability that peaked for input frequencies in the gamma band. Crucially, we also presented white-noise sequences, because their temporal unpredictability enables analysis of causality. Neuronal spike output was caused specifically by the input’s gamma component. This gamma-specific transfer function is likely an emergent property of in‑vivo networks with feedback inhibition. The method described here could reveal the transfer function between the input to any one and the output of any other neuronal group.