def extract_specific_interval(self, interval_start, interval_end):
interval_start = int(interval_start)<EOL>interval_end = int(interval_end)<EOL>if interval_start >= interval_end:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>elif interval_start > self.time_series.size:<EOL><INDENT>if self.repeat:<EOL><INDENT>interval_end = interval_end - interval_start<EOL>interval_start = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if interval_end < self.time_series.size:<EOL><INDENT>interval = self.time_series[interval_start:interval_end]<EOL><DEDENT>else:<EOL><INDENT>requested_interval_size = interval_end - interval_start<EOL>remaining_signal = self.time_series[interval_start:self.time_series.size]<EOL>if self.next_file == len(self.sound_files) and self.repeat:<EOL><INDENT>self.next_file = <NUM_LIT:0><EOL><DEDENT>if self.next_file < len(self.sound_files):<EOL><INDENT>next_source = audiolab.Sndfile(self.sound_files[self.next_file], '<STR_LIT:r>')<EOL>self.next_file += <NUM_LIT:1><EOL>if next_source.samplerate != self.sample_rate:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if self.gap_between_sounds > <NUM_LIT:0>:<EOL><INDENT>remaining_signal = hstack((remaining_signal, zeros(int(self.gap_between_sounds*self.sample_rate), dtype=self.precision)))<EOL><DEDENT>self.time_series = hstack((remaining_signal, next_source.read_frames(next_source.nframes, dtype=self.precision)))<EOL>interval = self.time_series[<NUM_LIT:0>:requested_interval_size]<EOL>self._next_interval_start = requested_interval_size<EOL><DEDENT>else:<EOL><INDENT>self.warning("<STR_LIT>")<EOL>self._next_interval_start = self.time_series.size + <NUM_LIT:1><EOL>samples_per_interval = self.interval_length*self.sample_rate<EOL>interval = hstack((remaining_signal, zeros(samples_per_interval-remaining_signal.size)))<EOL><DEDENT><DEDENT>return interval<EOL>
Overload if special behaviour is required when a series ends.