void createNewSnd(STRING* sndStr, int maxNmbr) {
STRING* tempStr = str_create("");
int randNum = integer(random(maxNmbr)+1);
str_cpy(tempStr, sndStr);
str_cat(tempStr, "_");
str_cat(tempStr, str_for_int(NULL, randNum));
str_cat(tempStr, ".wav");
SOUND* tempSnd = snd_create(tempStr);
// play the sound
var sndHandle = snd_play(tempSnd, 100, 0);
// wait until finished
while (snd_playing(sndHandle)) { wait(1); }
// remove the sound
ptr_remove(sndHandle);
}