You can remove that if statement, since it's impossible for you to initiate your own on text events.

Have you checked to see if maybe the playing of query.wav is overlapping with another command to play the same wave file? How much time does it take for the wave file to play once?