Thank you for your suggestions.
I have removed the trace statements for code clarity but they were there. The code was executing fine and only once.
The sound loop was just for testing purposes and I forgot to change it back. It doesn't affect the problem however.
The problem is still unresolved.