I teach middle school, and class can get pretty noisy when they're doing pair- or group-work, and trying to get their attention again can be tricky. Something I found that works is just clapping. The students are talking amongst themselves (hopefully on task *cough*), and if after trying to get their attention again doesn't work, I'll say "clap once" *clap*, "clap three times" *clap clap clap*, and the students in the front will follow along, and after about three times everyone is doing it and paying attention to the teacher again.