Cut sound when music is too loud

Is it possible (Or does anyone know of a script that already does this) to write a script where the sound can be cut completely when music is played too loud. I want it to work regardless of the app that’s playing the music, in other words I want the computer volume to be turned off so the user has to manually turn it back to an acceptable level where the sound isn’t getting turned off. The music is played through an external amp.
OS X 10.9.3
MacBook Pro
Applescript Version 2.6.1 (152.1)

Model: Mini mac
AppleScript: 2.6.1 (152.1)
Browser: Safari 537.36
Operating System: Other

Hi lenskaraoke,

There is the StandardAdditions osax that allows you to get and set the sound volume. Here’s the dictionary part:

It’s pretty straight forward. First get the sound volume. Then, if it is too loud then set it to zero. It can get more complicated.