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 check for audio sampling rate other than 8k or 16k Hz #898

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

sayanshaw24
Copy link
Contributor

Fixes issue where user was getting vague error when using audio file with 48k Hz sampling rate:

ORTX_CXX_API_THROW("ort-extensions internal error: ORT-APIs used before RegisterCustomOps", ORT_RUNTIME_EXCEPTION);

@sayanshaw24 sayanshaw24 requested a review from a team as a code owner February 27, 2025 23:33
@sayanshaw24 sayanshaw24 changed the title Throw error for Audio Sampling Rate other than 8k or 16k Hz Add check for audio sampling rate other than 8k or 16k Hz Feb 27, 2025

// Currently we only support 8k and 16k Hz sampling rate.
if (sr_val != 8000 && sr_val != 16000){
ORTX_CXX_API_THROW("ort-extensions internal error: currently only 8k and 16k Hz sampling rate is supported. Please resample your audio file to either 8k or 16k.", ORT_RUNTIME_EXCEPTION);
Copy link
Member

@wenbingl wenbingl Feb 27, 2025

Choose a reason for hiding this comment

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

to be more Ort-Mobile friendly and be consistent, please try to return the error status, instead of throwing an exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, could we avoid adding library's name in the error message reported? To the end user, it may be confusing to see ort-extensions error if there are multiple libraries involved: win-ai-gallery -> aitk -> ort-genai -> ort-extensions ...

Copy link
Member

@wenbingl wenbingl Feb 28, 2025

Choose a reason for hiding this comment

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

Also, could we avoid adding library's name in the error message reported? To the end user, it may be confusing to see ort-extensions error if there are multiple libraries involved: win-ai-gallery -> aitk -> ort-genai -> ort-extensions ...

on calling ort-extensions from ort-genai, only error code and error message are expected. so, ort-genai can add whatever prefix for the error message from ort-extensions or filtering error message, but it will be lack of information if we got some error report from the user

@wenbingl
Copy link
Member

Fixes issue where user was getting vague error when using audio file with 48k Hz sampling rate:

ORTX_CXX_API_THROW("ort-extensions internal error: ORT-APIs used before RegisterCustomOps", ORT_RUNTIME_EXCEPTION);

it would be nice if there is an error report which can be posted into ort-extensions issue to fully understanding the issue. Typically, the audio format should be handled audio-decoder.

Copy link
Member

@wenbingl wenbingl left a comment

Choose a reason for hiding this comment

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

Not sure if this change is related to the issue mentioned in the description, but the checker is good.

@sayanshaw24 sayanshaw24 merged commit 5541566 into main Feb 28, 2025
46 checks passed
@sayanshaw24 sayanshaw24 deleted the sayanshaw/audio-sr-error branch February 28, 2025 08:29
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.

4 participants