An optical waveguide has a surface. An array of separately actuated bodies
is disposed proximal to the exposed surface, and an actuator separately
actuates at least some of the bodies to change a spectral characteristic
of a wave propagating through the waveguide. Preferably, the bodies are
metal striplines, an electro-optical material is disposed between the
striplines and the exposed surface, and the actuator is a CMOS chip that
imposes a voltage to some or all of the lines. The voltage changes the
refractive index at the interface with the surface, changing an index of
refraction profile of the waveguide and effectively imposing a grating.
Alternatively, the bodies are micro-beams and the actuator, also
controlled by a CMOS chip, separately moves each micro-beam into and out
of proximity to the surface. The grating is programmable via the CMOS
chip. The programmable gratings may be used to couple different waves in
the same or different waveguides, and may act as Bragg gratings, binary
supergratings, or multi-level supergratings.