13 But the patience of good men with preparation of heart accepts the will of God: and glories in tribulations, saying that which follows: “Prepared is my heart, O God, I will sing and play”. What has he done to me? He has prepared a pit, my heart is prepared. He has prepared pit to deceive, shall I not prepare heart to suffer? He has prepared pit to oppress, shall I not prepare heart to endure? Therefore he shall fall into it, but I will sing and play. Hear the heart prepared in an Apostle, because he has imitated his Lord: “We glory,” he says, “in tribulations: because tribulation works patience: patience probation, probation hope, but hope makes not ashamed: because the love of God is shed abroad in our hearts through the Holy Spirit, which has been given to us.” He was in oppressions, in chains, in prisons, in stripes, in hunger and thirst, in cold and nakedness, in every wasting of toils and pains, and he was saying, “We glory in tribulations.” Whence, but that prepared was his heart? Therefore he was singing and playing.
Source: The Enarrations, or Expositions, on the Psalms (New Advent)