  Preheating after inflation involves large, time-dependent field
inhomogeneities, which act as a classical source of gravitational radiation.
The resulting spectrum might be probed by direct detection experiments if
inflation occurs at a low enough energy scale. In this paper, we develop a
theory and algorithm to calculate, analytically and numerically, the spectrum
of energy density in gravitational waves produced from an inhomogeneous
background of stochastic scalar fields in an expanding universe. We derive some
generic analytical results for the emission of gravity waves by stochastic
media of random fields, which can test the validity/accuracy of numerical
calculations. We contrast our method with other numerical methods in the
literature, and then we apply it to preheating after chaotic inflation. In this
case, we are able to check analytically our numerical results, which differ
significantly from previous works. We discuss how the gravity wave spectrum
builds up with time and find that the amplitude and the frequency of its peak
depend in a relatively simple way on the characteristic spatial scale amplified
during preheating. We then estimate the peak frequency and amplitude of the
spectrum produced in two models of preheating after hybrid inflation, which for
some parameters may be relevant for gravity wave interferometric experiments.
