Skip to content

Commit

Permalink
add check for sr other than 8k or 16k
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayan Shaw committed Feb 27, 2025
1 parent f63857d commit b40188f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion shared/api/speech_features.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,13 @@ class Phi4AudioEmbed {

SpeechLibLogMel logmel;
// already checked in Init
logmel.Init(sr_val == 8000? logmel_8k_attrs_: logmel_attrs_);

// 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", ORT_RUNTIME_EXCEPTION);
}

logmel.Init(sr_val == 8000 ? logmel_8k_attrs_: logmel_attrs_);
status = logmel.Compute(stft_norm, ts_logmel);
if (!status.IsOk()) {
return status;
Expand Down

0 comments on commit b40188f

Please sign in to comment.