Singing Of Divine Judgment
כתבו לכם את השירה כו' ענין שירה זו הגם כי יש בה עונשין
"Write for yourselves this song" (Devarim 31:19) — the matter of this song, even though it contains punishments within it,
The Torah calls the parsha a "song," even though it includes warnings of punishment.
אך כמ"ש חסד ומשפט אשירה כמ"ש במדרשים בה' אהלל דבר באלקים אהלל בין במדת פורעניות כי כל המשפטים לבנ"י הם לטובה
is nonetheless as it is written, "Of kindness and justice I will sing" (Tehillim 101:1), and as the Midrashim explain on the verse "In Hashem I will praise the word, in Elokim I will praise the word" (Tehillim 56:11) — that one praises even amid the attribute of retribution, for all the judgments visited upon Bnei Yisrael are for their good.
Yet it can still be a song, because we sing of justice no less than of kindness — every judgment Hashem brings upon Bnei Yisrael is ultimately for their benefit.
ולכן בר"ה שהוא המשפט כ' יום תרועה יהי' לכם
Therefore, regarding Rosh Hashanah, which is the day of judgment, it is written, "It shall be a day of teruah for you" (Bamidbar 29:1).
Because of this, the day of judgment itself, Rosh Hashanah, is described with the word teruah.
תרועה היא רצון כמ"ש תרועת מלך בו
Teruah signifies favor and good will, as it is written, "and the teruah of the King is among them" (Bamidbar 23:21).
Teruah is not only a cry but an expression of favor and closeness to Hashem, as in the verse describing the King's teruah dwelling among Bnei Yisrael.
ולכן כ' לכם לכם היא לרצון ולא לאחרים לרצון
And therefore it is written "for you" — "for you" it is a matter of favor, but it is not a matter of favor for others.
The Torah stresses "for you" — this favor within the judgment belongs to Bnei Yisrael, and is not shared by other nations.
ובמד' מי גוי גדול א"ל אלהים קרובים אליו אין אומה כזו שיודעין אופי' של אלקים שבטוחין שיזכו בדינם ע"ש
And in the Midrash on "For what great nation is there that has Elokim near to it" (Devarim 4:7): there is no nation like this one, who know the character of Elokim, for they are confident that they will emerge meritorious in their judgment — see there.
The Midrash teaches that Bnei Yisrael are unique in knowing Hashem's ways so well that they remain confident of being vindicated in His judgment.
כי אלקים הוא מדת הדין אעע"כ לבנ"י קרובים אליו:
For Elokim denotes the attribute of strict justice, yet even so, to Bnei Yisrael He is near.
Although the Name Elokim expresses strict justice, that very justice draws Bnei Yisrael close to Hashem rather than distancing them.
Summary: The Sfas Emes asks how the parsha can be called a "song" when it is filled with warnings of punishment, and answers that we sing of Hashem's justice just as we sing of His kindness, for every judgment brought upon Bnei Yisrael is for their good. This is why Rosh Hashanah, the day of judgment, is called "a day of teruah," since teruah expresses favor and the closeness of the King who dwells among His people. The Torah emphasizes "for you," because this favor hidden within the judgment belongs uniquely to Bnei Yisrael and not to other nations. As the Midrash teaches, Bnei Yisrael alone know Hashem's ways and remain confident of emerging meritorious in their din. Thus even the Name Elokim, the attribute of strict justice, serves to draw Bnei Yisrael near to Hashem.