Thanks a lot for your help and your precise answer !
I finally find a way to get length of an external file. The trick is to download a very small part of the file, calculating the length of that, then extrapolate to the entire file. Here someone write a function to do that : https://www.getid3.org/phpBB3/viewtopic.php?f=7&t=1208
To use this function in wordress I just had to change require_once('getid3/getid3.php')
by
require_once( ABSPATH . 'wp-includes/ID3/getid3.php' )
to include the getID3 library.
But sure, this function is really slow, so I run it only one time when I save or update the post
add_action( 'save_post', 'save_sound_length' );