def _split_audio_by_duration(self, audio_abs_path,
                                 results_abs_path, duration_seconds):
        """
        Calculates the length of each segment and passes it to
        self._audio_segment_extractor

        Parameters
        ----------
        audio_abs_path : str
        results_abs_path : str
            A place for adding digits needs to be added prior the the format
            decleration i.e. name%03.wav. Here, we've added `*` at staging
            step, which we'll replace.
        duration_seconds : int
        """
        total_seconds = self._get_audio_duration_seconds(audio_abs_path)
        current_segment = 0
        while current_segment <= total_seconds // duration_seconds + 1:
            if current_segment + duration_seconds > total_seconds:
                ending_second = total_seconds
            else:
                ending_second = current_segment + duration_seconds
            self._audio_segment_extractor(
                audio_abs_path,
                results_abs_path.replace("*", "{:03d}".format(
                    current_segment)),
                starting_second=current_segment, duration=(ending_second -
                                                           current_segment))
            current_segment += 1
def _split_audio_by_duration ( self , audio_abs_path , results_abs_path , duration_seconds ) : total_seconds = self . _get_audio_duration_seconds ( audio_abs_path ) current_segment = 0 while current_segment <= total_seconds // duration_seconds + 1 : if current_segment + duration_seconds > total_seconds : ending_second = total_seconds else : ending_second = current_segment + duration_seconds self . _audio_segment_extractor ( audio_abs_path , results_abs_path . replace ( "*" , "{:03d}" . format ( current_segment ) ) , starting_second = current_segment , duration = ( ending_second - current_segment ) ) current_segment += 1
Calculates the length of each segment and passes it to
        self._audio_segment_extractor

        Parameters
        ----------
        audio_abs_path : str
        results_abs_path : str
            A place for adding digits needs to be added prior the the format
            decleration i.e. name%03.wav. Here, we've added `*` at staging
            step, which we'll replace.
        duration_seconds : int