Commit 4b6e5677 authored by Anika Treffehn's avatar Anika Treffehn
Browse files

added loudness info at the end

parent 34cab97d
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -251,6 +251,7 @@ def scale_files(
    loudness: float,
    fs: Optional[int] = 48000,
    in_meta: Optional[list] = None,
    logger: Optional[logging.Logger] = None,
) -> None:
    """
    Scales audio files to desired loudness
@@ -284,8 +285,14 @@ def scale_files(
            else:
                audio_obj = audio.fromfile(fmt, file, fs)

            # TODO: just for testing: remove later
            if logger:
                measured_loudness, _ = get_loudness(audio_obj)
                logger.info(f"measured loudness of file {file.name} for condition {file.parent.name}: {measured_loudness}")

            # adjust loudness
            scaled_audio = loudness_norm(audio_obj, loudness)

            # write into file
            write(file, scaled_audio, audio_obj.fs)
+1 −0
Original line number Diff line number Diff line
@@ -356,6 +356,7 @@ def reverse_process_2(cfg, logger):
            cfg.postprocessing["loudness"],
            cfg.postprocessing["fs"],
            out_meta_splits,
            logger,
        )
    return