implementing dissonance calculation