Commit be38c8dc authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

do not issue warning in case of clipping

parent 87e2f087
Loading
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import sys
import time
from typing import Tuple
from multiprocessing import Pool
import warnings
import math
from dataclasses import dataclass
from typing import Union
@@ -189,7 +188,7 @@ def writefile(filename: str, x: np.ndarray, fs: int = 48000) -> None:
        np.logical_or(x < np.iinfo(np.int16).min, x > np.iinfo(np.int16).max)
    )
    if clipped_samples > 0:
        warnings.warn(f"  Warning: {clipped_samples} samples clipped")
        # do not issue warning for clipping as it is expected that some implementations may produce out of bound values and the reference implementation clips them. Instead, just count the number of clipped samples and clip the values to int16 range before writing to file to avoid overflow issues.
        x = np.clip(x, np.iinfo(np.int16).min, np.iinfo(np.int16).max)

    if file_extension == ".wav":
@@ -1037,7 +1036,8 @@ class MLDConformance:
        self, tag: str, pyTestsTag: str, testIndex: int = 0, totalTests: int = 0
    ):
        # Run CUT Cmdline
        testPrefix = f"[{tag} {testIndex}/{totalTests}]"
        _w = len(str(totalTests))
        testPrefix = f"[{tag} {testIndex:{_w}}/{totalTests}]"
        self.appendRunlog(
            context=self.formatTestHeader(testPrefix, "Running test", pyTestsTag)
        )
@@ -1059,7 +1059,8 @@ class MLDConformance:
    def analyseOneCommand(
        self, tag: str, pyTestsTag: str, testIndex: int = 0, totalTests: int = 0
    ):
        testPrefix = f"[{tag} {testIndex}/{totalTests}]"
        _w = len(str(totalTests))
        testPrefix = f"[{tag} {testIndex:{_w}}/{totalTests}]"
        header = self.formatTestHeader(testPrefix, "Analyzing test", pyTestsTag)
        self.appendRunlog(context=header)
        non_be = None