How to measure noise, consonance, dissonance of a sound?
If there are spectral peaks and you want to calculate the dissonance of this sound, you can calculate the sensory dissonance. See the Essentia explanation and the references mentioned there.

If you rather want to measure how noisy a sound is, spectral flatness may be the audio feature of your choice. E.g. see this Wikipedia page.