Ultrasonic attenuation and magnetic properties of superconducting niobium in the mixed state