Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio: Fix taking a suffix of negative length from a collection #278

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

mattisssa
Copy link
Contributor

Overview

This pull request introduces critical bug fix to AudioProcessor, focusing on improving robustness and error handling in voice detection mechanisms

Problem

In the original code, when calculating the number of energy values to consider for voice detection, there was a risk of creating a negative array index.

This could happen if:
• The nextBufferInSeconds was very small
• The calculation resulted in a negative number

This would cause a runtime crash with the error:
Fatal error: Can't take a suffix of negative length from a collection

CleanShot 2024-12-16 at 20 07 46@2x

Solution

Prevent negative array indices

Copy link
Contributor

@ZachNagengast ZachNagengast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@ZachNagengast ZachNagengast merged commit 3bc936a into argmaxinc:main Dec 16, 2024
15 checks passed
Copy link

@bimehasia25815 bimehasia25815 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A

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.

3 participants