Skip to content

Commit

Permalink
change documentation of --dither option
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelVesely84 committed Mar 14, 2024
1 parent 3b28f3a commit 234f923
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmake/kaldi-native-fbank.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function(download_kaldi_native_fbank)
include(FetchContent)

# TODO: update is required, so that dithering works... (it was missing)
set(kaldi_native_fbank_URL "https://github.com/csukuangfj/kaldi-native-fbank/archive/refs/tags/v1.18.7.tar.gz")
set(kaldi_native_fbank_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/kaldi-native-fbank-1.18.7.tar.gz")
set(kaldi_native_fbank_HASH "SHA256=e78fd9d481d83d7d6d1be0012752e6531cb614e030558a3491e3c033cb8e0e4e")
Expand Down
3 changes: 2 additions & 1 deletion sherpa-onnx/csrc/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void FeatureExtractorConfig::Register(ParseOptions *po) {
po->Register("dither", &dither,
"Dithering constant (0.0 means no dither). "
"By default the audio samples are in range [-1,+1], "
"so dithering constant should be around 0.0001");
"so 0.00003 is a good value, "
"equivalent to the default 1.0 from kaldi");
}

std::string FeatureExtractorConfig::ToString() const {
Expand Down
6 changes: 3 additions & 3 deletions sherpa-onnx/csrc/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ struct FeatureExtractorConfig {
// dithering constant, useful for signals with hard-zeroes in non-speech parts
// this prevents large negative values in log-mel filterbanks
//
// By default the audio samples are in range [-1,+1],
// so dithering constant should be around 0.0001
// In k2, audio samples are in range [-1..+1], in kaldi the range was [-32k..+32k],
// so the value 0.00003 is equivalent to kaldi default 1.0
//
float dither = 0.0f;
float dither = 0.0f; // dithering disabled by default

// Set internally by some models, e.g., paraformer sets it to false.
// This parameter is not exposed to users from the commandline
Expand Down

0 comments on commit 234f923

Please sign in to comment.