Police in some U.S. cities will have a high-tech advantage this July 4 in their battle to deter and detect those who celebrate the country's birthday by firing bullets into the air.

"Celebratory gunfire" is a problem all year round in the U.S., but it peaks around the Independence Day holiday. It typically doesn't have any criminal intent, but shooting guns in such a manner in cities is illegal and the results can be deadly.

"Unfortunately, it's a very dangerous behavior," said Commander Mikail Ali of the San Francisco Police Department. "We've had numerous incidents across the country where individuals have been struck by errant gunfire, fatally wounded in many instances."

To help deter this gunfire, several police departments across the U.S. will be using a high-tech gunshot detection system to pinpoint the location and moment a firearm is discharged.

The system, called ShotSpotter, is already in use in 75 American towns, continuously listening for gunshots through a network of acoustic sensors.

In day-to-day use, it alerts police to gunshots with far more accuracy and speed than a 9-1-1 call from a member of the public can provide.

Often within seconds of a gun being fired, an alert flashes on the screens of ShotSpotter's monitoring center in Newark, California. There, a human operator listens to the sound to determine if it was indeed gunfire and looks at other data supplied. Seconds later, the operator alerts the subscribing police department with details including the location and, if the shot was fired from a moving vehicle, the speed and direction in which the vehicle was traveling.

The sensors are designed to hear only the sound of weapons being fired, but they can get fooled by a few other sounds including fireworks. That makes the Fourth of July a particularly busy weekend for ShotSpotter, but a combination of digital filters and the human operators help sort the gunshots from other noise.

"We're going out, putting teams together and using ShotSpotter to direct us in the right location and trying to arrest these people who are putting people's lives in danger," said Captain ErsieA Joyner of the Oakland Police Department. "These projectiles are very dangerous going up as well as going down."

"Individuals who have no intention to be involved in criminal activity have put themselves in a position to be arrested, be charged with felony charges and to destroy the rest of their lives as well as the lives of their family members," he said.

Martyn Williams covers mobile telecoms, Silicon Valley and general technology breaking news for The IDG News Service. Follow Martyn on Twitter at @martyn_williams. Martyn's e-mail address is martyn_williams@idg.com