From b4cce7883091fd30da9c3a219332f65026f664a8 Mon Sep 17 00:00:00 2001
From: Sting <lallegre26@gmail.com>
Date: Thu, 13 Jul 2023 22:27:42 +0200
Subject: [PATCH] Fix

---
 cnn_madmom/segment.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cnn_madmom/segment.py b/cnn_madmom/segment.py
index 17bfbdf..3a4a75a 100644
--- a/cnn_madmom/segment.py
+++ b/cnn_madmom/segment.py
@@ -12,15 +12,16 @@ def segment(songfile):
     backtrack = False
 
     cnn = madmom.features.onsets.CNNOnsetProcessor()
-    spectral = madmom.features.onsets.SpectralOnsetProcessor('complex_domain')
+    spectral = madmom.features.onsets.SpectralOnsetProcessor('modified_kullback_leibler')
 
+    sig = madmom.audio.signal.Signal(songfile, num_channels=1)
 
-    spec = madmom.audio.spectrogram.Spectrogram(songfile, num_channels=1)
+    spec = madmom.audio.spectrogram.Spectrogram(sig)
     filt_spec = madmom.audio.spectrogram.FilteredSpectrogram(spec, filterbank=madmom.audio.filters.LogFilterbank, num_bands=24)
     log_spec = madmom.audio.spectrogram.LogarithmicSpectrogram(filt_spec, add=1)
 
-    cnn_function = cnn(songfile, num_channels=1)
-    spectral_function = spectral(songfile, num_channels=1)
+    cnn_function = cnn(sig)
+    spectral_function = spectral(sig)
     spectral_function = spectral_function/(spectral_function.max())
     
     #activation_function = 0.5*cnn_function + 0.5*spectral_function
-- 
GitLab