csteinmetz1/pyloudnorm

how to evaluate windowed loudness

Opened this issue · 1 comments

I have a 60 seconds music, and I need to calculate every 0.5 second window loudness. How to implement it ? Should I just split the music into pieces and calculate each piece loudness?

data, rate = sf.read(path) # load audio (with shape (samples, channels))
meter = pyln.Meter(rate=rate,block_size=0.3) # create BS.1770 meter
loudnesses = []
for w in range(data.shape[0]//100):
loudnesses.append(meter.integrated_loudness(data[w:w+int(0.3*rate),0:2]))
print(loudnesses[0:10])