Commit ab3bfd3a authored by Jan Kiene's avatar Jan Kiene
Browse files

cleanup

parent 18a46e06
Loading
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -39,17 +39,14 @@ import shutil
import subprocess
import tempfile
import wave
import struct
import itertools
from pathlib import Path
from enum import Enum
from typing import Callable, Iterable, Optional, Tuple, Union

import numpy as np
import scipy.io.wavfile as wavfile
import scipy.signal as sig

from . import audiofile

main_logger = logging.getLogger("__main__")
logger = main_logger.getChild(__name__)
@@ -478,12 +475,8 @@ def run_wavdiff(
        test_tmp = test.astype(np.int32)

        if fs != 48000:
            ref_tmp = np.clip(
                resample(ref.astype(float), fs, 48000), -32768, 32767
            ).astype(np.int32)
            test_tmp = np.clip(
                resample(test.astype(float), fs, 48000), -32768, 32767
            ).astype(np.int32)
            ref_tmp = resample(ref.astype(float), fs, 48000).astype(np.int32)
            test_tmp = resample(test.astype(float), fs, 48000).astype(np.int32)

        bytes_per_sample = 3
        with wave.open(str(tmpfile_ref), mode="wb") as ref_tmp_wav:
@@ -500,10 +493,6 @@ def run_wavdiff(
            )
            ref_tmp_wav.writeframes(data_bytes)

            # for i in range(0, len(data_bytes), 4):
            #     chunk = data_bytes[i : i + bytes_per_sample]
            #     ref_tmp_wav.writeframes(chunk)

        with wave.open(str(tmpfile_test), mode="wb") as test_tmp_wav:
            data_bytes = test_tmp.astype("<i").tobytes()
            test_tmp_wav.setnchannels(nchannels)