The episode is "Cause and Effect" (Season 5 episode 18). The episode was directed by Jonathan Frakes (AKA Cmdr Riker) and guest-starred Kelsey Grammer as Captain Morgan Bateson
"The destruction of the Enterprise near a distortion in the space-time continuum causes a temporal causality loop to form, trapping the ship and crew in time and forcing them to relive the events that led to their deaths"
The voices themselves are describes as "echoes" from previous time loops.
CRUSHER: Can we isolate the voices? Find out what they're saying?
DATA: Computer, continuous playback please [he pauses] There are approximately one thousand voices overlapping. The voices are those of
the Enterprise crew. Our voices.