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

Add error handling to log_mel_spectrogram function #2161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MadhumithaKolkar
Copy link

This pull request adds error handling to the log_mel_spectrogram function in order to improve robustness and provide clearer feedback to users when input audio is shorter than the expected length.

Previously, the function would proceed with processing the audio even if it was shorter than the expected length, potentially leading to unexpected behavior or errors downstream. With this enhancement, the function now raises a ValueError if the input audio is shorter than the expected length, ensuring that users are informed of the issue and preventing further processing with insufficient data.

Changes:

  • Added error handling to check if the input audio is shorter than the expected length (N_SAMPLES) before proceeding with processing.
  • Raised a ValueError if the input audio is shorter than the expected length, providing clearer feedback to users.
    Testing:

Tested the modified log_mel_spectrogram function with various input audio files, including files shorter than the expected length, to ensure that the error handling works as intended and that the function raises a ValueError in such cases.
Verified that the function behaves as expected and produces correct outputs for audio files of sufficient length.

This enhancement improves the reliability and usability of the log_mel_spectrogram function, making it more robust in handling different input scenarios :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant