Skip to content

Commit

Permalink
Add test, update version
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesG-Speechmatics committed Mar 4, 2024
1 parent 010c8f8 commit 604aa30
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.14.4] - 2024-03-04

## Added

- Support for volume_threshold audio filtering in transcription config

## [1.14.3] - 2024-02-29

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.14.3
1.14.4
4 changes: 3 additions & 1 deletion speechmatics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ def get_transcription_config(
config[option] = True if args.get(option) else config.get(option)

if args.get("volume_threshold"):
config["audio_filtering_config"] = {"volume_threshold": args.get("volume_threshold")}
config["audio_filtering_config"] = {
"volume_threshold": args.get("volume_threshold")
}

if args.get("ctrl"):
LOGGER.warning(f"Using internal dev control command: {args['ctrl']}")
Expand Down
7 changes: 7 additions & 0 deletions speechmatics/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ def get_arg_parser():
default=None,
help="Language (ISO 639-1 code, e.g. en, fr, de).",
)
config_parser.add_argument(
"--volume-threshold",
dest="volume_threshold",
type=float,
default=None,
help=("Filter out quiet audio which falls below this threshold (0.0-10.0)"),
)
config_parser.add_argument(
"--operating-point",
choices=["standard", "enhanced"],
Expand Down
5 changes: 5 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@
"detect_chapters": True,
},
),
(
["batch", "transcribe", "--volume-threshold", "3.1"],
{"volume_threshold": 3.1},
),
],
)
def test_cli_arg_parse_with_file(args, values):
Expand All @@ -332,6 +336,7 @@ def test_cli_arg_parse_with_file(args, values):
actual_values = vars(cli.parse_args(args=test_args))

for key, val in values.items():
assert key in actual_values, f"Expected {key} in {actual_values}"
assert actual_values[key] == val, f"Expected {actual_values} to match {values}"


Expand Down

0 comments on commit 604aa30

Please sign in to comment.