Loading ivas_processing_scripts/__main__.py +2 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ if __name__ == "__main__": description="IVAS Processing scripts for setting up listening tests. Please refer to README.md for usage." ) parser.add_argument( "config", help="YAML configuration file", "config", help="YAML configuration file", ) parser.add_argument( "--debug", help="Set logging level to debug", action="store_true", default=False Loading ivas_processing_scripts/audiotools/EFAP.py +7 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,9 @@ import numpy as np def wrap_angles( azi: float, ele: float, clip_ele: Optional[bool] = False, azi: float, ele: float, clip_ele: Optional[bool] = False, ) -> Tuple[float, float]: """ Wrap angles to (-180, 180] azimuth and [-90, 90] elevation Loading Loading @@ -807,7 +809,10 @@ class EFAP: for poly, mod in found_polys: surface = self.verts[poly] d = self._point_plane_dist( surface[0].pos, surface[1].pos, surface[2].pos, point_pos, surface[0].pos, surface[1].pos, surface[2].pos, point_pos, ) if d >= 0: dist.append(d) Loading ivas_processing_scripts/audiotools/__init__.py +5 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,11 @@ def get_args(): default=None, ) output_parser.add_argument( "-mnru", "--mnru_q", type=float, help="Flag for MNRU processing", default=None, "-mnru", "--mnru_q", type=float, help="Flag for MNRU processing", default=None, ) output_parser.add_argument( "-esdru", Loading ivas_processing_scripts/audiotools/audioarray.py +33 −9 Original line number Diff line number Diff line Loading @@ -115,7 +115,9 @@ def trim( def window( x: np.ndarray, fs: Optional[int] = 48000, len_ms: Optional[float] = 100, x: np.ndarray, fs: Optional[int] = 48000, len_ms: Optional[float] = 100, ) -> np.ndarray: """ Apply windowing to the start and end Loading Loading @@ -241,7 +243,10 @@ def delay( return x def limiter(x: np.ndarray, fs: int,) -> np.ndarray: def limiter( x: np.ndarray, fs: int, ) -> np.ndarray: """ Apply limiting to an audio signal Loading Loading @@ -342,7 +347,9 @@ def limiter(x: np.ndarray, fs: int,) -> np.ndarray: def get_framewise( x: np.ndarray, chunk_size: int, zero_pad: Optional[bool] = False, x: np.ndarray, chunk_size: int, zero_pad: Optional[bool] = False, ) -> Iterator: """ Generator to yield a signal frame by frame Loading Loading @@ -410,7 +417,11 @@ def framewise_io( """Deprecated functions (partly replaced by ITU binaries)""" def resample(x: np.ndarray, in_freq: int, out_freq: int,) -> np.ndarray: def resample( x: np.ndarray, in_freq: int, out_freq: int, ) -> np.ndarray: """ Resample a multi-channel audio array Loading Loading @@ -445,7 +456,11 @@ def resample(x: np.ndarray, in_freq: int, out_freq: int,) -> np.ndarray: return y def lpfilter(x: np.ndarray, fc: int, fs: int,) -> np.ndarray: def lpfilter( x: np.ndarray, fc: int, fs: int, ) -> np.ndarray: """ Low-pass filter a multi-channel audio array Loading Loading @@ -478,7 +493,10 @@ def lpfilter(x: np.ndarray, fc: int, fs: int,) -> np.ndarray: return y def cut(x: np.ndarray, limits: Optional[Tuple[int, int]],) -> np.ndarray: def cut( x: np.ndarray, limits: Optional[Tuple[int, int]], ) -> np.ndarray: """ Cut an audio array Loading Loading @@ -524,7 +542,10 @@ def cut(x: np.ndarray, limits: Optional[Tuple[int, int]],) -> np.ndarray: def compare( ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool = False, ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool = False, ) -> dict: """ Compare two audio arrays Loading Loading @@ -612,7 +633,10 @@ def compare( return result def getdelay(x: np.ndarray, y: np.ndarray,) -> int: def getdelay( x: np.ndarray, y: np.ndarray, ) -> int: """ Get the delay between two audio signals Loading ivas_processing_scripts/audiotools/audiofile.py +18 −5 Original line number Diff line number Diff line Loading @@ -84,7 +84,9 @@ def read( ) elif data.dtype == np.float32: data = np.interp( data, (-1, 1), (np.iinfo(np.int16).min, np.iinfo(np.int16).max), data, (-1, 1), (np.iinfo(np.int16).min, np.iinfo(np.int16).max), ) x = np.array(data, dtype=outdtype) file_len = x.shape[0] Loading @@ -105,7 +107,9 @@ def read( def write( filename: Union[str, Path], x: np.ndarray, fs: Optional[int] = 48000, filename: Union[str, Path], x: np.ndarray, fs: Optional[int] = 48000, ) -> None: """ Write audio file (.pcm, .wav or .raw) Loading Loading @@ -273,7 +277,11 @@ def split( return out_paths def combine(in_filenames: list, out_file: str, in_fs: Optional[int] = 48000,) -> None: def combine( in_filenames: list, out_file: str, in_fs: Optional[int] = 48000, ) -> None: """ Combines audio files into one multi-channel file Loading Loading @@ -315,7 +323,10 @@ def combine(in_filenames: list, out_file: str, in_fs: Optional[int] = 48000,) -> def split_channels( in_file: str, out_filenames: list, in_nchans: int, in_fs: Optional[int] = 48000, in_file: str, out_filenames: list, in_nchans: int, in_fs: Optional[int] = 48000, ) -> None: """ Split multi-channel audio files into individual mono files Loading Loading @@ -355,7 +366,9 @@ def split_channels( write(out_file, y, fs=in_fs) def parse_wave_header(filename: str,) -> dict: def parse_wave_header( filename: str, ) -> dict: """ Get the format information from a WAV file. Return a dictionary with the format information Loading Loading
ivas_processing_scripts/__main__.py +2 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ if __name__ == "__main__": description="IVAS Processing scripts for setting up listening tests. Please refer to README.md for usage." ) parser.add_argument( "config", help="YAML configuration file", "config", help="YAML configuration file", ) parser.add_argument( "--debug", help="Set logging level to debug", action="store_true", default=False Loading
ivas_processing_scripts/audiotools/EFAP.py +7 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,9 @@ import numpy as np def wrap_angles( azi: float, ele: float, clip_ele: Optional[bool] = False, azi: float, ele: float, clip_ele: Optional[bool] = False, ) -> Tuple[float, float]: """ Wrap angles to (-180, 180] azimuth and [-90, 90] elevation Loading Loading @@ -807,7 +809,10 @@ class EFAP: for poly, mod in found_polys: surface = self.verts[poly] d = self._point_plane_dist( surface[0].pos, surface[1].pos, surface[2].pos, point_pos, surface[0].pos, surface[1].pos, surface[2].pos, point_pos, ) if d >= 0: dist.append(d) Loading
ivas_processing_scripts/audiotools/__init__.py +5 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,11 @@ def get_args(): default=None, ) output_parser.add_argument( "-mnru", "--mnru_q", type=float, help="Flag for MNRU processing", default=None, "-mnru", "--mnru_q", type=float, help="Flag for MNRU processing", default=None, ) output_parser.add_argument( "-esdru", Loading
ivas_processing_scripts/audiotools/audioarray.py +33 −9 Original line number Diff line number Diff line Loading @@ -115,7 +115,9 @@ def trim( def window( x: np.ndarray, fs: Optional[int] = 48000, len_ms: Optional[float] = 100, x: np.ndarray, fs: Optional[int] = 48000, len_ms: Optional[float] = 100, ) -> np.ndarray: """ Apply windowing to the start and end Loading Loading @@ -241,7 +243,10 @@ def delay( return x def limiter(x: np.ndarray, fs: int,) -> np.ndarray: def limiter( x: np.ndarray, fs: int, ) -> np.ndarray: """ Apply limiting to an audio signal Loading Loading @@ -342,7 +347,9 @@ def limiter(x: np.ndarray, fs: int,) -> np.ndarray: def get_framewise( x: np.ndarray, chunk_size: int, zero_pad: Optional[bool] = False, x: np.ndarray, chunk_size: int, zero_pad: Optional[bool] = False, ) -> Iterator: """ Generator to yield a signal frame by frame Loading Loading @@ -410,7 +417,11 @@ def framewise_io( """Deprecated functions (partly replaced by ITU binaries)""" def resample(x: np.ndarray, in_freq: int, out_freq: int,) -> np.ndarray: def resample( x: np.ndarray, in_freq: int, out_freq: int, ) -> np.ndarray: """ Resample a multi-channel audio array Loading Loading @@ -445,7 +456,11 @@ def resample(x: np.ndarray, in_freq: int, out_freq: int,) -> np.ndarray: return y def lpfilter(x: np.ndarray, fc: int, fs: int,) -> np.ndarray: def lpfilter( x: np.ndarray, fc: int, fs: int, ) -> np.ndarray: """ Low-pass filter a multi-channel audio array Loading Loading @@ -478,7 +493,10 @@ def lpfilter(x: np.ndarray, fc: int, fs: int,) -> np.ndarray: return y def cut(x: np.ndarray, limits: Optional[Tuple[int, int]],) -> np.ndarray: def cut( x: np.ndarray, limits: Optional[Tuple[int, int]], ) -> np.ndarray: """ Cut an audio array Loading Loading @@ -524,7 +542,10 @@ def cut(x: np.ndarray, limits: Optional[Tuple[int, int]],) -> np.ndarray: def compare( ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool = False, ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool = False, ) -> dict: """ Compare two audio arrays Loading Loading @@ -612,7 +633,10 @@ def compare( return result def getdelay(x: np.ndarray, y: np.ndarray,) -> int: def getdelay( x: np.ndarray, y: np.ndarray, ) -> int: """ Get the delay between two audio signals Loading
ivas_processing_scripts/audiotools/audiofile.py +18 −5 Original line number Diff line number Diff line Loading @@ -84,7 +84,9 @@ def read( ) elif data.dtype == np.float32: data = np.interp( data, (-1, 1), (np.iinfo(np.int16).min, np.iinfo(np.int16).max), data, (-1, 1), (np.iinfo(np.int16).min, np.iinfo(np.int16).max), ) x = np.array(data, dtype=outdtype) file_len = x.shape[0] Loading @@ -105,7 +107,9 @@ def read( def write( filename: Union[str, Path], x: np.ndarray, fs: Optional[int] = 48000, filename: Union[str, Path], x: np.ndarray, fs: Optional[int] = 48000, ) -> None: """ Write audio file (.pcm, .wav or .raw) Loading Loading @@ -273,7 +277,11 @@ def split( return out_paths def combine(in_filenames: list, out_file: str, in_fs: Optional[int] = 48000,) -> None: def combine( in_filenames: list, out_file: str, in_fs: Optional[int] = 48000, ) -> None: """ Combines audio files into one multi-channel file Loading Loading @@ -315,7 +323,10 @@ def combine(in_filenames: list, out_file: str, in_fs: Optional[int] = 48000,) -> def split_channels( in_file: str, out_filenames: list, in_nchans: int, in_fs: Optional[int] = 48000, in_file: str, out_filenames: list, in_nchans: int, in_fs: Optional[int] = 48000, ) -> None: """ Split multi-channel audio files into individual mono files Loading Loading @@ -355,7 +366,9 @@ def split_channels( write(out_file, y, fs=in_fs) def parse_wave_header(filename: str,) -> dict: def parse_wave_header( filename: str, ) -> dict: """ Get the format information from a WAV file. Return a dictionary with the format information Loading