Weird Problem with Sound Delay (PlayDelayed)

Hi

This snippet is part of an app that use sound files to read out integers followed by units. The spoken integers are wav files, loaded as clips into an array. The spoken “unit” is a wav file, stored in straightforward AudioClip type. They both have separate AudioSources so I have (or should have) full control over any delays.

            audioSourceValue.clip = numberWord[index];
            audioSourceValue.Play();
            audioSourceUnits.clip = units;
            audioSourceUnits.PlayDelayed(0.5f);

The way it works is the first clip plays, (for example with the word “seven”, then waits half a second, then the second clip plays (for example “meters”). It works fine, except when the index of the array is on zero. Then the delay doesn’t work at all and both clips are superimposed.

I can’t see the logic behind this mysterious problems, and so cannot prevent it. Does anyone know why it might be doing this?

[edit] I replaced PlayDelayed() with Play() to see what would happen, and the units clip played first, followed by numberWord[0].

            audioSourceValue.clip = numberWord[index];
            audioSourceValue.Play();
            audioSourceUnits.clip = units;
            audioSourceUnits.Play();
            // audioSourceUnits.PlayDelayed(0.5f);

It only does this when the array index as on 0. Set it to 1, it works. Set it back to 0, the problem returns. I have checked the sound file can can’t see anything strange there. Baffling!!

Isolate whether it is the clip that is dragged into slot zero, or something else about slot zero.

Also, what happens if you put this code in a coroutine and just stick a manual half second delay between normal calls to play.

Also, are there any unexpected blank spaces at the start of any of your audio files? You can kinda tell by looking at their waves in the preview window of the inspector.

And are you sure that these two audio sources really are pointed to two DIFFERENT audio sources? It can be tricky if they’re both on the same GameObject…