As the title says, did armies have songs they sang or played while marching to war, or possibly training or anything? If so, what would they have been used for?
This is a very broad question, if you are basically asking whether throughout all of history of warfare armies have ever sung songs, then the answer is quite obviously a yes. I can provide with you an example from medieval Bohemia. The Hussites have sung hymns and chants before battle, "Ktož jsú boží bojovníci" ("You who are warriors of god") being the best known example, and this singing is said to have terrified their crusader enemies.
We actually have a valuable source for many of these religious songs, the Jistebnice hymnbook, however, we rather understandably lack any reliable evidence for the supposedly demoralizing effect on the opposition. Contemporary chronicles do mention that during the fourth Crusade against the Hussites, just before the battle of Domažlice, the German armies "have heard the Czechs march, and in great fear fled before even seeing them". In popular history, this is often portrayed as the crusaders retreating as soon as they heard the Hussites sing their hymns.
But quite obviously it is more probable that the speed of the attack coupled with the lack of organization and miscommunication in the crusaders' camp were to blame for the quick Hussite victory rather than singing alone. Apparently as some of their forces were pulled back to consolidate their lines, other units mistakenly interpreted this as a retreat and fled.
Regardless of whether their voices were a terrifying weapon or not, many of the Hussite songs remain a part of religious tradition to this day, and "Ktož jsú boží bojovníci" has taken on strong nationalistic connotations – much like the Hussite movement itself – over the centuries to this day.