The order and selection of notes works along side the key of the piece of music to create a sense of tension which can then be resolved. The listener will feel a sense of resolution when the melody returns to the tonic, melodically and harmonically. Moving away from the scale will increase the sense of tension.