All suffering comes from a [false] perception of being out of tune with the universe.
So when troubled, all you need to do is tune back in. If you were an out-of-tune string on a well-tuned guitar, here is how you would tune yourself back in:
First, you would stop listening to yourself and start listening very carefully to what the rest of the guitar is doing. The trick here is to listen not just to some strings around you, but also to the sound the guitar is making as a whole.
Second, you would come back to yourself and try to find in all the different sounds, that you are currently making, one that resonates the most with the rest of the guitar.
Third you would adjust your own vibrations in a way that would produce best possible harmony. The closer you are to being in tune, the less you can hear yourself as a distinct vibration. In other words, if you can hear yourself distinctly, there is still some tuning to be done.
A perfectly tuned string can't be heard at all [on its own]. It only contributes to the overall volume and richness of the music that is being played.
So when you feel bad, here is a simple recipe:
Shut up, Calm down, Tune in!