Skip to content

Overflow, 2473.459531146733 #42

@PetrochukM

Description

@PetrochukM

Hello!

I ran a quiet sine wave through the implementation and I believe it overflowed, I received the output:
loudness 2473.459531146733

import numpy as np
import pyloudnorm

frequency = 997
sample_rate = 1000
block_size = 0.4

# NOTE: Generate sine wave
# https://stackoverflow.com/questions/22566692/python-how-to-plot-graph-sine-wave/34442729
signal = np.arange(sample_rate * block_size, dtype=np.float32)
signal = np.sin(2 * np.pi * frequency * (signal / sample_rate)).astype(np.float32)
signal = signal / 100000
meter = pyloudnorm.Meter(rate=sample_rate, block_size=block_size, filter_class="DeMan")
print("loudness", meter.integrated_loudness(signal))

I think it would be best to adjust the computation so that this does not overflow and return negative infinity like other quiet signals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions