Commit 11670ff0 authored by Vinit Veera's avatar Vinit Veera
Browse files

Modified the wrapper functions to accept an addiotinal binary_path arguemnt.

parent d961c8c7
Loading
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ logger.setLevel(logging.DEBUG)
def bs1770demo(
    input: audio.Audio,
    target_loudness: Optional[float] = -26,
    binary_path: Optional[Path] = None,
) -> Tuple[float, float]:
    """
    Wrapper for ITU-R BS.1770-4, requires bs1770demo binary
@@ -72,6 +73,9 @@ def bs1770demo(

    null_file = get_devnull()

    if binary_path is not None:
        binary = find_binary(binary_path.name, binary_path=binary_path.parent)
    else:
        binary = find_binary("bs1770demo")

    if not isinstance(input, audio.BinauralAudio) and not isinstance(
+5 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ def eid_xor(
    error_pattern: Union[str, Path],
    in_bitstream: Union[str, Path],
    out_bitstream: Union[str, Path],
    binary_path: Optional[Path] = None,
) -> None:
    """
    Wrapper for eid-xor binary to apply error patterns for the bitstream processing
@@ -57,6 +58,9 @@ def eid_xor(
    """

    # find binary
    if binary_path is not None:
        binary = find_binary(binary_path.name, binary_path=binary_path.parent)
    else:
        binary = find_binary("eid-xor")

    # check for valid inputs
+5 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ def esdru(
    sf: Optional[int] = 48000,
    e_step: Optional[float] = 0.5,
    seed: Optional[int] = 1,
    binary_path: Optional[Path] = None,
) -> np.ndarray:
    """
    Wrapper for ESDRU (Ericsson spatial distortion reference unit) Recommendation ITU-T P.811, requires esdru binary
@@ -70,6 +71,9 @@ def esdru(
        Output array (16 bit Stereo PCM)
    """

    if binary_path is not None:
        binary = find_binary(binary_path.name, binary_path=binary_path.parent)
    else:
        binary = find_binary("esdru")

    if not isinstance(input, audio.BinauralAudio) and not input.name == "STEREO":
+5 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ def filter_itu(
    is_async: Optional[bool] = False,
    delay: Optional[int] = None,
    skip_channel: Optional[list[int]] = None,
    binary_path: Optional[Path] = None,
) -> np.ndarray:
    """
    Low-pass filter a multi-channel audio array
@@ -88,6 +89,9 @@ def filter_itu(
        Output filtered array
    """

    if binary_path is not None:
        binary = find_binary(binary_path.name, binary_path=binary_path.parent)
    else:
        binary = find_binary("filter")

    # check if filter type is supported
+5 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ def gen_patt(
    error_rate: float,
    start: Optional[int] = 0,
    working_dir: Optional[Union[Path, str]] = None,
    binary_path: Optional[Path] = None,
) -> None:
    """
    Wrapper for gen-patt binary to create error patterns for the bitstream processing
@@ -66,6 +67,9 @@ def gen_patt(
    """

    # find binary
    if binary_path is not None:
        binary = find_binary(binary_path.name, binary_path=binary_path.parent)
    else:
        binary = find_binary("gen-patt")

    if working_dir is None:
Loading