def calculate_duration(num_samples, sample_rate):
 return Gst.util_uint64_scale(num_samples, Gst.SECOND, sample_rate)

def calculate_duration ( num_samples , sample_rate ) : return Gst . util_uint64_scale ( num_samples , Gst . SECOND , sample_rate )
determine duration of samples using gstreamer helper for precise math .