Commit 1a740cb3 authored by PLAINSI's avatar PLAINSI
Browse files

Add __init__.py code and binauralize option

parent 5a00b481
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ IR_path: "./IRs"
### Output path for generated test items and metadata files
output_path: "./items_HOA2"

### (Optional) Output path for binauralized versions of the generated HOA2 items
# binaural_path: "./items_HOA2_bin"

### Target loudness in LKFS; default = null (no loudness normalization applied)
loudness: -26

+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ IR_path: "./IRs"
### Output path for generated test items and metadata files
output_path: "./items_FOA"

### (Optional) Output path for binauralized versions of the generated FOA items
# binaural_path: "./items_FOA_bin"

### Target loudness in LKFS; default = null (no loudness normalization applied)
loudness: -26

+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ IR_path: "./IRs"
### Output path for generated test items and metadata files
output_path: "./items_FOA"

### (Optional) Output path for binauralized versions of the generated FOA items
# binaural_path: "./items_FOA_bin"

### Target loudness in LKFS; default = null (no loudness normalization applied)
loudness: -26

+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ from ivas_processing_scripts.constants import (
from ivas_processing_scripts.generation import (
    config,
    process_foa_items,
    process_hoa2_items,
    process_ism_items,
    process_stereo_items,
)
@@ -96,6 +97,9 @@ def main(args):
    elif cfg.format == "FOA":
        # generate FOA items according to scene description
        process_foa_items.generate_foa_items(cfg, logger)
    elif cfg.format == "HOA2":
        # generate HOA2 items according to scene description
        process_hoa2_items.generate_hoa2_items(cfg, logger)

    # copy configuration to output directory
    with open(cfg.output_path.joinpath(f"{cfg.format}.yml"), "w") as f:
+16 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ from math import floor

import numpy as np

from ivas_processing_scripts.audiotools import audio, audiofile
from ivas_processing_scripts.audiotools import audio, audiofile, convert
from ivas_processing_scripts.audiotools.wrappers.bs1770 import get_loudness
from ivas_processing_scripts.audiotools.wrappers.reverb import reverb_foa
from ivas_processing_scripts.generation import config
@@ -86,6 +86,10 @@ def generate_foa_items(
    if "add_low_level_random_noise" not in cfg.__dict__:
        cfg.add_low_level_random_noise = False

    # setup binaural rendering
    if "binaural_path" not in cfg.__dict__:
        cfg.binaural_path = ""

    # repeat for all source files
    for scene_name, scene in cfg.scenes.items():
        logger.info(
@@ -213,4 +217,15 @@ def generate_foa_items(
            os.path.join(cfg.output_path, output_filename), y.audio, y.fs
        )  # !!!! TBD: replace all os.path.xxx operations with the Path object

        # convert to binaural if option chosen
        if cfg.binaural_path != "":
            binaudio = audio.fromtype("BINAURAL")
            binaudio.fs = y.fs
            convert.format_conversion(y, binaudio)
            audiofile.write(
                os.path.join(cfg.binaural_path, output_filename),
                binaudio.audio,
                binaudio.fs,
            )  # !!!! TBD: replace all os.path.xxx operations with the Path object

    return
Loading