METHUEN, Mass. — With a rapid-response team and regular lockdown drills, the school district here, like many across the country, has long been steeling itself for the nightmare scenario of a school shooting.

But over the past two years, a new high-tech approach has been tested at one of the schools here — officials will not say which one — to see whether it is possible to react more effectively.

Engineers from a company called Shooter Detection Systems have installed infrared sensors and microphones that can pick up the sound of gunfire and immediately notify school and law enforcement officials where and when it has occurred. It was installed free of charge, and school officials were hoping they could find the money to put the system, which costs between $20,000 and $100,000, into more schools.

It does not stop the first shot, but company officials say the system can shorten an attack by taking the human element out of alerting the authorities.