If you get the node red addon installed then import flow below and it may help you get started with this. Although I have never used a shell command before so I can’t test if this will work. This example also uses the Rate Limit in the Delay node (suggested by one of the other replies) so you will need to adjust it’s reset time according to how long the gate causes the debounce when opening and closing.
If you have a sensor to check if the state of the gate is open or closed then the input boolean method may work better.
[{"id":"2845537e.235364","type":"api-call-service","z":"ff9644ac.164fe","name":"","server":"57ce5691.fd6e48","version":1,"debugenabled":false,"service_domain":"shell_command","service":"door_open_audio","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":490,"y":740,"wires":[["9d8f336c.b881c8"]]},{"id":"4d6422ec.5a3314","type":"inject","z":"ff9644ac.164fe","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":740,"wires":[["2845537e.235364"]]},{"id":"216254b1.08dd04","type":"delay","z":"ff9644ac.164fe","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":440,"y":500,"wires":[["391f9023.a143c8"]]},{"id":"e18b7f16.692818","type":"inject","z":"ff9644ac.164fe","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":500,"wires":[["216254b1.08dd04"]]},{"id":"9d8f336c.b881c8","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Example: Audio SHELL Command","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":740,"wires":[]},{"id":"391f9023.a143c8","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Example Rate Limit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":500,"wires":[]},{"id":"5c4ac151.7fc8","type":"comment","z":"ff9644ac.164fe","name":"Example: Service Node - Play Door Open Sound","info":"","x":360,"y":700,"wires":[]},{"id":"3c915be3.67303c","type":"comment","z":"ff9644ac.164fe","name":"Example: Delay -Node - Limit to 1 msg per 10 seconds - Change this value","info":"","x":440,"y":460,"wires":[]},{"id":"d0a6f578.68079","type":"server-state-changed","z":"ff9644ac.164fe","name":"Laser Sensor State","server":"57ce5691.fd6e48","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.laser_sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":270,"y":620,"wires":[["2b1197e1.bca93"],["a44ef82e.c6a678"]]},{"id":"2b1197e1.bca93","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Example Laser Trigger ON","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":600,"wires":[]},{"id":"a44ef82e.c6a678","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Example Laser Trigger OFF","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":640,"wires":[]},{"id":"ab7bcd9c.a57858","type":"comment","z":"ff9644ac.164fe","name":"Example: Event State Listening to If Sensor is on or off","info":"","x":380,"y":580,"wires":[]},{"id":"41505b53.1638fc","type":"server-state-changed","z":"ff9644ac.164fe","name":"Laser Sensor State","server":"57ce5691.fd6e48","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.laser_sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":270,"y":880,"wires":[["5e277d7.90ee704","3651edf2.a6a4ca"],[]]},{"id":"5e277d7.90ee704","type":"delay","z":"ff9644ac.164fe","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":500,"y":880,"wires":[["4b885084.4905a8","8aaec727.f5894"]]},{"id":"4b885084.4905a8","type":"api-call-service","z":"ff9644ac.164fe","name":"","server":"57ce5691.fd6e48","version":1,"debugenabled":false,"service_domain":"shell_command","service":"door_open_audio","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":810,"y":880,"wires":[["63b52fec.5a8258"]]},{"id":"3651edf2.a6a4ca","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Laser Trigger ON","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":960,"wires":[]},{"id":"8aaec727.f5894","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Rate Limit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":940,"wires":[]},{"id":"63b52fec.5a8258","type":"debug","z":"ff9644ac.164fe","name":"DEBUG: Audio SHELL Command","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1120,"y":880,"wires":[]},{"id":"c6530ea2.b5e4f","type":"comment","z":"ff9644ac.164fe","name":"Put it All together","info":"--If Laser Sensor State is on (i.e triggered)\n--Then only allow 1st message and drop subsequent messages for the first 10 seconds\n--Play Sound","x":260,"y":840,"wires":[]},{"id":"57ce5691.fd6e48","type":"server","name":"Home Assistant","addon":true}]