Commit 1bcae77a authored by Anika Treffehn's avatar Anika Treffehn
Browse files

slight changes in ISM test and added resampling in mnru

parent c394351b
Loading
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory
from warnings import warn
from copy import copy

import numpy as np

@@ -72,14 +73,13 @@ def p50fbmnru(
    else:
        binary = find_binary("p50fbmnru")

    if input.fs != 48000:
        warn("P.50 Fullband MNRU requires a sampling rate of 48kHz.")
        tmp_sig = resample_itu(input, 48000)
    else:
        tmp_sig = input.audio
    tmp_audio_obj = copy(input)

    tmp_input_signal = tmp_sig
    tmp_output_signal = np.ones((48000, input.num_channels))
    # resample signal to 48kHz
    if input.fs != 48000:
        warn("P.50 Fullband MNRU requires a sampling rate of 48kHz. Resampling will be applied")
        tmp_audio_obj.audio = resample_itu(tmp_audio_obj, 48000)
        tmp_audio_obj.fs = 48000

    with TemporaryDirectory() as tmp_dir:
        tmp_dir = Path(tmp_dir)
@@ -99,12 +99,16 @@ def p50fbmnru(
        ]

        # write temporary file
        write(tmp_input_file, tmp_input_signal)
        write(tmp_output_file, tmp_output_signal)
        write(tmp_input_file, tmp_audio_obj.audio)

        # run command
        run(cmd)

        tmp_output_signal, out_fs = read(tmp_output_file, input.num_channels)
        tmp_output_signal, _ = read(tmp_output_file, input.num_channels)
        tmp_audio_obj.audio = tmp_output_signal

    # revert resampling
    if input.fs != 48000:
        tmp_output_signal = resample_itu(tmp_audio_obj, input.fs)

    return tmp_output_signal
+6 −6
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ preprocessing:
    ### Flag for using noise (amplitude +-4) instead of silence for padding; default = false (silence)
    # pad_noise: true
    ### Value for application of delay (ms) (negative values advance); default = 0
    delay: 20
    # delay: 20
    ### Length of window used at start/end of signal (ms); default = 0
    # window: 100
    
@@ -124,23 +124,23 @@ preprocessing_2:
### can be given globally here or in individual conditions of type ivas or evs
tx:
    ### REQUIRED: Type of bitstream processing; possible types: "JBM" or "FER"
    type: "JBM"
    type: "FER"
    
    ### JBM
    ### REQUIRED: either error_pattern or error_profile
    ### delay error profile file
    # error_pattern: ".../dly_error_profile.dat"
    ### Index of one of the existing delay error profile files to use (1-11)
    error_profile: 5
    # error_profile: 5
    ## nFramesPerPacket parameter for the network simulator; default = 1
    n_frames_per_packet: 2
    # n_frames_per_packet: 2
    
    ### FER
    ### REQUIRED: either error_pattern or error_rate
    ### Frame error pattern file
    # error_pattern: "path/pattern.192"
    ### Error rate in percent
    # error_rate: 5
    error_rate: 5
    ### Additional seed to specify number of preruns; default = 0
    # prerun_seed: 2
    
@@ -277,7 +277,7 @@ postprocessing:
    ### REQUIRED: Target format for output
    fmt: "BINAURAL"
    ### REQUIRED: Target sampling rate in Hz for resampling
    fs: 48000
    fs: 32000
    ### Low-pass cut-off frequency in Hz; default = null (no filtering)
    lp_cutoff: 10000
    ### Target loudness in LKFS; default = null (no loudness change applied)