Clean up audio generation code, organise helpers in utilities.m