  The dynamics of coalescing compact binaries can be affected by the
environment in which the systems evolve, leaving detectable signatures into the
emitted gravitational signal. In this paper we investigate the ability of
gravitational-wave detectors to constrain the nature of the environment in
which compact binaries merge. We parametrize a variety of environmental effects
by modifying the phase of the gravitational signal emitted by black hole and
neutron star binaries. We infer the bounds on such effects by current and
future generation of interferometers, studying their dependence on the binary's
parameters. We show that the strong dephasing induced by accretion and
dynamical friction can constraint the density of the surrounding medium to
orders of magnitude below that of accretion disks. Planned detectors, such as
LISA or DECIGO, will be able to probe densities typical of those of dark
matter.
