Is there any way to get the duration of a sound component?

PsychoPy version 2020.1.3

I am playing wav files in sound components in a loop. I would like to store the duration of these components, because the “.stopped” column in the outpot log always writes “None”.

I tried the getDuration() command (e.g.: a_stim.getDuration()), but it gives a value which does not match the lenghth of the media (e.g.: it writes “0.8856009070294785” as the duration for multiple files, that definitely have different lenghts).

Is it possible, that the media doesn’t play fully or does getDuration function differently than I think? Is there a way to check if Psychopy ends the audio sooner than its lenghth?

Thank you for any help,

Does the sound end with the routine? If so then you could do thisExp.addData('MySoundStim.stopped', t) to achieve a similar effect to this? Another user recently had this problem so the bug fix is in progress