There is a saying to the effect: As with the material, so with the spiritual; as below, so above.
The mitzvot are commandments, expressions of Divine will.
God wishes that certain actions should be performed in a certain way.
The Torah is only a framework, a means of conveying this instruction.
Whereas the mitzvah is qualified by the gratification, and even great happiness, of doing God’s will, and it does not matter whether it is a positive or a negative reaction, towards or away from the Divine harmony.
With a musical instrument (as with the mitzvah) one can produce delightful sounds or terrible dissonance.
And this is very much what a person does with his life; he can create happiness or its opposite, discontent.
For it is written that God is pleased when men do His will.
–Rabbi Adin Steinsaltz