  Spectral analysis is a powerful tool to investigate stellar properties and it
has been widely used for decades now. However, the methods considered to
perform this kind of analysis are mostly based on iteration among a few
diagnostic lines to determine the stellar parameters. While these methods are
often simple and fast, they can lead to errors and large uncertainties due to
the required assumptions.
  Here we present a method based on Bayesian statistics to find simultaneously
the best combination of effective temperature, surface gravity, projected
rotational velocity, and microturbulence velocity, using all the available
spectral lines. Different tests are discussed to demonstrate the strength of
our method, which we apply to 54 mid-resolution spectra of field and cluster B
stars obtained at the Observatoire du Mont-M\'egantic. We compare our results
with those found in the literature. Differences are seen which are well
explained by the different methods used. We conclude that the B-star
microturbulence velocities are often underestimated. We also confirm the trend
that B stars in clusters are on average faster rotators than field B stars.
