Loading scripts/README.md +3 −1 Original line number Diff line number Diff line Loading @@ -64,8 +64,10 @@ title: Python scripts for Testing the IVAS code and Generating test items ## 0. Requirements - Python >= 3.7 - Python = 3.9 - numpy and scipy for `generate_test_items.py`, `testBitexact.py` and `self_test.py` - pytest, pytest-cov and pytest-xdist (also see requirements.txt) --- ## 1. Scripts and classes for testing IVAS code Loading scripts/pyaudio3dtools/audiofile.py +10 −6 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ def writefile( filename: str, x: np.ndarray, fs: Optional[int] = 48000, supress_warning: Optional[bool] = False, ) -> None: """ Write audio file (.pcm, .wav or .raw) Loading @@ -120,6 +121,8 @@ def writefile( Numpy 2D array of dimension: number of channels x number of samples fs: Optional[int] Output sampling rate, required for .pcm or .raw input file, otherwise default = 48000 (Hz) supress_warning: Optional[bool] If True supress warning when samples clip Returns ------- Loading @@ -128,6 +131,7 @@ def writefile( _, file_extension = os.path.splitext(os.path.basename(filename)) if not supress_warning: clipped_samples = np.sum( np.logical_or(x < np.iinfo(np.int16).min, x > np.iinfo(np.int16).max) ) Loading scripts/pyaudio3dtools/binauralrenderer.py +5 −5 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import itertools import logging import os import warnings from typing import Optional, Tuple from typing import List, Optional, Tuple import numpy as np import scipy.interpolate as interp Loading Loading @@ -517,7 +517,7 @@ def interpolate_2d( pos: np.ndarray, interp_1d: Optional[bool] = False, weights: Optional[np.ndarray] = None, ghost: Optional[list[bool]] = None, ghost: Optional[List[bool]] = None, SourcePosition: Optional[np.ndarray] = None, IR: Optional[np.ndarray] = None, phase: Optional[bool] = False, Loading Loading @@ -609,7 +609,7 @@ def interpolate_2d( def add_ghost_speaker_bary( SourcePosition: np.ndarray, IR: np.ndarray, ) -> Tuple[list[bool], np.ndarray, np.ndarray]: ) -> Tuple[List[bool], np.ndarray, np.ndarray]: """ Adds a ghost speaker at the poles if necessary and indicates result by bool values Loading Loading @@ -654,7 +654,7 @@ def binaural_fftconv( x: np.ndarray, IR: np.ndarray, nchannels: int, lfe_index: Optional[list[int]] = None, lfe_index: Optional[List[int]] = None, ) -> np.ndarray: """ Binauralization using fft convolution Loading @@ -667,7 +667,7 @@ def binaural_fftconv( HRIRs array nchannels: int Maximum number of channels to process lfe_index: list[int] lfe_index: List[int] List of LFE channel indices Returns Loading scripts/pyaudio3dtools/masarenderer.py +3 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import os import shutil import subprocess as sp from tempfile import TemporaryDirectory from typing import List import numpy as np Loading @@ -44,7 +45,7 @@ from pyaudio3dtools.spatialaudioformat import Format def render_masa( in_sig: np.ndarray, in_meta: str, in_meta: List[str], out_spfmt: Format, ) -> np.ndarray: """ Loading @@ -54,7 +55,7 @@ def render_masa( ---------- in_sig: np.ndarray Input signal with MASA transport channels in_meta: list[str] in_meta: List[str] Input MASA metadata file out_spfmt: Format Output spatial audio format Loading scripts/pyaudio3dtools/spatialaudioconvert.py +5 −5 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import os import warnings import platform import shutil from typing import Optional, Tuple from typing import List, Optional, Tuple import subprocess as sp from tempfile import TemporaryDirectory Loading Loading @@ -282,7 +282,7 @@ def convert( in_spfmt: spatialaudioformat.Format, in_fs: int, in_nchans: int, in_meta_files: list[str], in_meta_files: List[str], out_spfmt: spatialaudioformat.Format, out_format: str, out_fs: int, Loading Loading @@ -311,7 +311,7 @@ def convert( Input sampling frequency in_nchans: int input number of channels in_meta_files: list[str] in_meta_files: List[str] Metadata files out_spfmt: spatialaudioformat.Format Loading Loading @@ -852,9 +852,9 @@ def loudnessinfo( # write temporary file if in_spfmt.isheadphones: writefile(tmp_file, in_sig[:, :2], 48000) writefile(tmp_file, in_sig[:, :2], 48000, supress_warning=True) elif in_spfmt.isloudspeaker: writefile(tmp_file, in_sig, 48000) writefile(tmp_file, in_sig, 48000, supress_warning=True) # run command try: Loading Loading
scripts/README.md +3 −1 Original line number Diff line number Diff line Loading @@ -64,8 +64,10 @@ title: Python scripts for Testing the IVAS code and Generating test items ## 0. Requirements - Python >= 3.7 - Python = 3.9 - numpy and scipy for `generate_test_items.py`, `testBitexact.py` and `self_test.py` - pytest, pytest-cov and pytest-xdist (also see requirements.txt) --- ## 1. Scripts and classes for testing IVAS code Loading
scripts/pyaudio3dtools/audiofile.py +10 −6 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ def writefile( filename: str, x: np.ndarray, fs: Optional[int] = 48000, supress_warning: Optional[bool] = False, ) -> None: """ Write audio file (.pcm, .wav or .raw) Loading @@ -120,6 +121,8 @@ def writefile( Numpy 2D array of dimension: number of channels x number of samples fs: Optional[int] Output sampling rate, required for .pcm or .raw input file, otherwise default = 48000 (Hz) supress_warning: Optional[bool] If True supress warning when samples clip Returns ------- Loading @@ -128,6 +131,7 @@ def writefile( _, file_extension = os.path.splitext(os.path.basename(filename)) if not supress_warning: clipped_samples = np.sum( np.logical_or(x < np.iinfo(np.int16).min, x > np.iinfo(np.int16).max) ) Loading
scripts/pyaudio3dtools/binauralrenderer.py +5 −5 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import itertools import logging import os import warnings from typing import Optional, Tuple from typing import List, Optional, Tuple import numpy as np import scipy.interpolate as interp Loading Loading @@ -517,7 +517,7 @@ def interpolate_2d( pos: np.ndarray, interp_1d: Optional[bool] = False, weights: Optional[np.ndarray] = None, ghost: Optional[list[bool]] = None, ghost: Optional[List[bool]] = None, SourcePosition: Optional[np.ndarray] = None, IR: Optional[np.ndarray] = None, phase: Optional[bool] = False, Loading Loading @@ -609,7 +609,7 @@ def interpolate_2d( def add_ghost_speaker_bary( SourcePosition: np.ndarray, IR: np.ndarray, ) -> Tuple[list[bool], np.ndarray, np.ndarray]: ) -> Tuple[List[bool], np.ndarray, np.ndarray]: """ Adds a ghost speaker at the poles if necessary and indicates result by bool values Loading Loading @@ -654,7 +654,7 @@ def binaural_fftconv( x: np.ndarray, IR: np.ndarray, nchannels: int, lfe_index: Optional[list[int]] = None, lfe_index: Optional[List[int]] = None, ) -> np.ndarray: """ Binauralization using fft convolution Loading @@ -667,7 +667,7 @@ def binaural_fftconv( HRIRs array nchannels: int Maximum number of channels to process lfe_index: list[int] lfe_index: List[int] List of LFE channel indices Returns Loading
scripts/pyaudio3dtools/masarenderer.py +3 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import os import shutil import subprocess as sp from tempfile import TemporaryDirectory from typing import List import numpy as np Loading @@ -44,7 +45,7 @@ from pyaudio3dtools.spatialaudioformat import Format def render_masa( in_sig: np.ndarray, in_meta: str, in_meta: List[str], out_spfmt: Format, ) -> np.ndarray: """ Loading @@ -54,7 +55,7 @@ def render_masa( ---------- in_sig: np.ndarray Input signal with MASA transport channels in_meta: list[str] in_meta: List[str] Input MASA metadata file out_spfmt: Format Output spatial audio format Loading
scripts/pyaudio3dtools/spatialaudioconvert.py +5 −5 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import os import warnings import platform import shutil from typing import Optional, Tuple from typing import List, Optional, Tuple import subprocess as sp from tempfile import TemporaryDirectory Loading Loading @@ -282,7 +282,7 @@ def convert( in_spfmt: spatialaudioformat.Format, in_fs: int, in_nchans: int, in_meta_files: list[str], in_meta_files: List[str], out_spfmt: spatialaudioformat.Format, out_format: str, out_fs: int, Loading Loading @@ -311,7 +311,7 @@ def convert( Input sampling frequency in_nchans: int input number of channels in_meta_files: list[str] in_meta_files: List[str] Metadata files out_spfmt: spatialaudioformat.Format Loading Loading @@ -852,9 +852,9 @@ def loudnessinfo( # write temporary file if in_spfmt.isheadphones: writefile(tmp_file, in_sig[:, :2], 48000) writefile(tmp_file, in_sig[:, :2], 48000, supress_warning=True) elif in_spfmt.isloudspeaker: writefile(tmp_file, in_sig, 48000) writefile(tmp_file, in_sig, 48000, supress_warning=True) # run command try: Loading