We present a formalism for investigating the interaction between p-mode osc
illations and convection by analyzing realistic, three-dimensional simulati
ons of the near-surface layers of the solar convection zone. By choosing su
itable definitions for fluctuations and averages, we obtain a separation th
at retains exact equations. The equations for the horizontal averages conta
in one part that corresponds directly to the wave equations for a one-dimen
sional medium, plus additional terms that arise from the averaging and corr
espond to the turbulent pressure gradient in the momentum equation and the
divergence of the convective and kinetic energy fluxes in the internal ener
gy equation. These terms cannot be evaluated in closed form, but they may b
e measured in numerical simulations. The additional terms may cause the mod
e frequencies to shift, relative to what would be obtained if only the term
s corresponding to a one-dimensional medium were retained-most straightforw
ardly by changing the mean stratification and more subtly by changing the e
ffective compressibility of the medium. In the presence of time-dependent c
onvection, the additional terms also have a stochastic time dependence, whi
ch acts as a source of random excitation of the coherent modes. In the pres
ent paper, we derive an expression for the excitation power and test it by
applying it to a numerical experiment of sufficient duration for the excite
d modes to be spectrally resolved.