Skip to content

Conversation

@nguyenlamvu123
Copy link

No description provided.

@yqzhishen
Copy link
Member

If len(sil_tags) == 1, the audio should be sliced. In which case do you think the slicer does not work properly?

@nguyenlamvu123
Copy link
Author

nguyenlamvu123 commented Jun 10, 2024

audio-slicer/slicer2.py:

        if silence_start is not None and total_frames - silence_start >= self.min_interval:
            silence_end = min(total_frames, silence_start + self.max_sil_kept)
            pos = rms_list[silence_start: silence_end + 1].argmin() + silence_start
            sil_tags.append((pos, total_frames + 1))
        # Apply and return slices.
        if len(sil_tags) == 0:
            return [waveform]
        else:  -------------------------------> if len(sil_tags) == 1, it will run into this
            chunks = []
            if sil_tags[0][0] > 0:
                chunks.append(self._apply_slice(waveform, 0, sil_tags[0][0]))  -------------------------------> sil_tags[0][0] < 0 and chunks is still an empty list
            for i in range(len(sil_tags) - 1):  -------------------------------> if len(sil_tags) == 1, it will be `for i in range(0):` and chunks is still an empty list
                chunks.append(self._apply_slice(waveform, sil_tags[i][1], sil_tags[i + 1][0]))
            if sil_tags[-1][1] < total_frames:
                chunks.append(self._apply_slice(waveform, sil_tags[-1][1], total_frames))  -------------------------------> if sil_tags[-1][1] >= total_frames, chunks is still an empty list
            return chunks

it is a strange story, with the same input and with if len(sil_tags) == 0:, it well runs in local (with pycharm) but is bad in remote server; well runs in remote server with if len(sil_tags) <= 1:
so I can`t take a screenshoot of debug of pycharm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants