For the purpose of the project, my script is currently setup to loop through a directory of wav files, then imports them one at a time (necessary for this project) to an avatar's viseme audio layer, then sets start_time to 0 and end_time to the duration of the current wav file (RLPy.RGlobal.Play(start_time, end_time)), then plays through the wav file from start_time to end_time. After the individual audio file is played, the script moves onto the next audio file in the wav file directory, imports it to the avatar's viseme layer, and plays from start_time to end_time. This process repeats until every audio file has been imported at 0 on the timeline and played through.
The issue is that when loading the Python script into iClone, rather than waiting for the playhead to play through until end_time, only a moment after importing and playing the current wav file in the loop, iClone immediately moves onto importing the next wav file, plays it for a moment, then imports the next wav file, repeat. I've tried using a conditional to check that RLPy.RGlobal.IsPlaying() == False before playing each wav file, but it gets ignored and iClone continues to import the wav files that follow in the loop sequence. I even tried using time.sleep(wav_file_duration*1000) in an attempt to delay the loop moving onto the next index in order for the current wav file to play all the way through, but this only freezes/crashes iClone. In another desparate attempt to troubleshoot this issue, I set up another condition that would attempt to stall the script with a while loop that checked if the playhead was at a time on the timeline greater than the duration of the wav file. Once again, I was met with iClone freezing/crashing.
Is there any way to get iClone to play a wav file and wait until the playhead hits end_time before moving onto the next steps in a Python script?
If anyone has any help, experience/knowledge of this, suggestions, etc to share, I would greatly appreciate it. This has me pulling my hair out, especially considering that this is the only software that offers the exact capabilities needed to accomplish this project, and this is the third major issue I've encountered with this software within the last two weeks. This is beyond infuriating and discouraging. In any case, thank you in advance whoever can help. You're a saint.