hbo's Rome did it right. they show it one time and it's in response to arrow fire.
otherwise they have legates organizing spear lines and using whistles to time and position them. it was actually quite well done.