I don't really know if this is the right place to ask, but it's something I see often. So did it happen?
Chanting, yelling, and singing were all used. Singing could be accompanied by musicians playing the tune on instruments, and/or by rhythm instruments. Sometimes the instruments played without singing/chanting. Sometimes weapons were beaten on shields, serving a secondary function as musical instruments.
Some armies advanced in silence.
There were 4 important functions which could be served by war cries, chants, singing, and music:
Rhythm to control the pace of advance (etc.). A rhythmic chant or song or instruments such as drums controlling the pace of advance could help a formation keep order as they advanced into contact. Chant/song and music were, and still are, put to similar use in armies to help keep pace in marching. Similar rhythmic songs have been used as work songs in non-military contexts.
Command. This is related to the previous point. Chants and music can be used to relay commands as well as to pace ongoing activity. For example, a war cry can be used a signal to charge, and instruments such as drums and bugles were used to convey orders in a form that could be understood above the din of battle (used on the battlefield as recently as the Korean War (Chinese buglers)).
Bonding. Chanting or singing together can be a powerful bonding experience. This can help maintain unit cohesion.
Morale: boosting your own and intimidating your enemy. Being loud matters! If you're louder than the enemy, it makes it seem like you outnumber the enemy, and that's a good thing. Being loud can also signal to the enemy that you have great morale, and will fight enthusiastically.
These are often combined. For example, a loud war cry as a signal to charge can be good for both 2 and 4. Chanting/singing while advancing in formation can be good for 1, 3, and 4.
The last point, 4, suggests that if you are outnumbered, it might be best to be silent. If you're silent, you're not competing to be louder than a more numerous enemy. Roman and Byzantine armies would sometimes advance in silence (as described for Principate armies, and prescribed in Maurice's Strategikon). Silence wasn't a universal Roman habit - 4th century armies were noted as using the barritus, a war cry probably of Germanic origin.
Ancient Greek armies would advance to music, often singing a paean. Plutarch described the advance of the Spartans in Life of Lycurgus:
And when at last they were drawn up in battle array and the enemy was at hand, the king sacrificed the customary she-goat, commanded all the warriors to set garlands upon their heads, and ordered the pipers to pipe the strains of the hymn to Castor; then he himself led off in a marching paean, and it was a sight equally grand and terrifying when they marched in step with the rhythm of the flute, without any gap in their line of battle, and with no confusion in their souls, but calmly and cheerfully moving with the strains of their hymn into the deadly fight. Neither fear nor excessive fury is likely to possess men so disposed, but rather a firm purpose full of hope and courage, believing as they do that Heaven is their ally.
At least some Greek armies marched to contact singing a paean, and then just before, or when the armies clashed, uttered their war cry "Alala!". Pindar wrote
Harken! O Alala, daughter of Polemos! Prelude of spears! To whom soldiers are sacrificed for their city’s sake in the holy sacrifice of death.
where Alala was the divine personification of the war cry, an attendant of Ares (who used her name as his war cry "Alale alala").
While marching in formation to contact with the enemy is obsolete on the modern battlefield, modern soldiers still march to song and music off the battlefield, and war cries along the lines of "alala" were used in the 20th century, and are still used, like the Russian/Soviet "Urrah!", the US Marines' "Oorah", etc.
Singing and chanting didn't go away between ancient and modern times. One Imperial army supposedly broke in the face of a Hussite advance due to their war hymn Ktož jsú boží bojovníci - a recording can be heard at https://web.archive.org/web/20110718190933/http://vlastenci.cz/stah/zvuky/pisne/Ktoz_jsu_bozi_bojovnici.mp3 and an English translation of the overtly warlike lyrics is at https://en.wikipedia.org/wiki/Kto%C5%BE_js%C3%BA_bo%C5%BE%C3%AD_bojovn%C3%ADci
How realistic are the movie versions? It will depend on the movie. One where some effort was made for authenticity was Zulu (1964):
The shield beating, chants, and songs are based on authentic practice (but the final song acknowledging the bravery of the British is ahistorical (but authentic in style), and the singing of Men of Harlech is also unhistorical). Some discussion about the authenticity in https://www.reddit.com/r/AskHistorians/comments/19nu3t/how_accurate_or_inaccurate_was_the_movie_zulu/ especially the comment by u/khosikulu
For Greek song and war cries:
A reconstruction of a paean: https://www.youtube.com/watch?v=Tg3Oj3XYVis
"Alala" as interpreted for Xena: https://www.youtube.com/watch?v=nvCSTjqa_lg
One place where we still sometimes see organised hand-to-hand fighting is riots. Chants and war cries are sometimes used:
Shield beating and war cries: https://youtu.be/-6T_T-bRwDY?t=306
Pre-fighting chants, song, and percussion: https://www.youtube.com/watch?v=_KgX-hb1amo
Chants and war cries: https://www.youtube.com/watch?v=sSGF1m8Gx2E
We also see similar use of song, chant, and war cries in sports, by