Perfect, it works very well. thank you very mush.
Unfortunately a third, possibly more difficult problem emerged. This is related to the first question I asked.
As you suggested, I created a routine that shows an image for a fixed period and loop around it to update the image for the required number of iterations. My screen has a refresh rate of 60 Hz, so I used a duration of 89 frame refresh for my images to be synchronised with the sound-stream. I created and played the sound in a code, exactly as you proposed.
Everything seems to work fine, but after the fifth or sixth image a delay in the image presentation starts to appear, and the image starts not to be synchronised to the sound anymore.
I thought the problem could depend on the refresh rate of my monitor, so I changed it and I used a different one, with a refresh rate of 85 Hz. I changed the duration from 89 to 126 frame refreshes, but still, after a few well synchronised images, they start not to be synchronised to the sound anymore.
As the time I specified is fixed, do you think the problem could reside in processing the loop itself? Could the loop reiterations cause this progressively accumulated delay? Ultimately, is it possible to perfectly synchronise images to a 4 minutes-long single soundstream, without accumulating delay?