MTG / essentia

C++ library for audio and music analysis, description and synthesis, including Python bindings
http://essentia.upf.edu
GNU Affero General Public License v3.0
2.83k stars 530 forks source link

[python] SpectralContrast crash #568

Closed louis49 closed 7 years ago

louis49 commented 7 years ago
loader = EasyLoader(filename='test.wav', sampleRate=48000)
signal = loader()
pool = essentia.Pool()
fg = FrameGenerator(signal,
                    frameSize=1024,
                    hopSize=512,
                    startFromZero=True,
                    validFrameThresholdRatio=0,
                    lastFrameToEndOfFile=True)
window = Windowing(type="hamming",
                   size=1024,
                   zeroPadding=0,
                   normalized=False,
                   zeroPhase=False)
spectrum = Spectrum(size=2048)
scAlgo = SpectralContrast(
    lowFrequencyBound=0,
    highFrequencyBound=11000,
    numberBands=6,
    sampleRate=48000,
    frameSize=int(2048/2+1)
)

for frame in fg:
    w = window(frame)
    s = spectrum(w)
    spectralContrast,spectralValley = scAlgo(s)       => Crash

    print(spectralContrast)
dbogdanov commented 7 years ago

The problem occurs when lowFrequencyBound is set to zero.

louis49 commented 7 years ago

Thank you