  We describe a Bayesian framework for estimating the time-domain noise
covariance of CMB observations, typically parametrized in terms of a 1/f
frequency profile. This framework is based on the Gibbs sampling algorithm,
which allows for exact marginalization over nuisance parameters through
conditional probability distributions. In this paper we implement support for
gaps in the data streams and marginalization over fixed time-domain templates,
and also outline how to marginalize over confusion from CMB fluctuations, which
may be important for high signal-to-noise experiments. As a by-product of the
method, we obtain proper constrained realizations, which themselves can be
useful for map making. To validate the algorithm, we demonstrate that the
reconstructed noise parameters and corresponding uncertainties are unbiased
using simulated data. The CPU time required to process a single data stream of
100 000 samples with 1000 samples removed by gaps is 3 seconds if only the
maximum posterior parameters are required, and 21 seconds if one also want to
obtain the corresponding uncertainties by Gibbs sampling.
