#trigger {$sphook &{action}:&{soundpath}:&{volume}:&{pitch}:&{pan}:&{id}} {
#if {@action = "loop"} {#playloop {@sppath/@soundpath.wav} @volume; #var @id %playhandle};
#if {@action = "playrec"} {#play {@sppath/@soundpath.wav} @volume; #var @id %playhandle};  
#if {@action = "play"} {#play {@sppath/@soundpath.wav} @volume};
#if {@pan <> "na"} {#math pan {@pan * 50}; #pc %playhandle pan @pan}; 
#if {@pitch <> "na"} {#pc %playhandle frequency @pitch} {#pc %playhandle frequency 44100};
#if {@action = "stop"} {#if {%defined(@id) = 1} {#pc %var(@id) stop}}; 
#if {@action = "adjustsound"} {#if {%defined(@id) = 1} {
  #if {@volume <> "na"} {#pc %var(@id) volume @volume}; 
  #if {@pan <> "na"} {#pc %var(@id) pan @pan}; 
  #if {@pitch <> "na"} {#pc %var(@id) frequency @pitch}
}};
#gagline all;
#if {%playhandle=0} {#SetSpeech system stop;#say {Failed to play @soundpath.};
#var faildsound {$sphook @action:@soundpath:@volume:@pitch:@pan:@id};
#if {@AutomaticUpdate="enabled"} {FetchSound @soundpath}}}
#trig {$buffer *} {#gagline all; #say %1 voiceonly}