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!!