def add_sound(self, sound_file, time=None, gain=None, **kwargs): """ This method adds an audio segment from a sound file. Parameters ---------- sound_file (str) The path to the sound file. time (Union[float, int]) The timestamp at which the audio should be added. gain The gain of the given audio segment. **kwargs This method uses add_audio_segment, so any keyword arguments used there can be referenced here. """ file_path = get_full_sound_file_path(sound_file) new_segment = AudioSegment.from_file(file_path) if gain: new_segment = new_segment.apply_gain(gain) self.add_audio_segment(new_segment, time, **kwargs)
def add_sound(self, sound_file: str, time: float | None = None, gain: float | None = None, gain_to_background: float | None = None) -> None: file_path = get_full_sound_file_path(sound_file) new_segment = AudioSegment.from_file(file_path) if gain: new_segment = new_segment.apply_gain(gain) self.add_audio_segment(new_segment, time, gain_to_background)
def add_sound(self, sound_file, time=None, gain=None, **kwargs): file_path = get_full_sound_file_path(sound_file) new_segment = AudioSegment.from_file(file_path) if gain: new_segment = new_segment.apply_gain(gain) self.add_audio_segment(new_segment, time, **kwargs)