The Torah describes how the splitting of the sea brought the Jewish people to “fear Hashem and believe in Hashem”. This is like the purpose of the Mitzvah of Hakhel “that they will fear Hashem their G-d”.
Like the Hakhel gathering, Shiras Hayam involved all of the Jewish people; men, women and children.
Moshe led the men in song and Miriam led the women in song. The Midrash teaches that the children also sang the Shirah and that they were the first to recognise Hashem at the sea, singing “this is my G-d and I will beautify Him.”
Even the babies in their mothers’ wombs sang Shirah, similar to Hakhel where newborn babies too had to be present.
Shiras Hayam also describes how the Jewish people will brought to “the Mountain of Your heritage, the foundation for Your dwelling place… the Mikdash”.
The Hakhel gathering took place in the Beis Hamikdash, the place where Hashem’s presence was manifest in this world, in order to heighten the inspiration and the fear of Hashem that they experienced.