Repository: Eomys/MoSQITo (language: python)

Issue:
Updates Loudness ECMA to 2nd Ed (2022)
Hi all, I have updated the `loudness_ecma` function to the [2nd Edition of the ECMA-418-2 standard](https://ecma-international.org/wp-content/uploads/ECMA-418-2_2nd_edition_december_2022.pdf), from 2022. The 2nd Edition includes mostly minor changes, such as a few slightly different coefficients, and I have corrected references within the MoSQITo functions to equations and section numbers to match those of the 2nd Edition. 

There are a few larger changes in the main `loudness_ecma` function: per Sec. 5.1.2, there are now a windowing function at the start of the signal and zero padding at the start and end of the signal. The new segmentation equations in the 2nd Ed required some code restructuring: the previous file `_rectified_band_pass_signals` has been removed, and its content is now split between two new files (`_band_pass_signals` and `_ecma_time_segmentation`), and the rectification is performed within the `loudness_ecma` function itself.

Regarding tests and validations:

- The script `test_loudness_ecma` currently does **NOT** pass: the 1 kHz and 5 kHz tones have loudness values of 15.65... and 15.78... with the new calculations, so they are not equal to 7 decimal places. I'm not sure if this is a bug in the code, or if the test was ad-hoc and is not applicable to this new version for some reason. Does anyone has any light on this?

- In the script `valid_ear_filter_design`, the MoSQITo ear filter now matches the ECMA filter response slightly closer than before. On the left is the older version, right is the new version.

![ear_filter_design](https://github.com/Eomys/MoSQITo/assets/4397096/fbc3cae3-5daa-40e7-b6d7-d190aa9b6bc7)

- In the script `hearing_model_validation`, the hearing model curves are very similarly to the older version, although there are a few kinks at low frequencies that appear to be bugs. I'll look into them during the next few days. On the left is the older version, right is the new version:

![hearing_model_validation](https://github.com/Eomys/MoSQITo/assets/4397096/05ca2e23-1c8e-4b12-b7ea-5d9c3bc5af97)

- In the script `valid_gammatone`, there are now only two curves plotted instead of three - the 2nd edition changed the complex exponential sign in the band pass filters to positive in what is now Section 5.1.4 (Eqs. 16 and 17), so I removed the old curve with the negative sign (that existed in the 1st edition of the standard). On the left is the older version, right is the new version:

![auditory_filter](https://github.com/Eomys/MoSQITo/assets/4397096/1fd6500f-bfd2-4655-af62-b23acfb26dbe)

Updates Loudness ECMA to 2nd Ed (2022)
Hi all, I have updated the `loudness_ecma` function to the [2nd Edition of the ECMA-418-2 standard](https://ecma-international.org/wp-content/uploads/ECMA-418-2_2nd_edition_december_2022.pdf), from 2022. The 2nd Edition includes mostly minor changes, such as a few slightly different coefficients, and I have corrected references within the MoSQITo functions to equations and section numbers to match those of the 2nd Edition. 

There are a few larger changes in the main `loudness_ecma` function: per Sec. 5.1.2, there are now a windowing function at the start of the signal and zero padding at the start and end of the signal. The new segmentation equations in the 2nd Ed required some code restructuring: the previous file `_rectified_band_pass_signals` has been removed, and its content is now split between two new files (`_band_pass_signals` and `_ecma_time_segmentation`), and the rectification is performed within the `loudness_ecma` function itself.

Regarding tests and validations:

- The script `test_loudness_ecma` currently does **NOT** pass: the 1 kHz and 5 kHz tones have loudness values of 15.65... and 15.78... with the new calculations, so they are not equal to 7 decimal places. I'm not sure if this is a bug in the code, or if the test was ad-hoc and is not applicable to this new version for some reason. Does anyone has any light on this?

- In the script `valid_ear_filter_design`, the MoSQITo ear filter now matches the ECMA filter response slightly closer than before. On the left is the older version, right is the new version.

![ear_filter_design](https://github.com/Eomys/MoSQITo/assets/4397096/fbc3cae3-5daa-40e7-b6d7-d190aa9b6bc7)

- In the script `hearing_model_validation`, the hearing model curves are very similarly to the older version, although there are a few kinks at low frequencies that appear to be bugs. I'll look into them during the next few days. On the left is the older version, right is the new version:

![hearing_model_validation](https://github.com/Eomys/MoSQITo/assets/4397096/05ca2e23-1c8e-4b12-b7ea-5d9c3bc5af97)

- In the script `valid_gammatone`, there are now only two curves plotted instead of three - the 2nd edition changed the complex exponential sign in the band pass filters to positive in what is now Section 5.1.4 (Eqs. 16 and 17), so I removed the old curve with the negative sign (that existed in the 1st edition of the standard). On the left is the older version, right is the new version:

![auditory_filter](https://github.com/Eomys/MoSQITo/assets/4397096/1fd6500f-bfd2-4655-af62-b23acfb26dbe)



Discussion / hints:

Fix patch:
diff --git a/mosqito/__init__.py b/mosqito/__init__.py
index f9836f17..2a1a6334 100644
--- a/mosqito/__init__.py
+++ b/mosqito/__init__.py
@@ -4,12 +4,18 @@
 
 from mosqito.sq_metrics.loudness.loudness_ecma.loudness_ecma import loudness_ecma
 from mosqito.sq_metrics.loudness.loudness_zwst.loudness_zwst import loudness_zwst
-from mosqito.sq_metrics.loudness.loudness_zwst.loudness_zwst_freq import loudness_zwst_freq
-from mosqito.sq_metrics.loudness.loudness_zwst.loudness_zwst_perseg import loudness_zwst_perseg
+from mosqito.sq_metrics.loudness.loudness_zwst.loudness_zwst_freq import (
+    loudness_zwst_freq,
+)
+from mosqito.sq_metrics.loudness.loudness_zwst.loudness_zwst_perseg import (
+    loudness_zwst_perseg,
+)
 
 from mosqito.sq_metrics.loudness.loudness_zwtv.loudness_zwtv import loudness_zwtv
 
-from mosqito.sq_metrics.loudness.utils.equal_loudness_contours import equal_loudness_contours
+from mosqito.sq_metrics.loudness.utils.equal_loudness_contours import (
+    equal_loudness_contours,
+)
 
 from mosqito.sq_metrics.tonality.prominence_ratio_ecma.pr_ecma_st import pr_ecma_st
 from mosqito.sq_metrics.tonality.prominence_ratio_ecma.pr_ecma_tv import pr_ecma_tv
@@ -20,18 +26,30 @@
 from mosqito.sq_metrics.tonality.tone_to_noise_ecma.tnr_ecma_freq import tnr_ecma_freq
 
 from mosqito.sq_metrics.roughness.roughness_dw.roughness_dw import roughness_dw
-from mosqito.sq_metrics.roughness.roughness_dw.roughness_dw_freq import roughness_dw_freq
+from mosqito.sq_metrics.roughness.roughness_dw.roughness_dw_freq import (
+    roughness_dw_freq,
+)
 
 
 from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_st import sharpness_din_st
 from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_tv import sharpness_din_tv
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import sharpness_din_from_loudness
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_perseg import sharpness_din_perseg
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_freq import sharpness_din_freq
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import (
+    sharpness_din_from_loudness,
+)
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_perseg import (
+    sharpness_din_perseg,
+)
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_freq import (
+    sharpness_din_freq,
+)
 
 from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi import sii_ansi
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_freq import sii_ansi_freq
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_level import sii_ansi_level
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_freq import (
+    sii_ansi_freq,
+)
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_level import (
+    sii_ansi_level,
+)
 
 from mosqito.sq_metrics.loudness.utils.sone_to_phon import sone_to_phon
 from mosqito.utils.isoclose import isoclose
@@ -40,11 +58,4 @@
 from mosqito.utils.time_segmentation import time_segmentation
 
 # Colors and linestyles
-COLORS = [
-    "#69c3c5",
-    "#ffd788",
-    "#ff8b88",
-    "#7894cf",
-    "#228080",
-    "#a8e2e2"
-]
+COLORS = ["#69c3c5", "#ffd788", "#ff8b88", "#7894cf", "#228080", "#a8e2e2"]
diff --git a/mosqito/sound_level_meter/freq_band_synthesis.py b/mosqito/sound_level_meter/freq_band_synthesis.py
index 48ee836f..983b0c54 100644
--- a/mosqito/sound_level_meter/freq_band_synthesis.py
+++ b/mosqito/sound_level_meter/freq_band_synthesis.py
@@ -1,14 +1,26 @@
 # -*- coding: utf-8 -*-
 
 # Standard library import
-from numpy import array, concatenate, zeros, log10, power, argmin, split, arange, interp, iscomplex
+from numpy import (
+    array,
+    concatenate,
+    zeros,
+    log10,
+    power,
+    argmin,
+    split,
+    arange,
+    interp,
+    iscomplex,
+)
+
 
 def freq_band_synthesis(spectrum, freqs, fmin, fmax):
     """Adapt input spectrum to frequency band levels
-    
+
     Convert the input spectrum to frequency band spectrum
     between "fmin" and "fmax".
-    
+
     Parameters
     ----------
     spectrum : numpy.ndarray
@@ -36,39 +48,37 @@ def freq_band_synthesis(spectrum, freqs, fmin, fmax):
         Corresponding preferred third octave band center frequencies, size (nbands).
     """
     if iscomplex(spectrum).any():
-        raise ValueError('Input spectrum must be in dB, no complex value allowed.')
-    
-    if (fmin.min() < freqs.min()):
-        print("[WARNING] Input spectrum minimum frequency if higher than fmin. Empty values will be filled with 0.")
+        raise ValueError("Input spectrum must be in dB, no complex value allowed.")
+
+    if fmin.min() < freqs.min():
+        print(
+            "[WARNING] Input spectrum minimum frequency if higher than fmin. Empty values will be filled with 0."
+        )
         df = freqs[1] - freqs[0]
-        spectrum = interp(arange(fmin.min(),fmax.max()+df, df), freqs, spectrum)
-        freqs = arange(fmin.min(),fmax.max()+df, df)
+        spectrum = interp(arange(fmin.min(), fmax.max() + df, df), freqs, spectrum)
+        freqs = arange(fmin.min(), fmax.max() + df, df)
 
-    if (fmax.max() > freqs.max()):
-        print("[WARNING] Input spectrum maximum frequency if lower than fmax. Empty values will be filled with 0.")
+    if fmax.max() > freqs.max():
+        print(
+            "[WARNING] Input spectrum maximum frequency if lower than fmax. Empty values will be filled with 0."
+        )
         df = freqs[1] - freqs[0]
-        spectrum = interp(arange(fmin.min(),fmax.max()+df, df), freqs, spectrum)
-        freqs = arange(fmin.min(),fmax.max()+df, df)
-    
+        spectrum = interp(arange(fmin.min(), fmax.max() + df, df), freqs, spectrum)
+        freqs = arange(fmin.min(), fmax.max() + df, df)
+
     # Find the lower and upper index of each band
-    idx_low = argmin(abs(freqs[:,None] - fmin), axis=0)
-    idx_up = argmin(abs(freqs[:,None] - fmax), axis=0)
+    idx_low = argmin(abs(freqs[:, None] - fmin), axis=0)
+    idx_up = argmin(abs(freqs[:, None] - fmax), axis=0)
     idx = concatenate((idx_low, [idx_up[-1]]))
-    
+
     # Split the given spectrum in several bands
     bands = array(split(spectrum, idx), dtype=object)[1:-1]
-    
+
     # Compute the bands level
     band_spectrum = zeros((len(bands)))
     i = 0
     for s in bands:
-        band_spectrum[i] = 10*log10(sum(power(10,s/10)))      
+        band_spectrum[i] = 10 * log10(sum(power(10, s / 10)))
         i += 1
 
-    return band_spectrum, (fmin+fmax)/2
-
-
-        
-
-
-
+    return band_spectrum, (fmin + fmax) / 2
diff --git a/mosqito/sound_level_meter/noct_spectrum/_center_freq.py b/mosqito/sound_level_meter/noct_spectrum/_center_freq.py
index cc3a1671..0839bcfb 100644
--- a/mosqito/sound_level_meter/noct_spectrum/_center_freq.py
+++ b/mosqito/sound_level_meter/noct_spectrum/_center_freq.py
@@ -40,7 +40,7 @@ def _center_freq(fmin, fmax, n=3, G=10, fr=1000):
     # determine band numbers
     b = 1 / n
     if G == 2:
-        U = 2 ** b  # ANSI eq2
+        U = 2**b  # ANSI eq2
     elif G == 10:
         U = 10 ** (3 * b / 10)  # ANSI eq4
     else:
@@ -48,14 +48,13 @@ def _center_freq(fmin, fmax, n=3, G=10, fr=1000):
             """ERROR: Only base 2 and base 10 are allowed for nth
             octave center frequency definition"""
         )
-    [kmin, kmax] = np.round(
-        np.log10(np.array([fmin, fmax]) / fr) / np.log10(U), 0)
+    [kmin, kmax] = np.round(np.log10(np.array([fmin, fmax]) / fr) / np.log10(U), 0)
 
     # Band numbers such that f_exact = fr for k=0
     k = np.arange(kmin, kmax + 1).astype(int)
 
     # compute ANSI eq1
-    f_exact = fr * U ** k
+    f_exact = fr * U**k
 
     ####
     # get normalized frequencies
diff --git a/mosqito/sound_level_meter/noct_spectrum/_filter_bandwidth.py b/mosqito/sound_level_meter/noct_spectrum/_filter_bandwidth.py
index 53c08164..82494470 100644
--- a/mosqito/sound_level_meter/noct_spectrum/_filter_bandwidth.py
+++ b/mosqito/sound_level_meter/noct_spectrum/_filter_bandwidth.py
@@ -57,7 +57,7 @@ def _filter_bandwidth(fc, n=3, N=3):
     # Design bandwidth quotient
     qd = (np.pi / 2 / N) / (np.sin(np.pi / 2 / N)) * qr  # ANSI eq9
     # Ratio of the upper and lower band-edge frequencies to the mid-band frequency
-    alpha = (1 + np.sqrt(1 + 4 * qd ** 2)) / 2 / qd
+    alpha = (1 + np.sqrt(1 + 4 * qd**2)) / 2 / qd
 
     return alpha, f1, f2
 
diff --git a/mosqito/sound_level_meter/noct_spectrum/_n_oct_freq_filter.py b/mosqito/sound_level_meter/noct_spectrum/_n_oct_freq_filter.py
index f349104e..6673e499 100644
--- a/mosqito/sound_level_meter/noct_spectrum/_n_oct_freq_filter.py
+++ b/mosqito/sound_level_meter/noct_spectrum/_n_oct_freq_filter.py
@@ -5,11 +5,12 @@
 import numpy as np
 from scipy.signal import butter, sosfreqz
 
-def _n_oct_freq_filter(spectrum, fs, fc, alpha, n=3):  
-    """ n-th octave filtering in frequency domain
+
+def _n_oct_freq_filter(spectrum, fs, fc, alpha, n=3):
+    """n-th octave filtering in frequency domain
 
     Designs a digital 1/3-octave filter with center frequency fc for
-    sampling frequency fs. 
+    sampling frequency fs.
 
     Parameters
     ----------
@@ -32,16 +33,16 @@ def _n_oct_freq_filter(spectrum, fs, fc, alpha, n=3):
     """
 
     # Normalized cutoff frequencies
-    w1 = fc / (fs  / 2) / alpha
-    w2 = fc / (fs  / 2) * alpha
+    w1 = fc / (fs / 2) / alpha
+    w2 = fc / (fs / 2) * alpha
 
     # Define filter coefficient
-    sos = butter(n, [w1, w2], "bandpass", analog=False, output ='sos')  
+    sos = butter(n, [w1, w2], "bandpass", analog=False, output="sos")
     # Get FRF and apply it
     w, h = sosfreqz(sos, worN=len(spectrum))
     spec_filt = np.multiply(h, spectrum.T).T
-    
+
     # Compute overall rms level
-    level = np.sqrt(np.sum(np.abs(spec_filt) ** 2, axis=0)) 
-        
+    level = np.sqrt(np.sum(np.abs(spec_filt) ** 2, axis=0))
+
     return level
diff --git a/mosqito/sound_level_meter/noct_spectrum/_n_oct_time_filter.py b/mosqito/sound_level_meter/noct_spectrum/_n_oct_time_filter.py
index 45773982..504bf172 100644
--- a/mosqito/sound_level_meter/noct_spectrum/_n_oct_time_filter.py
+++ b/mosqito/sound_level_meter/noct_spectrum/_n_oct_time_filter.py
@@ -59,13 +59,13 @@ def _n_oct_time_filter(sig, fs, fc, alpha, N=3):
     w2 = fc / (fs / 2) * alpha
 
     # define filter coefficient
-    sos = butter(int(N), (w1, w2), "bandpass", analog=False, output='sos')
+    sos = butter(int(N), (w1, w2), "bandpass", analog=False, output="sos")
 
     # filter signal
     sig_filt = sosfilt(sos, sig, axis=0)
 
     # Compute overall rms level
-    level = np.sqrt(np.mean(sig_filt ** 2, axis=0))
+    level = np.sqrt(np.mean(sig_filt**2, axis=0))
 
     return level
 
diff --git a/mosqito/sound_level_meter/noct_spectrum/noct_synthesis.py b/mosqito/sound_level_meter/noct_spectrum/noct_synthesis.py
index c4436bab..089c5639 100644
--- a/mosqito/sound_level_meter/noct_spectrum/noct_synthesis.py
+++ b/mosqito/sound_level_meter/noct_spectrum/noct_synthesis.py
@@ -6,12 +6,14 @@
 # Local application imports
 from mosqito.sound_level_meter.noct_spectrum._center_freq import _center_freq
 from mosqito.sound_level_meter.noct_spectrum._filter_bandwidth import _filter_bandwidth
-from mosqito.sound_level_meter.noct_spectrum._n_oct_freq_filter import _n_oct_freq_filter
+from mosqito.sound_level_meter.noct_spectrum._n_oct_freq_filter import (
+    _n_oct_freq_filter,
+)
 
 
 def noct_synthesis(spectrum, freqs, fmin, fmax, n=3, G=10, fr=1000):
     """Adapt input spectrum to nth-octave band spectrum
-    
+
     Convert the input spectrum to third-octave band spectrum
     between "fc_min" and "fc_max".
     Parameters
@@ -40,16 +42,16 @@ def noct_synthesis(spectrum, freqs, fmin, fmax, n=3, G=10, fr=1000):
     fpref : numpy.ndarray
         Corresponding preferred third octave band center frequencies, size (nbands).
     """
-    
+
     # Deduce sampling frequency
     fs = np.mean(freqs[1:] - freqs[:-1]) * 2 * len(spectrum)
 
     # Get filters center frequencies
     fc_vec, fpref = _center_freq(fmin=fmin, fmax=fmax, n=n, G=G, fr=fr)
-    
+
     # Compute the filters bandwidth
     alpha_vec, f_low, f_high = _filter_bandwidth(fc_vec, n=n)
-    
+
     # Delete ends frequencies to prevent aliasing
     idx = np.asarray(np.where(f_high > fs / 2))
     if any(idx[0]):
@@ -59,7 +61,7 @@ def noct_synthesis(spectrum, freqs, fmin, fmax, n=3, G=10, fr=1000):
 
     # Number of nth bands
     nband = len(fc_vec)
-    
+
     # Results array initialization
     if len(spectrum.shape) > 1:
         nseg = spectrum.shape[1]
diff --git a/mosqito/sound_level_meter/spectrum.py b/mosqito/sound_level_meter/spectrum.py
index 71248a0d..0a0da892 100644
--- a/mosqito/sound_level_meter/spectrum.py
+++ b/mosqito/sound_level_meter/spectrum.py
@@ -7,7 +7,7 @@
 from mosqito.utils.conversion import amp2db
 
 
-def spectrum(signal,fs, nfft='default', window='hanning', one_sided=True, db=True):
+def spectrum(signal, fs, nfft="default", window="hanning", one_sided=True, db=True):
     """
     Compute one-sided spectrum from a time signal in Pa.
 
@@ -28,41 +28,46 @@ def spectrum(signal,fs, nfft='default', window='hanning', one_sided=True, db=Tru
         Frequency axis.
 
     """
-    if len(signal.shape)>1:
+    if len(signal.shape) > 1:
         nseg = signal.shape[1]
     else:
         nseg = 1
-    
+
     # Number of points for the fft
-    if nfft == 'default':
+    if nfft == "default":
         if len(signal.shape) == 1:
             nfft = len(signal)
-        else :
+        else:
             nfft = signal.shape[0]
 
     # Window definition
-    if window == 'hanning':
+    if window == "hanning":
         window = np.hanning(nfft)
-    elif window == 'blackman':
+    elif window == "blackman":
         window = np.blackman(nfft)
-        
+
     # Amplitude correction
     window = window / np.sum(window)
-    
-    if len(signal.shape)>1:
-        window = np.tile(window,(nseg,1)).T
-    
+
+    if len(signal.shape) > 1:
+        window = np.tile(window, (nseg, 1)).T
+
     # Creation of the spectrum by FFT
     if one_sided == True:
-        spectrum = fft(signal * window, n=nfft, axis=0)[0:nfft//2] * 1.42
-        freq_axis = np.arange(1, nfft//2+1, 1) * (fs / nfft)
+        spectrum = fft(signal * window, n=nfft, axis=0)[0 : nfft // 2] * 1.42
+        freq_axis = np.arange(1, nfft // 2 + 1, 1) * (fs / nfft)
     else:
         spectrum = fft(signal * window, n=nfft, axis=0) * 1.42
-        freq_axis = np.concatenate((np.arange(1, nfft//2+1, 1) * (fs / nfft), np.arange(nfft//2+1, 1, -1) * (fs / nfft)))
+        freq_axis = np.concatenate(
+            (
+                np.arange(1, nfft // 2 + 1, 1) * (fs / nfft),
+                np.arange(nfft // 2 + 1, 1, -1) * (fs / nfft),
+            )
+        )
 
     if db == True:
         # Conversion into dB level
         module = np.abs(spectrum)
         spectrum = amp2db(module, ref=0.00002)
-    
-    return spectrum, freq_axis
\ No newline at end of file
+
+    return spectrum, freq_axis
diff --git a/mosqito/sq_metrics/__init__.py b/mosqito/sq_metrics/__init__.py
index b9af14fc..7fdef4b1 100644
--- a/mosqito/sq_metrics/__init__.py
+++ b/mosqito/sq_metrics/__init__.py
@@ -27,12 +27,22 @@
 
 from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_st import sharpness_din_st
 from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_tv import sharpness_din_tv
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import sharpness_din_from_loudness
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_perseg import sharpness_din_perseg
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_freq import sharpness_din_freq
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import (
+    sharpness_din_from_loudness,
+)
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_perseg import (
+    sharpness_din_perseg,
+)
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_freq import (
+    sharpness_din_freq,
+)
 
 from mosqito.sq_metrics.loudness.utils.sone_to_phon import sone_to_phon
 
 from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi import sii_ansi
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_freq import sii_ansi_freq
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_level import sii_ansi_level
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_freq import (
+    sii_ansi_freq,
+)
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi.sii_ansi_level import (
+    sii_ansi_level,
+)
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_auditory_filters_centre_freq.py b/mosqito/sq_metrics/loudness/loudness_ecma/_auditory_filters_centre_freq.py
index 95475ea8..aecc92b2 100644
--- a/mosqito/sq_metrics/loudness/loudness_ecma/_auditory_filters_centre_freq.py
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_auditory_filters_centre_freq.py
@@ -7,7 +7,7 @@ def _auditory_filters_centre_freq():
     Auditory filter bank center frequencies generation
 
     This function generates the Auditory filter bank center frequencies according
-    to ECMA-418-2 section 5.1.3.1 equation 6
+    to ECMA-418-2, 2nd Ed (2022), Section 5.1.4.1, equation 9
 
     Parameters
     ----------
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_band_pass_signals.py b/mosqito/sq_metrics/loudness/loudness_ecma/_band_pass_signals.py
new file mode 100644
index 00000000..1e99deef
--- /dev/null
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_band_pass_signals.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+from scipy.signal import sosfilt, lfilter
+
+from mosqito.sq_metrics.loudness.loudness_ecma._ear_filter_design import (
+    _ear_filter_design,
+)
+from mosqito.sq_metrics.loudness.loudness_ecma._auditory_filters_centre_freq import (
+    _auditory_filters_centre_freq,
+)
+from mosqito.sq_metrics.loudness.loudness_ecma._gammatone import _gammatone
+
+
+def _band_pass_signals(sig):
+    """Compute the band-pass signals as per Clause 5.1.3 to 5.1.4 of
+    ECMA-418-2, 2nd Ed. (2022).
+
+    Calculation of the band-pass signals along the 53 critical band rates
+    scale.
+
+    Parameters
+    ----------
+    signal: numpy.array
+        'Pa', time signal values. The sampling frequency of the signal must be 48000 Hz.
+
+    Returns
+    -------
+    block_bandpass_signals: list of numpy.array
+        Band-pass signals
+    """
+
+    # OUTER AND MIDDLE EAR FILTERING (5.1.3)
+    sos_ear = _ear_filter_design()
+    signal_filtered = sosfilt(sos_ear, sig, axis=0)
+
+    # AUDITORY FILTERING BANK (5.1.4)
+    # Order of the Outer and Middle ear filter
+    filter_order_k = 5
+    # Sampling frequency
+    fs = 48000
+
+    # Auditory filters centre frequencies
+    centre_freq = _auditory_filters_centre_freq()
+
+    block_bandpass_signals = []
+    for band_number in range(53):
+
+        bm_mod, am_mod = _gammatone(centre_freq[band_number], k=filter_order_k, fs=fs)
+        # Eq. (12)
+        band_pass_signal = 2.0 * lfilter(bm_mod, am_mod, signal_filtered, axis=0).real
+        block_bandpass_signals.append(band_pass_signal)
+
+    return block_bandpass_signals
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_ear_filter_design.py b/mosqito/sq_metrics/loudness/loudness_ecma/_ear_filter_design.py
index 1f3d2bc1..685c872d 100644
--- a/mosqito/sq_metrics/loudness/loudness_ecma/_ear_filter_design.py
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_ear_filter_design.py
@@ -3,8 +3,8 @@
 
 
 def _ear_filter_design():
-    """Return second-order filter coefficients of outer and middle/inner ear filter according to
-    ECMA-418-2:2020 section 5.1.2.
+    """Return second-order filter coefficients of outer and middle/inner ear
+    filter according to ECMA-418-2, 2nd Ed. (2022), Section 5.1.3.
 
     Parameters
     ----------
@@ -18,27 +18,29 @@ def _ear_filter_design():
 
     """
 
-    # Filer coefficients (ECMA-418-2:2020, Table 1)
+    # Filer coefficients (ECMA-418-2, 2nd Ed (2022) Table 1)
     filter_a = [
-        [1.0, -1.9253, 0.9380],
-        [1.0, -1.8061, 0.8354],
-        [1.0, -1.7636, 0.7832],
-        [1.0, -1.4347, 0.7276],
-        [1.0, -0.3661, -0.2841],
-        [1.0, -1.7960, 0.8058],
-        [1.0, -1.9124, 0.9142],
-        [1.0, 0.1623, 0.2842],
+        [1.0, -1.925299, 0.938014],
+        [1.0, -1.806088, 0.835382],
+        [1.0, -1.763632, 0.783160],
+        [1.0, -1.434650, 0.727599],
+        [1.0, -0.366092, -0.284120],
+        [1.0, -1.796003, 0.805838],
+        [1.0, -1.912434, 0.914161],
+        [1.0, 0.162320, 0.284244],
     ]
+
     filter_b = [
-        [1.0159, -1.9253, 0.9221],
-        [0.9589, -1.8061, 0.8764],
-        [0.9614, -1.7636, 0.8218],
-        [2.2258, -1.4347, -0.4982],
-        [0.4717, -0.3661, 0.2441],
-        [0.1153, 0.0000, -0.1153],
-        [0.9880, -1.9124, 0.9261],
-        [1.9522, 0.1623, -0.6680],
+        [1.015896, -1.925299, 0.922118],
+        [0.958943, -1.806088, 0.876439],
+        [0.961372, -1.763632, 0.821788],
+        [2.225804, -1.434650, -0.498204],
+        [0.471735, -0.366092, 0.244145],
+        [0.115267, 0.000000, -0.115267],
+        [0.988029, -1.912434, 0.926132],
+        [1.952238, 0.162320, -0.667994],
     ]
+
     sos_ear = column_stack((filter_b, filter_a))
 
     return sos_ear
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_ecma_time_segmentation.py b/mosqito/sq_metrics/loudness/loudness_ecma/_ecma_time_segmentation.py
new file mode 100644
index 00000000..b06cca5a
--- /dev/null
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_ecma_time_segmentation.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+
+from numpy import ones, ceil, linspace, arange, mean, int32
+
+
+def _ecma_time_segmentation(signal_block, sb, sh, n_new):
+    """Function used for the segmentation of a time signal into
+    smaller parts of audio (blocks) following Formulas 18 to 20 (section 5.1.5)
+    of ECMA-418-2:2022.
+
+    Parameters
+    ----------
+    signal_block: list
+        List of Numpy arrays containing bandpassed signals per critical band
+
+    sb: int or list of int
+        Block size, or list of block sizes per band
+
+    sh: int or list of int
+        Hop size, or list of hop sizes per band
+
+    n_new : int
+        Number of samples in signal after zero padding (Eq. 3)
+
+    Returns
+    -------
+    block_array: list
+        List of 53 two-dimensional arrays of size (nperseg, nseg)
+        containing the segmented signal per critical band.
+
+    time: list
+        List of  Numpy arrays of size (nseg,) containing the time axis
+        corresponding to each segmented signal
+    """
+
+    # Sampling frequency must be 48 kHz for ECMA-418-2 (2022)
+    fs = 48000
+
+    if isinstance(sb, int):
+        sb = sb * ones(53, dtype=int)
+    elif len(sb) != 53:
+        raise ValueError("ERROR: len(sb) shall be either 1 or 53")
+
+    if isinstance(sh, int):
+        sh = sh * ones(53, dtype=int)
+    elif len(sh) != 53:
+        raise ValueError("ERROR: len(sh) shall be either 1 or 53")
+
+    # Eq. (19)
+    i_start = sb[0] - sb
+    # Eq. (20) - number of blocks for each critical band
+    L_last = (ceil((n_new + sh) / sh) - 1).astype("int")
+
+    block_array = []
+    time_array = []
+
+    for z in range(53):
+
+        signal = signal_block[z]
+
+        # build time vector for signal
+        time = linspace(0, (signal.shape[0] - 1) / fs, signal.shape[0])
+
+        # Eq. (18)
+        L = arange(L_last[z])
+        idx = (
+            linspace(L * sh[z] + i_start[z], L * sh[z] + i_start[z] + sb[z], sb[z])
+            .astype(int32)
+            .T
+        )
+
+        block_array.append(signal[idx])
+        time_array.append(time[idx])
+
+    return block_array, time_array
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_gammatone.py b/mosqito/sq_metrics/loudness/loudness_ecma/_gammatone.py
index 044b19ee..34f79c58 100644
--- a/mosqito/sq_metrics/loudness/loudness_ecma/_gammatone.py
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_gammatone.py
@@ -1,31 +1,13 @@
-try:
-    import matplotlib.pyplot as plt
-except ImportError:
-    raise RuntimeError(
-        "In order to perform this validation you need the 'matplotlib' package."
-        )
-
 
 from scipy.special import comb
-from scipy.signal import freqz
-from numpy import (
-    abs as np_abs,
-    arange,
-    exp,
-    pi,
-    log10,
-    power as np_power,
-    sqrt,
-    insert as np_insert,
-    sum as np_sum,
-    array as np_array,
-)
-
-
-def _gammatone(freq, k=5, fs=48000, is_plot=False):
-    """ECMA-418-2 Gammatone filter design
-
-    This function computes the coefficients of a gammatone digital filter according to ECMA-418-2 section 5.1.3.
+import numpy as np
+
+
+def _gammatone(freq, k=5, fs=48000):
+    """ECMA-418-2:2022 Gammatone filter design
+
+    This function computes the coefficients of a gammatone digital filter
+    according to ECMA-418-2, 2nd Ed (2022), section 5.1.4.
 
     Parameters
     ----------
@@ -49,60 +31,35 @@ def _gammatone(freq, k=5, fs=48000, is_plot=False):
     af_f0 = 81.9289
     c = 0.1618
 
-    # Bandwidth (ECMA 418-2 equation 7)
-    delta_f = sqrt((af_f0 ** 2) + ((c * freq) ** 2))
+    # Bandwidth (ECMA 418-2:2022 equation 10)
+    delta_f = np.sqrt((af_f0**2) + ((c * freq) ** 2))
 
-    # Time constant, delay (ECMA 418-2 equation 5)
+    # Time constant, delay (ECMA 418-2:2022 equation 8)
     binom = comb(2 * k - 2, k - 1, exact=True)
     tau = (1 / (2 ** (2 * k - 1))) * binom * (1.0 / delta_f)
 
     # "d" coefficient
-    d = exp(-1 / (fs * tau))
-
-    # coeff am (ECMA 418-2 equation 11)
-    m = arange(5) + 1
-    am = np_power((-d), m) * comb(5, m)
-    am = np_insert(am, 0, 1)
-
-    # coeff bm (ECMA 418-2 equation 12)
-    em = np_array([0, 1, 11, 11, 1])
-    i = arange(4) + 1
-    denom = np_sum(em[i] * d ** i)
-    m = arange(5)
-    bm = ((1 - d) ** k) / denom * (d ** m) * em[m]
-
-    # band pass filter coefficients (ECMA 418-2 equation 13 & 14)
-    # [by modifying the filter ceofficients with a negative exponential,
+    d = np.exp(-1 / (fs * tau))
+
+    # coeff am (ECMA 418-2:2022 equation 14 - index 'm_' goes from 1 to k)
+    m_ = np.arange(5) + 1
+    am = np.power((-d), m_) * comb(5, m_)
+    am = np.insert(am, 0, 1)
+
+    # coeff bm (ECMA 418-2 equation 15 - index 'm' goes from 0 to k-1)
+    em = np.array([0, 1, 11, 11, 1])
+    i = np.arange(4) + 1
+    denom = np.sum(em[i] * d**i)
+    m = np.arange(5)
+    bm = ((1 - d) ** k) / denom * (d**m) * em[m]
+
+    # band pass filter coefficients (ECMA 418-2:2022 equation 16 & 17)
+    # [by modifying the filter cofficients with a positive exponential,
     # the filter is a low-pass filter instead of the expected bandpass
     # filter]
-    m = arange(6)
-    exponential = exp(-1j * 2 * pi * freq * m / fs)
+    m = np.arange(6)
+    exponential = np.exp(+1j * 2 * np.pi * freq * m / fs)
     am_prim_ecma = am * exponential
     bm_prim_ecma = bm * exponential[:-1]
 
-    # band pass filter coefficients (ECMA 418-2 from equation 13 & 14)
-    # [corrected to get a bandpass filter, to be validated]
-    m = arange(6)
-    exponential = exp(1j * 2 * pi * freq * m / fs)
-    am_prim = am * exponential
-    bm_prim = bm * exponential[:-1]
-
-    if is_plot:
-        w, h = freqz(bm, am, worN=round(fs / 2), fs=fs)
-        h_db = 20.0 * log10(np_abs(h))
-        plt.semilogx(w, h_db, label="am, bm from eq. 11 and 12")
-
-        w, h = freqz(bm_prim_ecma, am_prim_ecma, worN=round(fs / 2), fs=fs)
-        h_db = 20.0 * log10(np_abs(h))
-        plt.semilogx(w, h_db, label="am', bm' from eq. 13 and 14")
-
-        w, h = freqz(bm_prim, am_prim, worN=round(fs / 2), fs=fs)
-        h_db = 20.0 * log10(np_abs(h))
-        plt.semilogx(w, h_db, label="am', bm' with positive exp")
-
-        plt.xlabel("Frequency [Hz]")
-        plt.ylabel("Amplitude [dB]")
-        plt.grid(which="both", axis="both")
-        plt.legend()
-
-    return bm_prim, am_prim
\ No newline at end of file
+    return bm_prim_ecma, am_prim_ecma
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_loudness_ecma_data.py b/mosqito/sq_metrics/loudness/loudness_ecma/_loudness_ecma_data.py
index 9fb6e91f..566c9da4 100644
--- a/mosqito/sq_metrics/loudness/loudness_ecma/_loudness_ecma_data.py
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_loudness_ecma_data.py
@@ -54,4 +54,4 @@
     0.0398,
     0.0485,
     0.0622,
-]
\ No newline at end of file
+]
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_nonlinearity.py b/mosqito/sq_metrics/loudness/loudness_ecma/_nonlinearity.py
index 70c0bb74..b1b5adaf 100644
--- a/mosqito/sq_metrics/loudness/loudness_ecma/_nonlinearity.py
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_nonlinearity.py
@@ -1,9 +1,10 @@
-import numpy as np
+from numpy import array, ones
 
 
 def _nonlinearity(p):
     """Apply the compressive nonlinearity of the auditory system to the
-    rectified band pass signal rms values according to ECMA 418-2 section 5.1.7
+    rectified band pass signal rms values according to Equation (23) in
+    ECMA 418-2, 2nd Ed (2022), section 5.1.8.
 
     Parameters
     ----------
@@ -17,18 +18,22 @@ def _nonlinearity(p):
 
     """
     p_0 = 2e-5
-    # c_N: In sones/bark
-    c_N = 0.0217406
+
+    # c_N: In sone_HMS/bark
+    c_N = 0.0211668
+
     alpha = 1.50
-    v_i = np.array(
-        [1.0, 0.6602, 0.0864, 0.6384, 0.0328, 0.4068, 0.2082, 0.3994, 0.6434]
-    )
-    thresh = np.array([15.0, 25.0, 35.0, 45.0, 55.0, 65.0, 75.0, 85.0])
+
+    v_i = array([1.0, 0.6602, 0.0864, 0.6384, 0.0328, 0.4068, 0.2082, 0.3994, 0.6434])
+
+    thresh = array([0.0, 15.0, 25.0, 35.0, 45.0, 55.0, 65.0, 75.0, 85.0])
+
     p_ti = p_0 * 10 ** (thresh / 20)
 
-    a_prime = np.ones(p.shape)
-    for i in range(8):
-        a_prime *= (1 + (p / p_ti[i]) ** alpha) ** ((v_i[i + 1] - v_i[i]) / alpha)
+    a_prime = ones(p.shape)
+    for i in range(1, 9):
+        a_prime *= (1 + (p / p_ti[i]) ** alpha) ** ((v_i[i] - v_i[i - 1]) / alpha)
+
     a_prime *= c_N * p / p_0
 
-    return a_prime
\ No newline at end of file
+    return a_prime
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_preprocessing.py b/mosqito/sq_metrics/loudness/loudness_ecma/_preprocessing.py
new file mode 100644
index 00000000..ab43a983
--- /dev/null
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/_preprocessing.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+from numpy import pi, cos, arange, max, ceil, concatenate, zeros
+
+
+def _preprocessing(signal, sb, sh):
+    """
+    Performs windowing and zero-padding as described in Section 5.1.2 of
+    ECMA-418-2 (2nd Ed, 2022) standard for calculating Loudness.
+
+    Parameters
+    ----------
+    signal : (n_samples,)-shaped numpy.array
+        Array containing the sound signal samples, at sampling frequency 48 kHz
+
+    sb : int
+        Block size, in samples
+
+    sh : int
+        Hop size, in samples
+    """
+
+    n_samples = signal.shape[0]
+
+    # Apply windowing function to first 5 ms (240 samples)
+    n_fadein = 240
+    w_fadein = 0.5 - 0.5 * cos(pi * arange(n_fadein) / n_fadein)
+    signal[:240] *= w_fadein
+
+    # Calculate zero padding at start and end of signal
+    sb_max = max(sb)
+    sh_max = max(sh)
+
+    n_zeros_start = sb_max
+    n_new = sh_max * (ceil((n_samples + sh_max + sb_max) / (sh_max)) - 1)
+    n_zeros_end = int(n_new) - n_samples
+
+    signal = concatenate((zeros(n_zeros_start), signal, zeros(n_zeros_end)))
+
+    return signal, n_new
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/_rectified_band_pass_signals.py b/mosqito/sq_metrics/loudness/loudness_ecma/_rectified_band_pass_signals.py
deleted file mode 100644
index 004c56a7..00000000
--- a/mosqito/sq_metrics/loudness/loudness_ecma/_rectified_band_pass_signals.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import numpy as np
-import scipy.signal as sp_signal
-
-from mosqito.sq_metrics.loudness.loudness_ecma._ear_filter_design import (
-    _ear_filter_design,
-)
-from mosqito.sq_metrics.loudness.loudness_ecma._auditory_filters_centre_freq import (
-    _auditory_filters_centre_freq,
-)
-from mosqito.sq_metrics.loudness.loudness_ecma._gammatone import _gammatone
-from mosqito.utils import time_segmentation
-
-
-def _rectified_band_pass_signals(sig, sb=2048, sh=1024):
-    """Compute the rectified band-pass signals as per Clause 5.1.2 to 5.1.5 of
-    ECMA-418-2:2020
-
-    Calculation of the rectified band-pass signals along the 53 critical band rates
-    scale. Each band pass signal is segmented into time blocks according to sb and sh
-
-    Parameters
-    ----------
-    signal: numpy.array
-        'Pa', time signal values. The sampling frequency of the signal must be 48000 Hz.
-    sb: int or list of int
-        block size.
-    sh: int or list of int
-        Hop size.
-    Returns
-    -------
-    block_array_rect: list of numpy.array
-        rectified band-pass signals
-    """
-
-    if isinstance(sb, int):
-        sb = sb * np.ones(53, dtype=int)
-    elif len(sb) != 53:
-        raise ValueError("ERROR: len(sb) shall be either 1 or 53")
-    if isinstance(sh, int):
-        sh = sh * np.ones(53, dtype=int)
-    elif len(sh) != 53:
-        raise ValueError("ERROR: len(sh) shall be either 1 or 53")
-
-    # OUTER AND MIDDLE EAR FILTERING (5.1.2)
-
-    sos_ear = _ear_filter_design()
-    signal_filtered = sp_signal.sosfilt(sos_ear, sig, axis=0)
-
-    # AUDITORY FILTERING BANK (5.1.3)
-
-    # Order of the Outer and Middle ear filter
-    filter_order_k = 5
-    # Sampling frequency
-    fs = 48000.00
-    # Auditory filters centre frequencies
-    centre_freq = _auditory_filters_centre_freq()
-
-    block_array_rect = []
-    for band_number in range(53):
-        bm_mod, am_mod = _gammatone(centre_freq[band_number], k=filter_order_k, fs=fs)
-
-        band_pass_signal = (
-            2.0
-            * (
-                sp_signal.lfilter(
-                    bm_mod,
-                    am_mod,
-                    signal_filtered,
-                    axis=0,
-                )
-            ).real
-        )
-
-        # SEGMENTATION OF THE SIGNAL INTO BLOCKS (5.1.4)
-
-        # The segmentation of the signal is done in order to obtain results for intervals of time, not for the whole
-        # duration of the signal. The reason behind this decision resides in the fact that processing the signal in its
-        # full length at one time could end up in imprecise results. By using a "for loop", we are able to decompose the
-        # signal array "band_pass_signal_hr" into blocks. "sb_array" is the block size which changes depending on the
-        # "band_number" in which we are processing the signal. "sh_array" is the step size, the time shift to the next
-        # block.
-
-        block_array, _ = time_segmentation(
-            band_pass_signal, fs, sb[band_number], sh[band_number], is_ecma=True
-        )
-        block_array = block_array.T
-
-        # RECTIFICATION (5.1.5)
-
-        # This part acts as the activation of the auditory nerves when the basilar membrane vibrates in a certain
-        # direction. In order to rectify the signal we are using "np.clip" which establish a minimum and a maximum value
-        # for the signal. "a_min" is set to 0 float, while "a_max" is set to "None" in order to consider the positive
-        # value of the signal.
-
-        block_array_rect.append(np.clip(block_array, a_min=0.00, a_max=None))
-
-    return block_array_rect
\ No newline at end of file
diff --git a/mosqito/sq_metrics/loudness/loudness_ecma/loudness_ecma.py b/mosqito/sq_metrics/loudness/loudness_ecma/loudness_ecma.py
index 10285753..ea4b7470 100644
--- a/mosqito/sq_metrics/loudness/loudness_ecma/loudness_ecma.py
+++ b/mosqito/sq_metrics/loudness/loudness_ecma/loudness_ecma.py
@@ -1,22 +1,30 @@
 # -*- coding: utf-8 -*-
-"""
-@author: Daniel Jiménez-Caminero Costa
-"""
-import numpy as np
+
+from numpy import clip, sqrt, mean, array, linspace, sum, log10
 
 # Project Imports
-from mosqito.sq_metrics.loudness.loudness_ecma._rectified_band_pass_signals import (
-    _rectified_band_pass_signals,
+from mosqito.sq_metrics.loudness.loudness_ecma._band_pass_signals import (
+    _band_pass_signals,
+)
+
+from mosqito.sq_metrics.loudness.loudness_ecma._ecma_time_segmentation import (
+    _ecma_time_segmentation,
 )
+
 from mosqito.sq_metrics.loudness.loudness_ecma._nonlinearity import _nonlinearity
 
+from mosqito.sq_metrics.loudness.loudness_ecma._preprocessing import (
+    _preprocessing,
+)
+
 # Data import
 # Threshold in quiet
 from mosqito.sq_metrics.loudness.loudness_ecma._loudness_ecma_data import ltq_z
 
 
-def loudness_ecma(signal, sb=2048, sh=1024):
-    """Calculation of the specific and total loudness according to ECMA-418-2 section 5
+def loudness_ecma(signal, fs, sb=2048, sh=1024):
+    """Calculation of the specific and total loudness according to ECMA-418-2
+    (2nd Ed, 2022), Section 5.
 
     Parameters
     ----------
@@ -29,55 +37,62 @@ def loudness_ecma(signal, sb=2048, sh=1024):
 
     Returns
     -------
-    n_specific: list of numpy.array
-        Specific Loudness [sone_HMS per Bark]. Each of the 53 element of the list corresponds to the time-dependant
-        specific loudness for a given bark band. Can be a ragged array if a different sb/sh are used for each band.
-
-    bark_axis: numpy.array
-        Bark axis
+    N : float
+        Overall loudness representative value [sone_HMS].
+    N_time : numpy.ndarray
+        Loudness over time [sone_HMS], size (Ntime,).
+    N_specific : numpy.ndarray
+        Specific loudness [sone_HMS/bark], size (Nbark, Ntime).
+    bark_axis : numpy.ndarray
+        Corresponding bark axis, size (Nbark,).
+    time_axis : numpy.ndarray
+        Time axis, size (Ntime,).
 
     """
+    if fs != 48000:
+        print(
+            "[Warning] Signal resampled to 48 kHz fulfill the standard requirements and allow calculation."
+        )
+        from scipy.signal import resample
+
+        signal = resample(signal, int(48000 * len(signal) / fs))
+        fs = 48000
 
-    # TODO: return time axis (list or list of list)
-
-    # Computaton of rectified band-pass signals
-    # (section 5.1.2 to 5.1.5 of the standard)
-    block_array_rect = _rectified_band_pass_signals(signal, sb, sh)
-
-    # # sb and sh for Tonality
-    # z = np.linspace(0.5, 26.5, num=53, endpoint=True)
-    # sb = np.ones(53, dtype="int")
-    # sh = np.ones(53, dtype="int")
-    # sb[z <= 1.5] = 8192
-    # sh[z <= 1.5] = 2048
-    # sb[np.all([z >= 2, z <= 8], axis=0)] = 4096
-    # sh[np.all([z >= 2, z <= 8], axis=0)] = 1024
-    # sb[np.all([z >= 8.5, z <= 12.5], axis=0)] = 2048
-    # sh[np.all([z >= 8.5, z <= 12.5], axis=0)] = 512
-    # sb[z >= 13] = 1024
-    # sh[z >= 13] = 256
-
-    n_specific = []
+    # Windowing and zero-padding (5.1.2)
+    signal, n_new = _preprocessing(signal, sb, sh)
+
+    # Computaton of band-pass signals (5.1.3 to 5.1.4)
+    bandpass_signals = _band_pass_signals(signal)
+
+    # Segmentation into blocks (5.1.5)
+    block_array, time_array = _ecma_time_segmentation(bandpass_signals, sb, sh, n_new)
+
+    # Rectification (5.1.6)
+    block_array_rect = clip(block_array, a_min=0.00, a_max=None)
+
+    # Calculation of specific loudness (5.1.7 to 5.1.9)
+    N_spec = []
     for band_number in range(53):
-        # ROOT-MEAN-SQUARE (section 5.1.6)
-        # After the segmentation of the signal into blocks, root-mean square values of each block are calculated
-        # according to Formula 17.
-        rms_block_value = np.sqrt(
-            2 * np.mean(np.array(block_array_rect[band_number]) ** 2, axis=1)
+        # root mean square values (eq. 22)
+        rms_block_value = sqrt(
+            2 * mean(array(block_array_rect[band_number]) ** 2, axis=1)
         )
-
-        # NON-LINEARITY (section 5.1.7)
-        # This section covers the other part of the calculations needed to consider the non-linear transformation
-        # of sound pressure to specific loudness that does the the auditory system. After this point, the
-        # computation is done equally to every block in which we have divided our signal.
+        # non-linear transformation of sound pressure to specific loudness
         a_prime = _nonlinearity(rms_block_value)
-
-        # SPECIFIC LOUDNESS CONSIDERING THE THRESHOLD IN QUIET (section 5.1.8)
-        # The next calculation helps us obtain the result for the specific loudness - specific loudness with
-        # consideration of the lower threshold of hearing.
+        # specific loudness considering the lower threshold of hearing.
         a_prime[a_prime < ltq_z[band_number]] = ltq_z[band_number]
         N_prime = a_prime - ltq_z[band_number]
-        n_specific.append(N_prime)
+        N_spec.append(N_prime)
+
+    # Time dependent values (eq. 116)
+    delta_z = 0.5
+    N_time = sum(N_spec, axis=0) * delta_z
+
+    # Single-value loudness (eq. 117)
+    e = 1 / log10(2)
+    N = (mean(N_time**e)) ** (1 / e)
+
+    bark_axis = linspace(0.5, 26.5, num=53, endpoint=True)
+    time_axis = time_array[0][:, 0]
 
-    bark_axis = np.linspace(0.5, 26.5, num=53, endpoint=True)
-    return n_specific, bark_axis
+    return N, N_time, N_spec, bark_axis, time_axis
diff --git a/mosqito/sq_metrics/loudness/loudness_zwst/_calc_slopes.py b/mosqito/sq_metrics/loudness/loudness_zwst/_calc_slopes.py
index f226e706..1d0108cc 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwst/_calc_slopes.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwst/_calc_slopes.py
@@ -88,8 +88,7 @@ def _calc_slopes(nm):
 
     # From Ernesto Avedillo 13/feb/2022
     # Considering the original routine if ig > 7:ig = 7 until ig = 21 so I can append the last column until usl.shape = (18,21)
-    usl_reshaped = np.append(usl, np.tile(
-        usl[:, 7], 13).reshape(13, 18).T, axis=1)
+    usl_reshaped = np.append(usl, np.tile(usl[:, 7], 13).reshape(13, 18).T, axis=1)
 
     # For test, in case nm has only 1 col.
     len_1_nm = False
@@ -123,7 +122,7 @@ def _calc_slopes(nm):
     # N_specific[:zup_ea[0],:] = np.multiply(N_specific[:zup_ea[0],:] , nm[1])
     # I complete the rest of the matrix extending the array 21  to 240
     for i in np.arange(nm_wide - 1):
-        N_specific[zup_ea[i - 1]: zup_ea[i], :] = nm[i]
+        N_specific[zup_ea[i - 1] : zup_ea[i], :] = nm[i]
 
     N = np.zeros(data_length)
 
@@ -149,11 +148,11 @@ def _calc_slopes(nm):
     dz[1, :] = zup[1]
 
     for i in np.arange(nm_wide):
-        n2_array_specific[zup_ea[i - 1]: zup_ea[i], :] = nm[i]
-        dz_array_specific[zup_ea[i - 1]: zup_ea[i], :] = dz[i]
-        z2_array_specific[zup_ea[i - 1]: zup_ea[i], :] = zup_array_ea[i]
-        usl_array_specific[zup_ea[i - 1]: zup_ea[i], :] = usl_array[i]
-        rns_values_specific[zup_ea[i - 1]: zup_ea[i], :] = rns_values[i]
+        n2_array_specific[zup_ea[i - 1] : zup_ea[i], :] = nm[i]
+        dz_array_specific[zup_ea[i - 1] : zup_ea[i], :] = dz[i]
+        z2_array_specific[zup_ea[i - 1] : zup_ea[i], :] = zup_array_ea[i]
+        usl_array_specific[zup_ea[i - 1] : zup_ea[i], :] = usl_array[i]
+        rns_values_specific[zup_ea[i - 1] : zup_ea[i], :] = rns_values[i]
 
     j = 1
     n1_aux = np.zeros(data_length)
@@ -200,16 +199,14 @@ def _calc_slopes(nm):
 
             Max_rns_nm_Array = np.maximum(rns_values_specific[j - 1], nm[i])
             z2_array_specific[j, mask_n1_bigger_nm] = np.minimum(
-                np.divide(n1_aux - Max_rns_nm_Array,
-                          usl_array_specific[j]) + z1_aux,
+                np.divide(n1_aux - Max_rns_nm_Array, usl_array_specific[j]) + z1_aux,
                 zup[i],
             )[mask_n1_bigger_nm]
             dz_array_specific[j, mask_n1_bigger_nm] = (z2_array_specific[j] - z1_aux)[
                 mask_n1_bigger_nm
             ]
             n2_array_specific[j, mask_n1_bigger_nm] = (
-                n1_aux -
-                np.multiply(dz_array_specific[j], usl_array_specific[j])
+                n1_aux - np.multiply(dz_array_specific[j], usl_array_specific[j])
             )[mask_n1_bigger_nm]
 
             # Calculate N for all n1 > nm[i]
@@ -249,29 +246,24 @@ def _calc_slopes(nm):
                 )
                 if mask_z_bigger_z2.sum() > 0:
                     indexes = _get_rns_index(
-                        n2_array_specific[j,
-                                          mask_z_bigger_z2], rns, equal_too=True
+                        n2_array_specific[j, mask_z_bigger_z2], rns, equal_too=True
                     )
                     rns_values_specific[j, mask_z_bigger_z2] = rns[indexes]
                     usl_array_specific[j, mask_z_bigger_z2] = usl_reshaped[
                         indexes, i - 1
                     ]
                     # Save Copy de Z2 y N2
-                    n1_aux[mask_z_bigger_z2] = n2_array_specific[j,
-                                                                 mask_z_bigger_z2]
-                    z1_aux[mask_z_bigger_z2] = z2_array_specific[j,
-                                                                 mask_z_bigger_z2]
+                    n1_aux[mask_z_bigger_z2] = n2_array_specific[j, mask_z_bigger_z2]
+                    z1_aux[mask_z_bigger_z2] = z2_array_specific[j, mask_z_bigger_z2]
 
                     # Vuelvo al inicio del loop y reviso de nuevo que n2 sea menor que nm
                     # Vuelvo a calcular mask_n1_bigger_nm
                     # Para los valores de n1_aux<=nm[i]
                     mask_z_bigger_z2_1 = np.logical_and(
                         mask_z_bigger_z2,
-                        np.round(n1_aux, dec_compare) <= np.round(
-                            nm[i], dec_compare),
+                        np.round(n1_aux, dec_compare) <= np.round(nm[i], dec_compare),
                     )
-                    n2_array_specific[j, mask_z_bigger_z2_1] = nm[i,
-                                                                  mask_z_bigger_z2_1]
+                    n2_array_specific[j, mask_z_bigger_z2_1] = nm[i, mask_z_bigger_z2_1]
                     z2_array_specific[j, mask_z_bigger_z2_1] = zup[i]
                     dz_array_specific[j, mask_z_bigger_z2_1] = (
                         z2_array_specific[j] - z1_aux
@@ -284,14 +276,11 @@ def _calc_slopes(nm):
                     # For Values n1_aux>nm[i] after second loop
                     mask_z_bigger_z2_2 = np.logical_and(
                         mask_z_bigger_z2,
-                        np.round(n1_aux, dec_compare) > np.round(
-                            nm[i], dec_compare),
+                        np.round(n1_aux, dec_compare) > np.round(nm[i], dec_compare),
                     )
-                    Max_rns_nm_Array = np.maximum(
-                        rns_values_specific[j], nm[i])
+                    Max_rns_nm_Array = np.maximum(rns_values_specific[j], nm[i])
                     z2_array_specific[j, mask_z_bigger_z2_2] = np.minimum(
-                        np.divide(n1_aux - Max_rns_nm_Array,
-                                  usl_array_specific[j])
+                        np.divide(n1_aux - Max_rns_nm_Array, usl_array_specific[j])
                         + z1_aux,
                         zup[i],
                     )[mask_z_bigger_z2_2]
@@ -304,20 +293,16 @@ def _calc_slopes(nm):
                     )[mask_z_bigger_z2_2]
                     # Recalculate N
                     N[mask_z_bigger_z2_2] += (
-                        dz_array_specific[j] *
-                        (n1_aux + n2_array_specific[j]) / 2
+                        dz_array_specific[j] * (n1_aux + n2_array_specific[j]) / 2
                     )[mask_z_bigger_z2_2]
                     N_specific[j, mask_z_bigger_z2_2] = (
-                        n1_aux - np.multiply((z_array - z1_aux),
-                                             usl_array_specific[j])
+                        n1_aux - np.multiply((z_array - z1_aux), usl_array_specific[j])
                     )[mask_z_bigger_z2_2]
 
                     # For the rest of the values  Where z < z2 calculate N_Specific
-                    mask_z_rest = np.logical_xor(
-                        mask_z_bigger_z2, mask_n1_bigger_nm)
+                    mask_z_rest = np.logical_xor(mask_z_bigger_z2, mask_n1_bigger_nm)
                     N_specific[j, mask_z_rest] = (
-                        n1_aux - np.multiply((z_array - z1_aux),
-                                             usl_array_specific[j])
+                        n1_aux - np.multiply((z_array - z1_aux), usl_array_specific[j])
                     )[mask_z_rest]
                     z_array += 0.1
 
@@ -328,8 +313,7 @@ def _calc_slopes(nm):
 
                 else:
                     N_specific[j, mask_n1_bigger_nm] = (
-                        n1_aux - np.multiply((z_array - z1_aux),
-                                             usl_array_specific[j])
+                        n1_aux - np.multiply((z_array - z1_aux), usl_array_specific[j])
                     )[mask_n1_bigger_nm]
                     z_array += 0.1
 
@@ -345,8 +329,7 @@ def _calc_slopes(nm):
                 n2_array_specific[j, mask_z_bigger_z2], rns, equal_too=True
             )
             rns_values_specific[j, mask_z_bigger_z2] = rns[indexes]
-            usl_array_specific[j,
-                               mask_z_bigger_z2] = usl_reshaped[indexes, i - 1]
+            usl_array_specific[j, mask_z_bigger_z2] = usl_reshaped[indexes, i - 1]
 
     N[N < 0] = 0
     N[N <= 16] = np.floor(N[N <= 16] * 1000 + 0.5) / 1000
diff --git a/mosqito/sq_metrics/loudness/loudness_zwst/_main_loudness.py b/mosqito/sq_metrics/loudness/loudness_zwst/_main_loudness.py
index 9945d1c4..4a257000 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwst/_main_loudness.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwst/_main_loudness.py
@@ -1,8 +1,4 @@
 # -*- coding: utf-8 -*-
-"""
-@date Created on Thur Apr 30 2020
-@author martin_g for Eomys
-"""
 
 # Standard library imports
 import numpy as np
diff --git a/mosqito/sq_metrics/loudness/loudness_zwst/loudness_zwst_freq.py b/mosqito/sq_metrics/loudness/loudness_zwst/loudness_zwst_freq.py
index dfea7714..dd82c077 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwst/loudness_zwst_freq.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwst/loudness_zwst_freq.py
@@ -51,13 +51,17 @@ def loudness_zwst_freq(spectrum, freqs, field_type="free"):
     if len(spectrum.shape) == 1:
         if len(spectrum) != len(freqs):
             raise ValueError(
-                'Input spectrum and frequency axis do not have the same length')
+                "Input spectrum and frequency axis do not have the same length"
+            )
         if (freqs.max() < 24000) or (freqs.min() > 24):
-            print("[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
+            print(
+                "[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
             )
             df = freqs[1] - freqs[0]
-            spectrum = interp1d(freqs, spectrum, axis=0, bounds_error=False, fill_value=0)(linspace(0, 24000, int(24000//df)))
-            freqs = linspace(0, 24000, int(24000//df))
+            spectrum = interp1d(
+                freqs, spectrum, axis=0, bounds_error=False, fill_value=0
+            )(linspace(0, 24000, int(24000 // df)))
+            freqs = linspace(0, 24000, int(24000 // df))
     # 2D spectrum
     elif len(spectrum.shape) > 1:
         nseg = spectrum.shape[1]
@@ -65,25 +69,40 @@ def loudness_zwst_freq(spectrum, freqs, field_type="free"):
         if len(freqs.shape) > 1:
             if spectrum.shape != freqs.shape:
                 raise ValueError(
-                    'Input spectrum and frequency axis do not have the same shape.')
+                    "Input spectrum and frequency axis do not have the same shape."
+                )
             if (freqs.max() < 24000) or (freqs.min() > 24):
-                print("[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
+                print(
+                    "[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
                 )
                 df = diff(freqs, axis=0).min()
-                nperseg = int(24000//df)
-                spectrum = interp1d(freqs.ravel(), spectrum.ravel(), bounds_error=False, fill_value=0)(tile(linspace(0, 24000, nperseg), nseg)).reshape((nseg, nperseg)).T
-                freqs = tile(linspace(0, 24000, nperseg), (nseg, 1)).T   
+                nperseg = int(24000 // df)
+                spectrum = (
+                    interp1d(
+                        freqs.ravel(),
+                        spectrum.ravel(),
+                        bounds_error=False,
+                        fill_value=0,
+                    )(tile(linspace(0, 24000, nperseg), nseg))
+                    .reshape((nseg, nperseg))
+                    .T
+                )
+                freqs = tile(linspace(0, 24000, nperseg), (nseg, 1)).T
         # one frequency axis for all the segments
         elif len(freqs.shape) == 1:
             if spectrum.shape[0] != len(freqs):
                 raise ValueError(
-                    'Input spectra and frequency axis do not have the same length. "freqs" must have dim(nperseg) and "spectra" must have dim(nperseg,nseg).')
+                    'Input spectra and frequency axis do not have the same length. "freqs" must have dim(nperseg) and "spectra" must have dim(nperseg,nseg).'
+                )
             if (freqs.max() < 24000) or (freqs.min() > 24):
-                print("[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
+                print(
+                    "[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
                 )
                 df = freqs[1] - freqs[0]
-                nperseg = int(24000//df)
-                spectrum = interp1d(freqs, spectrum, axis=0, bounds_error=False, fill_value=0)(linspace(0, 24000, nperseg))
+                nperseg = int(24000 // df)
+                spectrum = interp1d(
+                    freqs, spectrum, axis=0, bounds_error=False, fill_value=0
+                )(linspace(0, 24000, nperseg))
                 freqs = tile(linspace(0, 24000, nperseg), (nseg, 1)).T
 
     # Compute third octave band spectrum
diff --git a/mosqito/sq_metrics/loudness/loudness_zwtv/_lowpass_intp.py b/mosqito/sq_metrics/loudness/loudness_zwtv/_lowpass_intp.py
index 6b479858..c342a73a 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwtv/_lowpass_intp.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwtv/_lowpass_intp.py
@@ -1,13 +1,10 @@
 # -*- coding: utf-8 -*-
-"""
-@date Created on Fri May 22 2020
-@author martin_g for Eomys
-"""
 
 # Standard library imports
 import math
 import numpy as np
-#Needed for the loudness_zwicker_lowpass_intp_ea function
+
+# Needed for the loudness_zwicker_lowpass_intp_ea function
 from scipy import signal
 
 
@@ -39,23 +36,23 @@ def _lowpass_intp(loudness, tau, sample_rate):
     y1 = 0
 
     delta = np.copy(loudness)
-    delta = np.roll(delta,-1)
-    delta [-1] = 0
-    delta = (delta - loudness) /  lp_iter
-    ui_delta = np.zeros(loudness.shape[0]*lp_iter).reshape(loudness.shape[0],lp_iter)
-    ui_delta [:,0] = loudness  
-    
-    #Create the array complete of deltas to apply the filter.
+    delta = np.roll(delta, -1)
+    delta[-1] = 0
+    delta = (delta - loudness) / lp_iter
+    ui_delta = np.zeros(loudness.shape[0] * lp_iter).reshape(loudness.shape[0], lp_iter)
+    ui_delta[:, 0] = loudness
+
+    # Create the array complete of deltas to apply the filter.
     for i_in in np.arange(1, lp_iter):
-        ui_delta [:,i_in] = delta + ui_delta [:,i_in-1]  
-    
+        ui_delta[:, i_in] = delta + ui_delta[:, i_in - 1]
+
     # Rechape into a vector.
-    ui_delta = ui_delta.reshape(lp_iter*num_samples)
+    ui_delta = ui_delta.reshape(lp_iter * num_samples)
 
     # Apply the filter.
-    ui_delta = signal.lfilter([b0], [1,-a1], ui_delta, axis=- 1, zi=None)
-    
+    ui_delta = signal.lfilter([b0], [1, -a1], ui_delta, axis=-1, zi=None)
+
     # Reshape again to recover the first col.
-    ui_delta = ui_delta.reshape(loudness.shape[0],lp_iter)
-    filt_loudness = ui_delta[:,0]
+    ui_delta = ui_delta.reshape(loudness.shape[0], lp_iter)
+    filt_loudness = ui_delta[:, 0]
     return filt_loudness
diff --git a/mosqito/sq_metrics/loudness/loudness_zwtv/_nonlinear_decay.py b/mosqito/sq_metrics/loudness/loudness_zwtv/_nonlinear_decay.py
index 3d976df6..0391aaba 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwtv/_nonlinear_decay.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwtv/_nonlinear_decay.py
@@ -1,8 +1,4 @@
 # -*- coding: utf-8 -*-
-"""
-@date Created on Fri May 22 2020
-@author martin_g for Eomys
-"""
 
 # Standard library imports
 import math
@@ -51,30 +47,37 @@ def _nl_loudness(core_loudness):
         math.exp(-delta_t / t_var),
     ]
     nl_lp = {"B": B}
-    #nl_lp["uo_last"] = 0
-    #nl_lp["u2_last"] = 0
+    # nl_lp["uo_last"] = 0
+    # nl_lp["u2_last"] = 0
 
-    delta = np.copy(core_loudness,)
+    delta = np.copy(
+        core_loudness,
+    )
     delta = np.roll(delta, -1, axis=1)
     delta[:, -1] = 0
-    delta = (delta - nl_loudness)/nl_iter
-    ui_delta = np.zeros(core_loudness.size*nl_iter).reshape(
-        core_loudness.shape[0], core_loudness.shape[1], nl_iter)
+    delta = (delta - nl_loudness) / nl_iter
+    ui_delta = np.zeros(core_loudness.size * nl_iter).reshape(
+        core_loudness.shape[0], core_loudness.shape[1], nl_iter
+    )
     ui_delta[:, :, 0] = core_loudness
 
     for i_in in np.arange(1, nl_iter):
-        ui_delta[:, :, i_in] = ui_delta[:, :, i_in-1] + delta
+        ui_delta[:, :, i_in] = ui_delta[:, :, i_in - 1] + delta
 
     ui_delta = ui_delta.reshape(
-        core_loudness.shape[0], core_loudness.shape[1]*nl_iter)
-    uo_mat = np.copy(ui_delta,)
+        core_loudness.shape[0], core_loudness.shape[1] * nl_iter
+    )
+    uo_mat = np.copy(
+        ui_delta,
+    )
     # create u2_mat (equivalent to u2 last) and fill the first col.
-    u2_mat = np.zeros(uo_mat.shape[0]*uo_mat.shape[1]
-                      ).reshape(uo_mat.shape[0], uo_mat.shape[1])
+    u2_mat = np.zeros(uo_mat.shape[0] * uo_mat.shape[1]).reshape(
+        uo_mat.shape[0], uo_mat.shape[1]
+    )
     mask = core_loudness[:, 0] >= 1e-5
-    u2_mat[mask, 0] = core_loudness[mask, 0]*(1 - nl_lp["B"][5])
+    u2_mat[mask, 0] = core_loudness[mask, 0] * (1 - nl_lp["B"][5])
 
-    '''
+    """
     Truth Table for u2 & uo
     u2 = nl_lp["uo_last"] * nl_lp["B"][0] - nl_lp["u2_last"] * nl_lp["B"][1]
     u2' = (nl_lp["u2_last"] - ui) * nl_lp["B"][5] + ui
@@ -91,35 +94,48 @@ def _nl_loudness(core_loudness):
         False                                                                False                  Truth        ui                                       u2=f(u2(j-1),B(5),ui(j)
         False                                                                False                  False        ui                                       u2=f(u2(j-1),B(5),ui(j)
  
-    '''
-    for col in np.arange(core_loudness.shape[1]*nl_iter):
-        uo2 = uo_mat[:, col-1] * nl_lp["B"][2] - \
-            u2_mat[:, col-1] * nl_lp["B"][3]
+    """
+    for col in np.arange(core_loudness.shape[1] * nl_iter):
+        uo2 = uo_mat[:, col - 1] * nl_lp["B"][2] - u2_mat[:, col - 1] * nl_lp["B"][3]
         mask = np.logical_and(
-            uo_mat[:, col-1] > u2_mat[:, col-1], uo2 >= ui_delta[:, col])
+            uo_mat[:, col - 1] > u2_mat[:, col - 1], uo2 >= ui_delta[:, col]
+        )
         uo_mat[mask, col] = uo2[mask]  # in case uo higher than ui
 
-        uo2 = uo_mat[:, col-1] * nl_lp["B"][4]
-        mask = np.logical_and(uo_mat[:, col-1] <=
-                              u2_mat[:, col-1], uo2 >= ui_delta[:, col])
+        uo2 = uo_mat[:, col - 1] * nl_lp["B"][4]
+        mask = np.logical_and(
+            uo_mat[:, col - 1] <= u2_mat[:, col - 1], uo2 >= ui_delta[:, col]
+        )
         uo_mat[mask, col] = uo2[mask]  # in case uo_2 higher than ui
 
         u2_mat[:, col] = uo_mat[:, col]  # higher than uo
-        u22 = uo_mat[:, col-1] * nl_lp["B"][0] - \
-            u2_mat[:, col-1] * nl_lp["B"][1]
-        mask = np.logical_and(np.logical_and(
-            ui_delta[:, col] < uo_mat[:, col-1], uo_mat[:, col-1] > u2_mat[:, col-1]), u22 <= uo_mat[:, col])
+        u22 = uo_mat[:, col - 1] * nl_lp["B"][0] - u2_mat[:, col - 1] * nl_lp["B"][1]
+        mask = np.logical_and(
+            np.logical_and(
+                ui_delta[:, col] < uo_mat[:, col - 1],
+                uo_mat[:, col - 1] > u2_mat[:, col - 1],
+            ),
+            u22 <= uo_mat[:, col],
+        )
         u2_mat[mask, col] = u22[mask]  # in case u22 lower than uo_last
 
-        u2_2 = (u2_mat[:, col-1] - ui_delta[:, col]) * \
-            nl_lp["B"][5] + ui_delta[:, col]
-        mask = np.logical_and(ui_delta[:, col] >= uo_mat[:, col-1], np.logical_not(np.logical_and(
-            abs(ui_delta[:, col] - uo_mat[:, col-1]) < 1e-5,  uo_mat[:, col] <= u2_mat[:, col-1])))
+        u2_2 = (u2_mat[:, col - 1] - ui_delta[:, col]) * nl_lp["B"][5] + ui_delta[
+            :, col
+        ]
+        mask = np.logical_and(
+            ui_delta[:, col] >= uo_mat[:, col - 1],
+            np.logical_not(
+                np.logical_and(
+                    abs(ui_delta[:, col] - uo_mat[:, col - 1]) < 1e-5,
+                    uo_mat[:, col] <= u2_mat[:, col - 1],
+                )
+            ),
+        )
         u2_mat[mask, col] = u2_2[mask]  # lower than ui
 
     nl_loudness = uo_mat.reshape(
-        core_loudness.shape[0], core_loudness.shape[1], nl_iter)[:, :, 0]
-    uo_mat = uo_mat.reshape(
-        core_loudness.shape[0], core_loudness.shape[1]*nl_iter)
+        core_loudness.shape[0], core_loudness.shape[1], nl_iter
+    )[:, :, 0]
+    uo_mat = uo_mat.reshape(core_loudness.shape[0], core_loudness.shape[1] * nl_iter)
 
     return nl_loudness
diff --git a/mosqito/sq_metrics/loudness/loudness_zwtv/_square_and_smooth.py b/mosqito/sq_metrics/loudness/loudness_zwtv/_square_and_smooth.py
index 2bf62387..4ca36a52 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwtv/_square_and_smooth.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwtv/_square_and_smooth.py
@@ -32,7 +32,7 @@ def _square_and_smooth(sig, center_freq, fs):
     else:
         tau = 2 / (3 * 1000)
     # Squaring
-    sig = sig ** 2
+    sig = sig**2
     # Three smoothing low-pass filters
     a1 = np.exp(-1 / (fs * tau))
     b0 = 1 - a1
diff --git a/mosqito/sq_metrics/loudness/loudness_zwtv/_temporal_weighting.py b/mosqito/sq_metrics/loudness/loudness_zwtv/_temporal_weighting.py
index 9ccddca0..47a485e7 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwtv/_temporal_weighting.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwtv/_temporal_weighting.py
@@ -29,9 +29,9 @@ def _temporal_weighting(loudness):
         Filtered loudness
     """
     sample_rate = 2000
-    tau = 3.5 * 10 ** -3
+    tau = 3.5 * 10**-3
     filt_loudness_1 = _lowpass_intp(loudness, tau, sample_rate)
-    tau = 70 * 10 ** -3
+    tau = 70 * 10**-3
     filt_loudness_2 = _lowpass_intp(loudness, tau, sample_rate)
 
     loudness = 0.47 * filt_loudness_1 + 0.53 * filt_loudness_2
diff --git a/mosqito/sq_metrics/loudness/loudness_zwtv/_third_octave_levels.py b/mosqito/sq_metrics/loudness/loudness_zwtv/_third_octave_levels.py
index 790edbb1..6cb785a0 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwtv/_third_octave_levels.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwtv/_third_octave_levels.py
@@ -266,10 +266,10 @@ def _third_octave_levels(sig, fs):
 
     third_octave_level = np.zeros((n_level_band, n_time))
     for i_bands in range(n_level_band):
-        
+
         # Initialisation
-        tiny_value = 10 ** -12
-        i_ref = 4 * 10 ** -10
+        tiny_value = 10**-12
+        i_ref = 4 * 10**-10
         # 2nd order fltering (See ISO 532-1 section 6.3 and A.2)
         coeff = third_octave_filter_ref - third_octave_filter[i_bands, :, :]
         sig_filt = filter_gain[i_bands] * signal.sosfilt(coeff, sig)
diff --git a/mosqito/sq_metrics/loudness/loudness_zwtv/loudness_zwtv.py b/mosqito/sq_metrics/loudness/loudness_zwtv/loudness_zwtv.py
index 6f9c7863..da1c5f3b 100644
--- a/mosqito/sq_metrics/loudness/loudness_zwtv/loudness_zwtv.py
+++ b/mosqito/sq_metrics/loudness/loudness_zwtv/loudness_zwtv.py
@@ -7,11 +7,15 @@
 from mosqito.sq_metrics.loudness.loudness_zwst._main_loudness import _main_loudness
 from mosqito.sq_metrics.loudness.loudness_zwst._calc_slopes import _calc_slopes
 from mosqito.sq_metrics.loudness.loudness_zwtv._nonlinear_decay import _nl_loudness
-from mosqito.sq_metrics.loudness.loudness_zwtv._temporal_weighting import _temporal_weighting
-from mosqito.sq_metrics.loudness.loudness_zwtv._third_octave_levels import _third_octave_levels
+from mosqito.sq_metrics.loudness.loudness_zwtv._temporal_weighting import (
+    _temporal_weighting,
+)
+from mosqito.sq_metrics.loudness.loudness_zwtv._third_octave_levels import (
+    _third_octave_levels,
+)
 
 
-def loudness_zwtv(signal, fs, field_type='free'):
+def loudness_zwtv(signal, fs, field_type="free"):
     """Calculate Zwicker-loudness for time-varying signals
     Calculate the acoustic loudness according to Zwicker method for
     time-varying signals.
@@ -31,7 +35,7 @@ def loudness_zwtv(signal, fs, field_type='free'):
         Sampling frequency.
     field_type : str
         Type of soundfield corresponding to signal ("free" by or "diffuse").
-        
+
     Outputs
     -------
     N : float
@@ -43,16 +47,17 @@ def loudness_zwtv(signal, fs, field_type='free'):
     time_axis : numpy.ndarray
         Time axis, size (Ntime,).
 
-    """        
+    """
 
     if fs < 48000:
-        print("[Warning] Signal resampled to 48 kHz to allow calculation. To fulfill the standard requirements fs should be >=48 kHz."
-             )
+        print(
+            "[Warning] Signal resampled to 48 kHz to allow calculation. To fulfill the standard requirements fs should be >=48 kHz."
+        )
         from scipy.signal import resample
+
         signal = resample(signal, int(48000 * len(signal) / fs))
         fs = 48000
 
-
     # Compute third octave band spectrum vs. time
     spec_third, time_axis, _ = _third_octave_levels(signal, fs)
 
diff --git a/mosqito/sq_metrics/loudness/utils/equal_loudness_contours.py b/mosqito/sq_metrics/loudness/utils/equal_loudness_contours.py
index 92574787..7e3ea19d 100644
--- a/mosqito/sq_metrics/loudness/utils/equal_loudness_contours.py
+++ b/mosqito/sq_metrics/loudness/utils/equal_loudness_contours.py
@@ -28,30 +28,151 @@ def equal_loudness_contours(phones):
         Frequencies in which the function computes the resulting 'SPL' values.
     """
     n_frequencies = 29
-    freq_array = np.array([20.0, 25.0, 31.5, 40.0, 50.0, 63.0, 80.0, 100.0, 125.0, 160.0, 200.0, 250.0, 315.0, 400.0,
-                           500.0, 630.0, 800.0, 1000.0, 1250.0, 1600.0, 2000.0, 2500.0, 3150.0, 4000.0, 5000.0, 6300.0,
-                           8000.0, 10000.0, 12500.0])
+    freq_array = np.array(
+        [
+            20.0,
+            25.0,
+            31.5,
+            40.0,
+            50.0,
+            63.0,
+            80.0,
+            100.0,
+            125.0,
+            160.0,
+            200.0,
+            250.0,
+            315.0,
+            400.0,
+            500.0,
+            630.0,
+            800.0,
+            1000.0,
+            1250.0,
+            1600.0,
+            2000.0,
+            2500.0,
+            3150.0,
+            4000.0,
+            5000.0,
+            6300.0,
+            8000.0,
+            10000.0,
+            12500.0,
+        ]
+    )
 
-    af = [0.532, 0.506, 0.480, 0.455, 0.432, 0.409, 0.387, 0.367, 0.349, 0.330, 0.315, 0.301, 0.288, 0.276, 0.267,
-          0.259, 0.253, 0.250, 0.246, 0.244, 0.243, 0.243, 0.243, 0.242, 0.242, 0.245, 0.254, 0.271, 0.301]
+    af = np.array(
+        [
+            0.532,
+            0.506,
+            0.480,
+            0.455,
+            0.432,
+            0.409,
+            0.387,
+            0.367,
+            0.349,
+            0.330,
+            0.315,
+            0.301,
+            0.288,
+            0.276,
+            0.267,
+            0.259,
+            0.253,
+            0.250,
+            0.246,
+            0.244,
+            0.243,
+            0.243,
+            0.243,
+            0.242,
+            0.242,
+            0.245,
+            0.254,
+            0.271,
+            0.301,
+        ]
+    )
 
-    Lu = [-31.6, -27.2, -23.0, -19.1, -15.9, -13.0, -10.3, -8.1, -6.2, -4.5, -3.1, -2.0, -1.1, -0.4, 0.0, 0.3, 0.5, 0.0,
-          -2.7, -4.1, -1.0, 1.7, 2.5, 1.2, -2.1, -7.1, -11.2, -10.7, -3.1]
+    Lu = np.array(
+        [
+            -31.6,
+            -27.2,
+            -23.0,
+            -19.1,
+            -15.9,
+            -13.0,
+            -10.3,
+            -8.1,
+            -6.2,
+            -4.5,
+            -3.1,
+            -2.0,
+            -1.1,
+            -0.4,
+            0.0,
+            0.3,
+            0.5,
+            0.0,
+            -2.7,
+            -4.1,
+            -1.0,
+            1.7,
+            2.5,
+            1.2,
+            -2.1,
+            -7.1,
+            -11.2,
+            -10.7,
+            -3.1,
+        ]
+    )
 
-    Tf = [78.5, 68.7, 59.5, 51.1, 44.0, 37.5, 31.5, 26.5, 22.1, 17.9, 14.4, 11.4, 8.6, 6.2, 4.4, 3.0, 2.2, 2.4, 3.5,
-          1.7, -1.3, -4.2, -6.0, -5.4, -1.5, 6.0, 12.6, 13.9, 12.3]
+    Tf = np.array(
+        [
+            78.5,
+            68.7,
+            59.5,
+            51.1,
+            44.0,
+            37.5,
+            31.5,
+            26.5,
+            22.1,
+            17.9,
+            14.4,
+            11.4,
+            8.6,
+            6.2,
+            4.4,
+            3.0,
+            2.2,
+            2.4,
+            3.5,
+            1.7,
+            -1.3,
+            -4.2,
+            -6.0,
+            -5.4,
+            -1.5,
+            6.0,
+            12.6,
+            13.9,
+            12.3,
+        ]
+    )
 
     # Ln = phones
     # Lp = SPL
     spl_array = np.zeros(n_frequencies, dtype=float)
 
     # Deriving sound pressure level from loudness level (iso226 sect 4.1). Ln = phones
-    # An upgrade of this section could be to do all the calculations in one run by using numpy functions
-    for i in range(n_frequencies):
-        # "Af" is the argument of the conversion formula
-        Af = (4.47 * (10 ** (-3))) * ((10 ** (0.025 * phones)) - 1.15) + \
-             ((0.4 * (10 ** (((Tf[i] + Lu[i]) / 10) - 9))) ** af[i])
+    Af = (4.47 * (10 ** (-3))) * ((10 ** (0.025 * phones)) - 1.15) + (
+        (0.4 * (10 ** (((Tf + Lu) / 10) - 9))) ** af
+    )
 
-        spl_array[i] = ((10. / af[i]) * np.log10(Af)) - Lu[i] + 94
+    spl_array = ((10.0 / af) * np.log10(Af)) - Lu + 94
 
     return spl_array, freq_array
diff --git a/mosqito/sq_metrics/loudness/utils/phone2spl.py b/mosqito/sq_metrics/loudness/utils/phone2spl.py
index 5362f9fe..1c20a7b9 100644
--- a/mosqito/sq_metrics/loudness/utils/phone2spl.py
+++ b/mosqito/sq_metrics/loudness/utils/phone2spl.py
@@ -7,7 +7,7 @@
 
 
 def phone2spl(phones, tf, af, lu):
-    """ Conversion from phones to Sound Pressure Level (dB SPL), based on the standard ISO/FDIS 226:2003.
+    """Conversion from phones to Sound Pressure Level (dB SPL), based on the standard ISO/FDIS 226:2003.
 
     Parameters
     ----------
@@ -30,9 +30,11 @@ def phone2spl(phones, tf, af, lu):
 
     """
     # "Af" is argument of the dB SPL conversion formula
-    Af = (4.47 * (10 ** (-3))) * ((10 ** (0.025 * phones)) - 1.15) + ((0.4 * (10 ** (((tf + lu) / 10) - 9))) ** af)
+    Af = (4.47 * (10 ** (-3))) * ((10 ** (0.025 * phones)) - 1.15) + (
+        (0.4 * (10 ** (((tf + lu) / 10) - 9))) ** af
+    )
 
     # Result of the phone value converted to dB SPL value
-    spl = ((10. / af) * np.log10(Af)) - lu + 94
+    spl = ((10.0 / af) * np.log10(Af)) - lu + 94
 
     return spl
diff --git a/mosqito/sq_metrics/loudness/utils/sone2phone.py b/mosqito/sq_metrics/loudness/utils/sone2phone.py
index 0616f36c..f3283e74 100644
--- a/mosqito/sq_metrics/loudness/utils/sone2phone.py
+++ b/mosqito/sq_metrics/loudness/utils/sone2phone.py
@@ -7,7 +7,7 @@
 
 
 def sone2phone(sones):
-    """ Conversion between sones and phones, based on the work done by Hugo Fastl and Eberhard Zwicker in the article
+    """Conversion between sones and phones, based on the work done by Hugo Fastl and Eberhard Zwicker in the article
     "Psychoacoustics: Facts and Models".
 
     Parameters
diff --git a/mosqito/sq_metrics/loudness/utils/sone_to_phon.py b/mosqito/sq_metrics/loudness/utils/sone_to_phon.py
index c8abfd1a..f5ec67df 100644
--- a/mosqito/sq_metrics/loudness/utils/sone_to_phon.py
+++ b/mosqito/sq_metrics/loudness/utils/sone_to_phon.py
@@ -27,7 +27,7 @@ def sone_to_phon(sone):
     """
 
     if sone < 1:
-        phon = 40 * sone ** 0.35
+        phon = 40 * sone**0.35
         if phon < 3:
             phon = 3
     else:
diff --git a/mosqito/sq_metrics/roughness/roughness_dw/_gzi_weighting.py b/mosqito/sq_metrics/roughness/roughness_dw/_gzi_weighting.py
index 12d0183e..763e4d69 100644
--- a/mosqito/sq_metrics/roughness/roughness_dw/_gzi_weighting.py
+++ b/mosqito/sq_metrics/roughness/roughness_dw/_gzi_weighting.py
@@ -9,7 +9,7 @@
 
 
 def _gzi_weighting(center_freq):
-    """ Weighting function for the specific roughness given by Aures """
+    """Weighting function for the specific roughness given by Aures"""
 
     gr_x = np.arange(0, 25, 1)
     gr_y = np.array(
diff --git a/mosqito/sq_metrics/roughness/roughness_dw/_roughness_dw_main_calc.py b/mosqito/sq_metrics/roughness/roughness_dw/_roughness_dw_main_calc.py
index 1b23c16f..df824e13 100644
--- a/mosqito/sq_metrics/roughness/roughness_dw/_roughness_dw_main_calc.py
+++ b/mosqito/sq_metrics/roughness/roughness_dw/_roughness_dw_main_calc.py
@@ -12,6 +12,7 @@
 )
 from mosqito.utils.conversion import freq2bark, db2amp, amp2db, bark2freq
 
+
 def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
     """
     Daniel and Weber roughness main calculation
@@ -41,13 +42,13 @@ def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
         )
 
     # convert spectrum to 2-sided
-    spec = np.concatenate((spec, spec[len(spec)::-1]))
+    spec = np.concatenate((spec, spec[len(spec) :: -1]))
 
     n = len(spec)
     # Frequency axis in Bark
     bark_axis = freq2bark(freq_axis)
     # Highest frequency
-    nZ = np.arange(1, n//2 + 1, 1)
+    nZ = np.arange(1, n // 2 + 1, 1)
 
     # Calculate Zwicker a0 factor (transfer characteristic of the outer and inner ear)
     a0 = np.zeros((n))
@@ -55,9 +56,9 @@ def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
     spec = a0 * spec
 
     # Conversion of the spec into dB
-    module = np.abs(spec[0:n//2])
+    module = np.abs(spec[0 : n // 2])
     spec_dB = amp2db(module, ref=2e-5)
-    
+
     # Find the audible components within the spec
     threshold = LTQ(bark_axis, reference="roughness")
     audible_index = np.where(spec_dB > threshold)[0]
@@ -74,7 +75,9 @@ def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
     # upper slope [dB/Bark]
     for k in np.arange(0, n_aud, 1):
         s2[k] = min(
-            -24 - (230 / freq_axis[audible_index[k]]) + (0.2 * spec_dB[audible_index[k]]),
+            -24
+            - (230 / freq_axis[audible_index[k]])
+            + (0.2 * spec_dB[audible_index[k]]),
             0,
         )
 
@@ -86,7 +89,7 @@ def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
     zb = bark2freq(zi) * n / fs
     # Minimum excitation level
     minExcitDB = np.interp(zb, nZ, threshold)
-    
+
     ch_low = np.zeros((n_aud))
     ch_high = np.zeros((n_aud))
     for i in np.arange(0, n_aud):
@@ -188,6 +191,3 @@ def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
     R = 0.25 * sum(R_spec)
 
     return R, R_spec, zi
-
-
-
diff --git a/mosqito/sq_metrics/roughness/roughness_dw/roughness_dw_freq.py b/mosqito/sq_metrics/roughness/roughness_dw/roughness_dw_freq.py
index 8b3f4776..7ab8765c 100644
--- a/mosqito/sq_metrics/roughness/roughness_dw/roughness_dw_freq.py
+++ b/mosqito/sq_metrics/roughness/roughness_dw/roughness_dw_freq.py
@@ -4,7 +4,9 @@
 import numpy as np
 
 # Local imports
-from mosqito.sq_metrics.roughness.roughness_dw._roughness_dw_main_calc import _roughness_dw_main_calc
+from mosqito.sq_metrics.roughness.roughness_dw._roughness_dw_main_calc import (
+    _roughness_dw_main_calc,
+)
 from mosqito.sq_metrics.roughness.roughness_dw._gzi_weighting import _gzi_weighting
 from mosqito.sq_metrics.roughness.roughness_dw._H_weighting import _H_weighting
 
@@ -38,12 +40,12 @@ def roughness_dw_freq(spectrum, freqs):
 
     # Check input size coherence
     if len(spectrum) != len(freqs):
-        raise ValueError(
-            'Input spectrum and frequency axis must have the same size !')
+        raise ValueError("Input spectrum and frequency axis must have the same size !")
 
     if spectrum.any() < 0:
         raise ValueError(
-            'Input must be an amplitude spectrum (use np.abs() or complex spectrum).')
+            "Input must be an amplitude spectrum (use np.abs() or complex spectrum)."
+        )
 
     # 1D spectrum
     if len(spectrum.shape) == 1:
@@ -64,7 +66,7 @@ def roughness_dw_freq(spectrum, freqs):
             freqs = np.tile(freqs, (nseg, 1)).T
 
     # Initialization of the weighting functions H and g
-    hWeight = _H_weighting(2*nperseg, fs)
+    hWeight = _H_weighting(2 * nperseg, fs)
     # Aures modulation depth weighting function
     gzi = _gzi_weighting(np.arange(1, 48, 1) / 2)
 
@@ -74,9 +76,11 @@ def roughness_dw_freq(spectrum, freqs):
     if len(spectrum.shape) > 1:
         for i in range(nseg):
             R[i], R_spec[:, i], bark_axis = _roughness_dw_main_calc(
-                spectrum[:, i], freqs[:, i], fs, gzi, hWeight)
+                spectrum[:, i], freqs[:, i], fs, gzi, hWeight
+            )
     else:
         R, R_spec, bark_axis = _roughness_dw_main_calc(
-            spectrum, freqs, fs, gzi, hWeight)
+            spectrum, freqs, fs, gzi, hWeight
+        )
 
     return R, R_spec, bark_axis
diff --git a/mosqito/sq_metrics/sharpness/sharpness_din/_weighting_fastl.py b/mosqito/sq_metrics/sharpness/sharpness_din/_weighting_fastl.py
index 88ce1f8c..500768d3 100644
--- a/mosqito/sq_metrics/sharpness/sharpness_din/_weighting_fastl.py
+++ b/mosqito/sq_metrics/sharpness/sharpness_din/_weighting_fastl.py
@@ -111,4 +111,4 @@
         3.7125149,
         3.9385738,
     ]
-)
\ No newline at end of file
+)
diff --git a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_freq.py b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_freq.py
index b73a9dd6..dc5d89d4 100644
--- a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_freq.py
+++ b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_freq.py
@@ -3,11 +3,14 @@
 
 # Local imports
 from mosqito.sq_metrics import loudness_zwst_freq
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import sharpness_din_from_loudness
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import (
+    sharpness_din_from_loudness,
+)
 
 from numpy import arange, linspace, tile, diff
 from scipy.interpolate import interp1d
 
+
 def sharpness_din_freq(spectrum, freqs, weighting="din", field_type="free"):
     """Acoustic sharpness calculation according to different methods
       (Aures, Von Bismarck, DIN 45692, Fastl) from a complex spectrum.
@@ -39,13 +42,17 @@ def sharpness_din_freq(spectrum, freqs, weighting="din", field_type="free"):
     if len(spectrum.shape) == 1:
         if len(spectrum) != len(freqs):
             raise ValueError(
-                'Input spectrum and frequency axis do not have the same length')
+                "Input spectrum and frequency axis do not have the same length"
+            )
         if (freqs.max() < 24000) or (freqs.min() > 24):
-            print("[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
+            print(
+                "[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
             )
             df = freqs[1] - freqs[0]
-            spectrum = interp1d(freqs, spectrum, axis=0, bounds_error=False, fill_value=0)(linspace(0, 24000, int(24000//df)))
-            freqs = linspace(0, 24000, int(24000//df))
+            spectrum = interp1d(
+                freqs, spectrum, axis=0, bounds_error=False, fill_value=0
+            )(linspace(0, 24000, int(24000 // df)))
+            freqs = linspace(0, 24000, int(24000 // df))
     # 2D spectrum
     elif len(spectrum.shape) > 1:
         nseg = spectrum.shape[1]
@@ -53,33 +60,46 @@ def sharpness_din_freq(spectrum, freqs, weighting="din", field_type="free"):
         if len(freqs.shape) > 1:
             if spectrum.shape != freqs.shape:
                 raise ValueError(
-                    'Input spectrum and frequency axis do not have the same shape.')
+                    "Input spectrum and frequency axis do not have the same shape."
+                )
             if (freqs.max() < 24000) or (freqs.min() > 24):
-                print("[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
+                print(
+                    "[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
                 )
                 df = diff(freqs, axis=0).min()
-                nperseg = int(24000//df)
-                spectrum = interp1d(freqs.ravel(), spectrum.ravel(), bounds_error=False, fill_value=0)(tile(linspace(0, 24000, nperseg), nseg)).reshape((nseg, nperseg)).T
-                freqs = tile(linspace(0, 24000, nperseg), (nseg, 1)).T   
+                nperseg = int(24000 // df)
+                spectrum = (
+                    interp1d(
+                        freqs.ravel(),
+                        spectrum.ravel(),
+                        bounds_error=False,
+                        fill_value=0,
+                    )(tile(linspace(0, 24000, nperseg), nseg))
+                    .reshape((nseg, nperseg))
+                    .T
+                )
+                freqs = tile(linspace(0, 24000, nperseg), (nseg, 1)).T
         # one frequency axis for all the segments
         elif len(freqs.shape) == 1:
             if spectrum.shape[0] != len(freqs):
                 raise ValueError(
-                    'Input spectra and frequency axis do not have the same length. "freqs" must have dim(nperseg) and "spectra" must have dim(nperseg,nseg).')
+                    'Input spectra and frequency axis do not have the same length. "freqs" must have dim(nperseg) and "spectra" must have dim(nperseg,nseg).'
+                )
             if (freqs.max() < 24000) or (freqs.min() > 24):
-                print("[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
+                print(
+                    "[WARNING] freqs argument is not wide enough to cover the full audio range. Missing frequency bands will be filled with 0. To fulfill the standard requirements, the frequency axis should go from 24Hz up to 24 kHz."
                 )
                 df = freqs[1] - freqs[0]
-                nperseg = int(24000//df)
-                spectrum = interp1d(freqs, spectrum, axis=0, bounds_error=False, fill_value=0)(linspace(0, 24000, nperseg))
+                nperseg = int(24000 // df)
+                spectrum = interp1d(
+                    freqs, spectrum, axis=0, bounds_error=False, fill_value=0
+                )(linspace(0, 24000, nperseg))
                 freqs = tile(linspace(0, 24000, nperseg), (nseg, 1)).T
     # Compute loudness
-    N, N_specific, _ = loudness_zwst_freq(
-        spectrum, freqs, field_type=field_type)
+    N, N_specific, _ = loudness_zwst_freq(spectrum, freqs, field_type=field_type)
 
     if len(spectrum.shape) > 1:
-        raise ValueError(
-            "With a 2D spectrum use 'sharpness_din_perseg' calculation.")
+        raise ValueError("With a 2D spectrum use 'sharpness_din_perseg' calculation.")
 
     # Compute sharpness from loudness
     S = sharpness_din_from_loudness(N, N_specific, weighting=weighting)
diff --git a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_from_loudness.py b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_from_loudness.py
index 7891c8d7..31403ea8 100644
--- a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_from_loudness.py
+++ b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_from_loudness.py
@@ -55,12 +55,12 @@ def sharpness_din_from_loudness(N, N_specific, weighting="din", skip=0):
         g = np.interp(z, x, y)
     else:
         raise ValueError(
-            "ERROR: weighting must be 'din', 'aures', 'bismarck' or 'fastl'")
+            "ERROR: weighting must be 'din', 'aures', 'bismarck' or 'fastl'"
+        )
 
     # S = np.zeros(N.shape)
     # ind = np.where(N >= 0.1)[1]
-    S = 0.11 * np.sum(N_specific * g *
-                      z * 0.1, axis=0) / N
+    S = 0.11 * np.sum(N_specific * g * z * 0.1, axis=0) / N
 
     if S.size == 1:
         S = float(S)
diff --git a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_st.py b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_st.py
index afe6e843..ac2bceea 100644
--- a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_st.py
+++ b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_st.py
@@ -2,7 +2,9 @@
 
 # Local imports
 from mosqito.sq_metrics import loudness_zwst
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import sharpness_din_from_loudness
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import (
+    sharpness_din_from_loudness,
+)
 
 
 def sharpness_din_st(signal, fs, weighting="din", field_type="free"):
@@ -30,9 +32,11 @@ def sharpness_din_st(signal, fs, weighting="din", field_type="free"):
     """
 
     if fs < 48000:
-        print("[Warning] Signal resampled to 48 kHz to allow calculation. To fulfill the standard requirements fs should be >=48 kHz."
-             )
+        print(
+            "[Warning] Signal resampled to 48 kHz to allow calculation. To fulfill the standard requirements fs should be >=48 kHz."
+        )
         from scipy.signal import resample
+
         signal = resample(signal, int(48000 * len(signal) / fs))
         fs = 48000
 
diff --git a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_tv.py b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_tv.py
index f008903d..217e41bb 100644
--- a/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_tv.py
+++ b/mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_tv.py
@@ -5,7 +5,9 @@
 
 # Local imports
 from mosqito.sq_metrics import loudness_zwtv
-from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import sharpness_din_from_loudness
+from mosqito.sq_metrics.sharpness.sharpness_din.sharpness_din_from_loudness import (
+    sharpness_din_from_loudness,
+)
 
 
 def sharpness_din_tv(signal, fs, weighting="din", field_type="free", skip=0):
@@ -15,7 +17,7 @@ def sharpness_din_tv(signal, fs, weighting="din", field_type="free", skip=0):
     Parameters:
     ----------
     signal : numpy.array
-        A time signal values [Pa], size (Ntime,) 
+        A time signal values [Pa], size (Ntime,)
     fs : integer
         Sampling frequency.
     weighting : string
@@ -36,21 +38,24 @@ def sharpness_din_tv(signal, fs, weighting="din", field_type="free", skip=0):
 
     """
     if fs < 48000:
-        print("[Warning] Signal resampled to 48 kHz to allow calculation. To fulfill the standard requirements fs should be >=48 kHz."
-             )
+        print(
+            "[Warning] Signal resampled to 48 kHz to allow calculation. To fulfill the standard requirements fs should be >=48 kHz."
+        )
         from scipy.signal import resample
+
         signal = resample(signal, int(48000 * len(signal) / fs))
         fs = 48000
 
     if skip == 0:
-        print("[Warning] when computing sharpness from time-varying loudness, a transient effect appears on the first points. To cut it, use 'skip='")
+        print(
+            "[Warning] when computing sharpness from time-varying loudness, a transient effect appears on the first points. To cut it, use 'skip='"
+        )
 
     # Compute loudness
     N, N_specific, _, time_axis = loudness_zwtv(signal, fs)
 
     # Compute sharpness from loudness
-    S = sharpness_din_from_loudness(
-        N, N_specific, weighting=weighting, skip=0)
+    S = sharpness_din_from_loudness(N, N_specific, weighting=weighting, skip=0)
 
     # Cut transient effect
     cut_index = np.argmin(np.abs(time_axis - skip))
diff --git a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_band_procedure_data.py b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_band_procedure_data.py
index 6681d347..648cd36b 100644
--- a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_band_procedure_data.py
+++ b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_band_procedure_data.py
@@ -1,7 +1,8 @@
 from numpy import array
 
+
 def _get_critical_band_data():
-    """ See § 3.4 of the standard ANSI S3.5. """
+    """See § 3.4 of the standard ANSI S3.5."""
     CENTER_FREQUENCIES = array(
         [
             150,
@@ -24,7 +25,7 @@ def _get_critical_band_data():
             4800,
             5800,
             7000,
-            8500
+            8500,
         ]
     )
 
@@ -50,7 +51,7 @@ def _get_critical_band_data():
             4400,
             5300,
             6400,
-            7700
+            7700,
         ]
     )
 
@@ -76,10 +77,10 @@ def _get_critical_band_data():
             5300,
             6400,
             7700,
-            9500
+            9500,
         ]
     )
-    
+
     IMPORTANCE = array(
         [
             0.0103,
@@ -102,10 +103,10 @@ def _get_critical_band_data():
             0.0460,
             0.0343,
             0.0226,
-            0.0110
+            0.0110,
         ]
     )
-    
+
     STANDARD_SPEECH_SPECTRUM_NORMAL = array(
         [
             31.44,
@@ -128,7 +129,7 @@ def _get_critical_band_data():
             5.84,
             3.47,
             1.78,
-            -0.14
+            -0.14,
         ]
     )
 
@@ -154,123 +155,131 @@ def _get_critical_band_data():
             -24.20,
             -19.00,
             -11.70,
-            -6.00
+            -6.00,
         ]
     )
 
     FREEFIELD2EARDRUM_TRANSFER_FUNCTION = array(
         [
-        0.60,
-        1.00,
-        1.40,
-        1.40,
-        1.90,
-        2.80,
-        3.00,
-        2.60,
-        2.60,
-        3.60,
-        6.10,
-        10.50,
-        13.80,
-        16.80,
-        15.80,
-        14.90,
-        14.30,
-        12.40,
-        7.90,
-        4.30,
-        0.50
+            0.60,
+            1.00,
+            1.40,
+            1.40,
+            1.90,
+            2.80,
+            3.00,
+            2.60,
+            2.60,
+            3.60,
+            6.10,
+            10.50,
+            13.80,
+            16.80,
+            15.80,
+            14.90,
+            14.30,
+            12.40,
+            7.90,
+            4.30,
+            0.50,
         ]
     )
-    return CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL
+    return (
+        CENTER_FREQUENCIES,
+        LOWER_FREQUENCIES,
+        UPPER_FREQUENCIES,
+        IMPORTANCE,
+        REFERENCE_INTERNAL_NOISE_SPECTRUM,
+        STANDARD_SPEECH_SPECTRUM_NORMAL,
+    )
+
 
 def _get_equal_critical_band_data():
     CENTER_FREQUENCIES = array(
         [
-        350,
-        450,
-        570,
-        700,
-        840,
-        1000,
-        1170,
-        1370,
-        1600,
-        1850,
-        2150,
-        2500,
-        2900,
-        3400,
-        4000,
-        4800,
-        5800,
+            350,
+            450,
+            570,
+            700,
+            840,
+            1000,
+            1170,
+            1370,
+            1600,
+            1850,
+            2150,
+            2500,
+            2900,
+            3400,
+            4000,
+            4800,
+            5800,
         ]
     )
 
     LOWER_FREQUENCIES = array(
         [
-        300,
-        400,
-        510,
-        630,
-        770,
-        920,
-        1080,
-        1270,
-        1480,
-        1720,
-        2000,
-        2320,
-        2700,
-        3150,
-        3700,
-        4400,
-        5300,
+            300,
+            400,
+            510,
+            630,
+            770,
+            920,
+            1080,
+            1270,
+            1480,
+            1720,
+            2000,
+            2320,
+            2700,
+            3150,
+            3700,
+            4400,
+            5300,
         ]
     )
 
     UPPER_FREQUENCIES = array(
         [
-        400,
-        510,
-        630,
-        770,
-        920,
-        1080,
-        1270,
-        1480,
-        1720,
-        2000,
-        2320,
-        2700,
-        3150,
-        3700,
-        4400,
-        5300,
-        6400
+            400,
+            510,
+            630,
+            770,
+            920,
+            1080,
+            1270,
+            1480,
+            1720,
+            2000,
+            2320,
+            2700,
+            3150,
+            3700,
+            4400,
+            5300,
+            6400,
         ]
     )
 
     IMPORTANCE = array(
         [
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
-        0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
+            0.0588,
         ]
     )
 
@@ -296,7 +305,6 @@ def _get_equal_critical_band_data():
         ]
     )
 
-
     REFERENCE_INTERNAL_NOISE_SPECTRUM = array(
         [
             -7.20,
@@ -321,299 +329,290 @@ def _get_equal_critical_band_data():
 
     FREEFIELD2EARDRUM_TRANSFER_FUNCTION = array(
         [
-        1.40,
-        1.40,
-        1.90,
-        2.80,
-        3.00,
-        2.60,
-        2.60,
-        3.60,
-        6.10,
-        10.50,
-        13.80,
-        16.80,
-        15.80,
-        14.90,
-        14.30,
-        12.40,
-        7.90,
+            1.40,
+            1.40,
+            1.90,
+            2.80,
+            3.00,
+            2.60,
+            2.60,
+            3.60,
+            6.10,
+            10.50,
+            13.80,
+            16.80,
+            15.80,
+            14.90,
+            14.30,
+            12.40,
+            7.90,
         ]
     )
-    return CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL
+    return (
+        CENTER_FREQUENCIES,
+        LOWER_FREQUENCIES,
+        UPPER_FREQUENCIES,
+        IMPORTANCE,
+        REFERENCE_INTERNAL_NOISE_SPECTRUM,
+        STANDARD_SPEECH_SPECTRUM_NORMAL,
+    )
+
 
 def _get_octave_band_data():
     CENTER_FREQUENCIES = array(
         [
-        250,
-        500,
-        1000,
-        2000,
-        4000,
-        8000,
+            250,
+            500,
+            1000,
+            2000,
+            4000,
+            8000,
         ]
     )
 
     LOWER_FREQUENCIES = array(
         [
-        177,
-        355,
-        710,
-        1420,
-        2840,
-        5680,
+            177,
+            355,
+            710,
+            1420,
+            2840,
+            5680,
         ]
     )
 
     UPPER_FREQUENCIES = array(
         [
-        355,
-        710,
-        1420,
-        2840,
-        5680,
-        11360,
+            355,
+            710,
+            1420,
+            2840,
+            5680,
+            11360,
         ]
     )
 
     BANDWIDTH_ADJUSTEMENT = array(
         [
-        22.48,
-        25.48,
-        28.48,
-        31.48,
-        34.48,
-        37.48,
-        ]
-    )    
-
-
-    IMPORTANCE = array(
-        [
-        0.0617,
-        0.1671,
-        0.2373,
-        0.2648,
-        0.2142,
-        0.0549
+            22.48,
+            25.48,
+            28.48,
+            31.48,
+            34.48,
+            37.48,
         ]
     )
 
-    STANDARD_SPEECH_SPECTRUM_NORMAL = array(
-        [
-        34.75,
-        34.27,
-        25.01,
-        17.32,
-        9.33,
-        1.13
-        ]
-    )
+    IMPORTANCE = array([0.0617, 0.1671, 0.2373, 0.2648, 0.2142, 0.0549])
+
+    STANDARD_SPEECH_SPECTRUM_NORMAL = array([34.75, 34.27, 25.01, 17.32, 9.33, 1.13])
 
     REFERENCE_INTERNAL_NOISE_SPECTRUM = array(
-        [
-        -3.90,
-        -9.70,
-        -12.50,
-        -17.70,
-        -25.90,
-        -7.10
-        ]
+        [-3.90, -9.70, -12.50, -17.70, -25.90, -7.10]
     )
 
-    FREEFIELD2EARDRUM_TRANSFER_FUNCTION = array(
-        [
-        1.00,
-        1.80,
-        2.60,
-        12.00,
-        14.30,
-        1.80
-        ]
+    FREEFIELD2EARDRUM_TRANSFER_FUNCTION = array([1.00, 1.80, 2.60, 12.00, 14.30, 1.80])
+    return (
+        CENTER_FREQUENCIES,
+        LOWER_FREQUENCIES,
+        UPPER_FREQUENCIES,
+        BANDWIDTH_ADJUSTEMENT,
+        IMPORTANCE,
+        REFERENCE_INTERNAL_NOISE_SPECTRUM,
+        STANDARD_SPEECH_SPECTRUM_NORMAL,
     )
-    return CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, BANDWIDTH_ADJUSTEMENT, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL
+
 
 def _get_third_octave_band_data():
     CENTER_FREQUENCIES = array(
         [
-        160,
-        200,
-        250,
-        315,
-        400,
-        500,
-        630,
-        800,
-        1000,
-        1250,
-        1600,
-        2000,
-        2500,
-        3150,
-        4000,
-        5000,
-        6300,
-        8000
+            160,
+            200,
+            250,
+            315,
+            400,
+            500,
+            630,
+            800,
+            1000,
+            1250,
+            1600,
+            2000,
+            2500,
+            3150,
+            4000,
+            5000,
+            6300,
+            8000,
         ]
-        )
+    )
 
     LOWER_FREQUENCIES = array(
         [
-        141,
-        178,
-        224,
-        282,
-        355,
-        447,
-        562,
-        708,
-        891,
-        1122,
-        1413,
-        1778,
-        2239,
-        2818,
-        3548,
-        4467,
-        5623,
-        7079,
+            141,
+            178,
+            224,
+            282,
+            355,
+            447,
+            562,
+            708,
+            891,
+            1122,
+            1413,
+            1778,
+            2239,
+            2818,
+            3548,
+            4467,
+            5623,
+            7079,
         ]
-        )
+    )
 
     UPPER_FREQUENCIES = array(
         [
-        178,
-        224,
-        282,
-        355,
-        447,
-        562,
-        708,
-        891,
-        1122,
-        1413,
-        1778,
-        2239,
-        2818,
-        3548,
-        4467,
-        5623,
-        7079,
-        8913,
+            178,
+            224,
+            282,
+            355,
+            447,
+            562,
+            708,
+            891,
+            1122,
+            1413,
+            1778,
+            2239,
+            2818,
+            3548,
+            4467,
+            5623,
+            7079,
+            8913,
         ]
-        )
+    )
 
     BANDWIDTH_ADJUSTEMENT = array(
         [
-        15.65,
-        16.65,
-        17.65,
-        18.65,
-        19.65,
-        20.65,
-        21.65,
-        22.65,
-        23.65,
-        24.65,
-        25.65,
-        26.65,
-        27.65,
-        28.65,
-        29.65,
-        30.65,
-        31.65,
-        32.65,
+            15.65,
+            16.65,
+            17.65,
+            18.65,
+            19.65,
+            20.65,
+            21.65,
+            22.65,
+            23.65,
+            24.65,
+            25.65,
+            26.65,
+            27.65,
+            28.65,
+            29.65,
+            30.65,
+            31.65,
+            32.65,
         ]
-    )    
+    )
 
     IMPORTANCE = array(
         [
-        0.0083,
-        0.0095,
-        0.0150,
-        0.0289,
-        0.0440,
-        0.0578,
-        0.0653,
-        0.0711,
-        0.0818,
-        0.0844,
-        0.0882,
-        0.0898,
-        0.0868,
-        0.0844,
-        0.0771,
-        0.0527,
-        0.0364,
-        0.0185,
+            0.0083,
+            0.0095,
+            0.0150,
+            0.0289,
+            0.0440,
+            0.0578,
+            0.0653,
+            0.0711,
+            0.0818,
+            0.0844,
+            0.0882,
+            0.0898,
+            0.0868,
+            0.0844,
+            0.0771,
+            0.0527,
+            0.0364,
+            0.0185,
         ]
     )
 
-    STANDARD_SPEECH_SPECTRUM_NORMAL = array (
+    STANDARD_SPEECH_SPECTRUM_NORMAL = array(
         [
-        32.41,
-        34.48,
-        34.75,
-        33.98,
-        34.59,
-        34.27,
-        32.06,
-        28.30,
-        25.01,
-        23.00,
-        20.15,
-        17.32,
-        13.18,
-        11.55,
-        9.33,
-        5.31,
-        2.59,
-        1.13    ]
+            32.41,
+            34.48,
+            34.75,
+            33.98,
+            34.59,
+            34.27,
+            32.06,
+            28.30,
+            25.01,
+            23.00,
+            20.15,
+            17.32,
+            13.18,
+            11.55,
+            9.33,
+            5.31,
+            2.59,
+            1.13,
+        ]
     )
 
     REFERENCE_INTERNAL_NOISE_SPECTRUM = array(
         [
-        0.60,
-        -1.70,
-        -3.90,
-        -6.10,
-        -8.20,
-        -9.70,
-        -10.80,
-        -11.90,
-        -12.50,
-        -13.50,
-        -15.40,
-        -17.70,
-        -21.20,
-        -24.20,
-        -25.90,
-        -23.60,
-        -15.80,
-        -7.10
+            0.60,
+            -1.70,
+            -3.90,
+            -6.10,
+            -8.20,
+            -9.70,
+            -10.80,
+            -11.90,
+            -12.50,
+            -13.50,
+            -15.40,
+            -17.70,
+            -21.20,
+            -24.20,
+            -25.90,
+            -23.60,
+            -15.80,
+            -7.10,
         ]
     )
 
     FREEFIELD2EARDRUM_TRANSFER_FUNCTION = array(
         [
-        0.00,
-        0.50,
-        1.00,
-        1.40,
-        1.50,
-        1.80,
-        2.40,
-        3.10,
-        2.60,
-        3.00,
-        6.10,
-        12.00,
-        16.80,
-        15.00,
-        14.30,
-        10.70,
-        6.40,
-        1.80,
+            0.00,
+            0.50,
+            1.00,
+            1.40,
+            1.50,
+            1.80,
+            2.40,
+            3.10,
+            2.60,
+            3.00,
+            6.10,
+            12.00,
+            16.80,
+            15.00,
+            14.30,
+            10.70,
+            6.40,
+            1.80,
         ]
     )
-    return CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, BANDWIDTH_ADJUSTEMENT, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL
+    return (
+        CENTER_FREQUENCIES,
+        LOWER_FREQUENCIES,
+        UPPER_FREQUENCIES,
+        BANDWIDTH_ADJUSTEMENT,
+        IMPORTANCE,
+        REFERENCE_INTERNAL_NOISE_SPECTRUM,
+        STANDARD_SPEECH_SPECTRUM_NORMAL,
+    )
diff --git a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_main_sii.py b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_main_sii.py
index 7db8d4c5..f33278ad 100644
--- a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_main_sii.py
+++ b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_main_sii.py
@@ -3,8 +3,18 @@
 
 from numpy import array, zeros, log10, maximum, where, sum
 
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import _get_critical_band_data, _get_equal_critical_band_data, _get_octave_band_data, _get_third_octave_band_data
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import _get_critical_band_speech_data, _get_equal_critical_band_speech_data, _get_octave_band_speech_data, _get_third_octave_band_speech_data
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import (
+    _get_critical_band_data,
+    _get_equal_critical_band_data,
+    _get_octave_band_data,
+    _get_third_octave_band_data,
+)
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import (
+    _get_critical_band_speech_data,
+    _get_equal_critical_band_speech_data,
+    _get_octave_band_speech_data,
+    _get_third_octave_band_speech_data,
+)
 from mosqito.utils.LTQ import LTQ
 from mosqito.utils.conversion import freq2bark
 
@@ -25,7 +35,7 @@ def _main_sii(method, speech_spectrum, noise_spectrum, threshold):
     threshold : array_like or 'zwicker'
         Threshold of hearing [dB ref. 2e-5 Pa] with same size as the chosen method frequency axis, or 'zwicker' to use the standard threshold.
         Default to None sets the threshold to zeros on each frequency band.
-        
+
     Returns
     -------
     sii: numpy.ndarray
@@ -35,77 +45,130 @@ def _main_sii(method, speech_spectrum, noise_spectrum, threshold):
     freq_axis: numpy.ndarray
         Frequency axis corresponding to the chosen method.
     """
-    
-    if (method!='critical') & (method!='equally_critical') & (method!='third_octave') & (method!='octave'):
-        raise ValueError('Method should be within {"critical", "equally_critical", "third_octave", "octave"}.')
-    
+
+    if (
+        (method != "critical")
+        & (method != "equally_critical")
+        & (method != "third_octave")
+        & (method != "octave")
+    ):
+        raise ValueError(
+            'Method should be within {"critical", "equally_critical", "third_octave", "octave"}.'
+        )
+
     # Get band data according to the chosen method
-    if method == 'critical':
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL = _get_critical_band_data()
-    elif method == 'equally_critical':
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL = _get_equal_critical_band_data()
-    elif method == 'third_octave':
-        CENTER_FREQUENCIES, _, _, _, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL = _get_third_octave_band_data()
-    elif method == 'octave':
-        CENTER_FREQUENCIES, _, _, _, IMPORTANCE, REFERENCE_INTERNAL_NOISE_SPECTRUM, STANDARD_SPEECH_SPECTRUM_NORMAL = _get_octave_band_data()
+    if method == "critical":
+        (
+            CENTER_FREQUENCIES,
+            LOWER_FREQUENCIES,
+            UPPER_FREQUENCIES,
+            IMPORTANCE,
+            REFERENCE_INTERNAL_NOISE_SPECTRUM,
+            STANDARD_SPEECH_SPECTRUM_NORMAL,
+        ) = _get_critical_band_data()
+    elif method == "equally_critical":
+        (
+            CENTER_FREQUENCIES,
+            LOWER_FREQUENCIES,
+            UPPER_FREQUENCIES,
+            IMPORTANCE,
+            REFERENCE_INTERNAL_NOISE_SPECTRUM,
+            STANDARD_SPEECH_SPECTRUM_NORMAL,
+        ) = _get_equal_critical_band_data()
+    elif method == "third_octave":
+        (
+            CENTER_FREQUENCIES,
+            _,
+            _,
+            _,
+            IMPORTANCE,
+            REFERENCE_INTERNAL_NOISE_SPECTRUM,
+            STANDARD_SPEECH_SPECTRUM_NORMAL,
+        ) = _get_third_octave_band_data()
+    elif method == "octave":
+        (
+            CENTER_FREQUENCIES,
+            _,
+            _,
+            _,
+            IMPORTANCE,
+            REFERENCE_INTERNAL_NOISE_SPECTRUM,
+            STANDARD_SPEECH_SPECTRUM_NORMAL,
+        ) = _get_octave_band_data()
     nbands = len(CENTER_FREQUENCIES)
-    
+
     if threshold is None:
         T = zeros((nbands))
-    elif threshold == 'zwicker':
+    elif threshold == "zwicker":
         T = LTQ(freq2bark(CENTER_FREQUENCIES))
     else:
         T = array(threshold)
-        
+
     # dB bandwidth adjustement
-    if (method == 'critical_bands') or (method == 'equal_critical_bands'):
+    if (method == "critical_bands") or (method == "equal_critical_bands"):
         noise_spectrum -= 10 * log10(UPPER_FREQUENCIES - LOWER_FREQUENCIES)
 
     # STEP 3
-    if method == 'octave':
+    if method == "octave":
         Z = noise_spectrum
     else:
         V = speech_spectrum - 24
         B = maximum(noise_spectrum, V)
-        if method == 'third_octave':
-            C = -80 + 0.6 * (B + 10*log10(CENTER_FREQUENCIES)-6.353)
+        if method == "third_octave":
+            C = -80 + 0.6 * (B + 10 * log10(CENTER_FREQUENCIES) - 6.353)
             Z = zeros((nbands))
-            for i in range(nbands): 
+            for i in range(nbands):
                 s = 0
                 for k in range(i):
-                    s += 10**(0.1*(B[k] + 3.32 * C[k] * log10(0.89 * CENTER_FREQUENCIES[i] / CENTER_FREQUENCIES[k])))
-                Z[i] = 10 * log10(10**(0.1*noise_spectrum[i]) + s)
+                    s += 10 ** (
+                        0.1
+                        * (
+                            B[k]
+                            + 3.32
+                            * C[k]
+                            * log10(
+                                0.89 * CENTER_FREQUENCIES[i] / CENTER_FREQUENCIES[k]
+                            )
+                        )
+                    )
+                Z[i] = 10 * log10(10 ** (0.1 * noise_spectrum[i]) + s)
         else:
-            C = -80 + 0.6 * (B + 10*log10(UPPER_FREQUENCIES - LOWER_FREQUENCIES))
+            C = -80 + 0.6 * (B + 10 * log10(UPPER_FREQUENCIES - LOWER_FREQUENCIES))
             Z = zeros((nbands))
-            for i in range(nbands): 
+            for i in range(nbands):
                 s = 0
-                for k in range(i-1):
-                    s += 10**(0.1*(B[k] + 3.32 * C[k] * log10(CENTER_FREQUENCIES[i] / CENTER_FREQUENCIES[k])))                    
-                Z[i] = 10 * log10(10**(0.1*noise_spectrum[i]) + s)
+                for k in range(i - 1):
+                    s += 10 ** (
+                        0.1
+                        * (
+                            B[k]
+                            + 3.32
+                            * C[k]
+                            * log10(CENTER_FREQUENCIES[i] / CENTER_FREQUENCIES[k])
+                        )
+                    )
+                Z[i] = 10 * log10(10 ** (0.1 * noise_spectrum[i]) + s)
         # 4.3.2.4
         Z[0] = B[0]
-    
+
     # STEP 4
     X = REFERENCE_INTERNAL_NOISE_SPECTRUM + T
-    
+
     # STEP 5
     D = maximum(Z, X)
-    
+
     # STEP 6
-    L = 1 - (speech_spectrum - STANDARD_SPEECH_SPECTRUM_NORMAL -10)/160
-    L[where(L>1)] = 1
-    
+    L = 1 - (speech_spectrum - STANDARD_SPEECH_SPECTRUM_NORMAL - 10) / 160
+    L[where(L > 1)] = 1
+
     # STEP 7
-    K = (speech_spectrum - D + 15)/30
-    K[where(K>1)] = 1
-    K[where(K<0)] = 0
+    K = (speech_spectrum - D + 15) / 30
+    K[where(K > 1)] = 1
+    K[where(K < 0)] = 0
     A = L * K
-    
+
     # STEP 8
     SII = sum(IMPORTANCE * A)
     SII_specific = IMPORTANCE * A
-    
-    return SII, SII_specific, CENTER_FREQUENCIES
-
 
+    return SII, SII_specific, CENTER_FREQUENCIES
diff --git a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_speech_data.py b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_speech_data.py
index 2d521e9c..58d040c6 100644
--- a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_speech_data.py
+++ b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/_speech_data.py
@@ -1,375 +1,357 @@
 from numpy import array
 
+
 def _get_critical_band_speech_data(speech_level):
-    """ See § 3.4 of the standard ANSI S3.5. """
-    
+    """See § 3.4 of the standard ANSI S3.5."""
+
     if speech_level == "normal":
         SPEECH_SPECTRUM = array(
-        [
-            31.44,
-            34.75,
-            34.14,
-            34.58,
-            33.17,
-            30.64,
-            27.59,
-            25.01,
-            23.52,
-            22.28,
-            20.15,
-            18.29,
-            16.37,
-            13.80,
-            12.21,
-            11.09,
-            9.33,
-            5.84,
-            3.47,
-            1.78,
-            -0.14
-        ])
+            [
+                31.44,
+                34.75,
+                34.14,
+                34.58,
+                33.17,
+                30.64,
+                27.59,
+                25.01,
+                23.52,
+                22.28,
+                20.15,
+                18.29,
+                16.37,
+                13.80,
+                12.21,
+                11.09,
+                9.33,
+                5.84,
+                3.47,
+                1.78,
+                -0.14,
+            ]
+        )
         SPEECH_LEVEL = 62.35
     elif speech_level == "raised":
         SPEECH_SPECTRUM = array(
             [
-            34.06,
-            38.98,
-            38.62,
-            39.84,
-            39.44,
-            37.99,
-            35.85,
-            33.86,
-            32.56,
-            30.91,
-            28.58,
-            26.37,
-            24.34,
-            22.35,
-            21.04,
-            19.56,
-            16.78,
-            12.14,
-            9.04,
-            6.36,
-            3.44
-            ])
+                34.06,
+                38.98,
+                38.62,
+                39.84,
+                39.44,
+                37.99,
+                35.85,
+                33.86,
+                32.56,
+                30.91,
+                28.58,
+                26.37,
+                24.34,
+                22.35,
+                21.04,
+                19.56,
+                16.78,
+                12.14,
+                9.04,
+                6.36,
+                3.44,
+            ]
+        )
         SPEECH_LEVEL = 68.34
     elif speech_level == "loud":
 
         SPEECH_SPECTRUM = array(
             [
-            34.21,
-            41.55,
-            43.68,
-            44.08,
-            45.34,
-            45.22,
-            43.60,
-            42.16,
-            41.07,
-            39.68,
-            37.70,
-            35.62,
-            33.17,
-            30.98,
-            29.01,
-            27.71,
-            25.41,
-            19.20,
-            15.37,
-            12.61,
-            9.62
-            ])
+                34.21,
+                41.55,
+                43.68,
+                44.08,
+                45.34,
+                45.22,
+                43.60,
+                42.16,
+                41.07,
+                39.68,
+                37.70,
+                35.62,
+                33.17,
+                30.98,
+                29.01,
+                27.71,
+                25.41,
+                19.20,
+                15.37,
+                12.61,
+                9.62,
+            ]
+        )
         SPEECH_LEVEL = 74.85
     elif speech_level == "shout":
         SPEECH_SPECTRUM = array(
-        [
-        28.69,
-        42.50,
-        47.14,
-        48.46,
-        50.17,
-        51.68,
-        51.43,
-        51.31,
-        49.40,
-        49.03,
-        47.65,
-        45.47,
-        43.13,
-        40.80,
-        39.15,
-        37.30,
-        34.41,
-        29.01,
-        25.17,
-        22.08,
-        18.76
-        ])
+            [
+                28.69,
+                42.50,
+                47.14,
+                48.46,
+                50.17,
+                51.68,
+                51.43,
+                51.31,
+                49.40,
+                49.03,
+                47.65,
+                45.47,
+                43.13,
+                40.80,
+                39.15,
+                37.30,
+                34.41,
+                29.01,
+                25.17,
+                22.08,
+                18.76,
+            ]
+        )
         SPEECH_LEVEL = 82.30
     else:
-        raise ValueError("Error: available speech levels are {'normal', 'raised', 'loud', 'shout'}")
+        raise ValueError(
+            "Error: available speech levels are {'normal', 'raised', 'loud', 'shout'}"
+        )
 
     return SPEECH_SPECTRUM, SPEECH_LEVEL
 
+
 def _get_equal_critical_band_speech_data(speech_level):
     if speech_level == "normal":
         SPEECH_SPECTRUM = array(
-        [
-            34.14,
-            34.58,
-            33.17,
-            30.64,
-            27.59,
-            25.01,
-            23.52,
-            22.28,
-            20.15,
-            18.29,
-            16.37,
-            13.80,
-            12.21,
-            11.09,
-            9.33,
-            5.84,
-            3.47,
-        ]
-    )
+            [
+                34.14,
+                34.58,
+                33.17,
+                30.64,
+                27.59,
+                25.01,
+                23.52,
+                22.28,
+                20.15,
+                18.29,
+                16.37,
+                13.80,
+                12.21,
+                11.09,
+                9.33,
+                5.84,
+                3.47,
+            ]
+        )
         SPEECH_LEVEL = 62.35
     elif speech_level == "raised":
         SPEECH_SPECTRUM = array(
-        [
-        38.62,
-        39.84,
-        39.44,
-        37.99,
-        35.85,
-        33.86,
-        32.56,
-        30.91,
-        28.58,
-        26.37,
-        24.34,
-        22.35,
-        21.04,
-        19.56,
-        16.78,
-        12.14,
-        9.04,
-        ]
-    )
+            [
+                38.62,
+                39.84,
+                39.44,
+                37.99,
+                35.85,
+                33.86,
+                32.56,
+                30.91,
+                28.58,
+                26.37,
+                24.34,
+                22.35,
+                21.04,
+                19.56,
+                16.78,
+                12.14,
+                9.04,
+            ]
+        )
         SPEECH_LEVEL = 68.34
     elif speech_level == "loud":
         SPEECH_SPECTRUM = array(
-        [
-        43.68,
-        44.08,
-        45.34,
-        45.22,
-        43.60,
-        42.16,
-        41.07,
-        39.68,
-        37.70,
-        35.62,
-        33.17,
-        30.98,
-        29.01,
-        27.71,
-        25.41,
-        19.20,
-        15.37,
-        ]
-    )
+            [
+                43.68,
+                44.08,
+                45.34,
+                45.22,
+                43.60,
+                42.16,
+                41.07,
+                39.68,
+                37.70,
+                35.62,
+                33.17,
+                30.98,
+                29.01,
+                27.71,
+                25.41,
+                19.20,
+                15.37,
+            ]
+        )
         SPEECH_LEVEL = 74.85
     elif speech_level == "shout":
         SPEECH_SPECTRUM = array(
-        [
-        47.14,
-        48.46,
-        50.17,
-        51.68,
-        51.43,
-        51.31,
-        49.40,
-        49.03,
-        47.65,
-        45.47,
-        43.13,
-        40.80,
-        39.15,
-        37.30,
-        34.41,
-        29.01,
-        25.17,
-        ]
-    )
+            [
+                47.14,
+                48.46,
+                50.17,
+                51.68,
+                51.43,
+                51.31,
+                49.40,
+                49.03,
+                47.65,
+                45.47,
+                43.13,
+                40.80,
+                39.15,
+                37.30,
+                34.41,
+                29.01,
+                25.17,
+            ]
+        )
         SPEECH_LEVEL = 82.30
     else:
-        raise ValueError("Error: Available speech levels are {'normal', 'raised', 'loud', 'shout'}")
+        raise ValueError(
+            "Error: Available speech levels are {'normal', 'raised', 'loud', 'shout'}"
+        )
 
     return SPEECH_SPECTRUM, SPEECH_LEVEL
 
+
 def _get_octave_band_speech_data(speech_level):
 
     if speech_level == "normal":
-        SPEECH_SPECTRUM = array(
-        [
-        34.75,
-        34.27,
-        25.01,
-        17.32,
-        9.33,
-        1.13
-        ]
-    )
+        SPEECH_SPECTRUM = array([34.75, 34.27, 25.01, 17.32, 9.33, 1.13])
         SPEECH_LEVEL = 62.35
     elif speech_level == "raised":
-        SPEECH_SPECTRUM = array(
-        [
-        38.98,
-        40.15,
-        33.86,
-        25.32,
-        16.78,
-        5.07
-        ]
-    )
+        SPEECH_SPECTRUM = array([38.98, 40.15, 33.86, 25.32, 16.78, 5.07])
 
         SPEECH_LEVEL = 68.34
     elif speech_level == "loud":
-        SPEECH_SPECTRUM = array(
-        [
-        41.55,
-        44.85,
-        42.16,
-        34.39,
-        25.41,
-        11.39
-        ]
-    )
+        SPEECH_SPECTRUM = array([41.55, 44.85, 42.16, 34.39, 25.41, 11.39])
         SPEECH_LEVEL = 74.85
     elif speech_level == "shout":
-        SPEECH_SPECTRUM = array(
-        [
-        42.50,
-        49.24,
-        51.31,
-        44.32,
-        34.41,
-        20.72
-        ]
-    )
+        SPEECH_SPECTRUM = array([42.50, 49.24, 51.31, 44.32, 34.41, 20.72])
         SPEECH_LEVEL = 82.30
     else:
-        raise ValueError("Error: Available speech levels are {'normal', 'raised', 'loud', 'shout'}")
+        raise ValueError(
+            "Error: Available speech levels are {'normal', 'raised', 'loud', 'shout'}"
+        )
 
     return SPEECH_SPECTRUM, SPEECH_LEVEL
 
+
 def _get_third_octave_band_speech_data(speech_level):
     if speech_level == "normal":
         SPEECH_SPECTRUM = array(
-        [
-        32.41,
-        34.48,
-        34.75,
-        33.98,
-        34.59,
-        34.27,
-        32.06,
-        28.30,
-        25.01,
-        23.00,
-        20.15,
-        17.32,
-        13.18,
-        11.55,
-        9.33,
-        5.31,
-        2.59,
-        1.13    ]
-    )
+            [
+                32.41,
+                34.48,
+                34.75,
+                33.98,
+                34.59,
+                34.27,
+                32.06,
+                28.30,
+                25.01,
+                23.00,
+                20.15,
+                17.32,
+                13.18,
+                11.55,
+                9.33,
+                5.31,
+                2.59,
+                1.13,
+            ]
+        )
         SPEECH_LEVEL = 62.35
     elif speech_level == "raised":
         SPEECH_SPECTRUM = array(
-        [
-        33.81,
-        33.92,
-        38.98,
-        38.57,
-        39.11,
-        40.15,
-        38.78,
-        36.37,
-        33.86,
-        31.89,
-        28.58,
-        25.32,
-        22.35,
-        20.15,
-        16.78,
-        11.47,
-        7.67,
-        5.07
-        ]
-    )
+            [
+                33.81,
+                33.92,
+                38.98,
+                38.57,
+                39.11,
+                40.15,
+                38.78,
+                36.37,
+                33.86,
+                31.89,
+                28.58,
+                25.32,
+                22.35,
+                20.15,
+                16.78,
+                11.47,
+                7.67,
+                5.07,
+            ]
+        )
         SPEECH_LEVEL = 68.34
     elif speech_level == "loud":
         SPEECH_SPECTRUM = array(
-        [
-        35.29,
-        37.76,
-        41.55,
-        43.78,
-        43.40,
-        44.85,
-        45.55,
-        44.05,
-        42.16,
-        40.53,
-        37.70,
-        34.39,
-        30.98,
-        28.21,
-        25.41,
-        18.35,
-        13.87,
-        11.39,
-        ]
-    )
+            [
+                35.29,
+                37.76,
+                41.55,
+                43.78,
+                43.40,
+                44.85,
+                45.55,
+                44.05,
+                42.16,
+                40.53,
+                37.70,
+                34.39,
+                30.98,
+                28.21,
+                25.41,
+                18.35,
+                13.87,
+                11.39,
+            ]
+        )
         SPEECH_LEVEL = 74.85
     elif speech_level == "shout":
         SPEECH_SPECTRUM = array(
-        [
-        30.77,
-        36.65,
-        42.50,
-        46.51,
-        47.40,
-        49.24,
-        51.21,
-        51.44,
-        51.31,
-        49.63,
-        47.65,
-        44.32,
-        40.80,
-        38.13,
-        34.41,
-        28.24,
-        23.45,
-        20.72,
-        ]
-    )
+            [
+                30.77,
+                36.65,
+                42.50,
+                46.51,
+                47.40,
+                49.24,
+                51.21,
+                51.44,
+                51.31,
+                49.63,
+                47.65,
+                44.32,
+                40.80,
+                38.13,
+                34.41,
+                28.24,
+                23.45,
+                20.72,
+            ]
+        )
         SPEECH_LEVEL = 82.30
     else:
-        raise ValueError("Error: Available speech levels are {'normal', 'raised', 'loud', 'shout'}")
-    
+        raise ValueError(
+            "Error: Available speech levels are {'normal', 'raised', 'loud', 'shout'}"
+        )
+
     return SPEECH_SPECTRUM, SPEECH_LEVEL
 
+
 if __name__ == "__main__":
-    
+
     speech_level = "normal"
     speech_spectrum, _ = _get_critical_band_speech_data(speech_level)
     print(len(speech_spectrum))
@@ -379,5 +361,5 @@ def _get_third_octave_band_speech_data(speech_level):
     print(len(speech_spectrum))
     speech_spectrum, _ = _get_octave_band_speech_data(speech_level)
     print(len(speech_spectrum))
-    
-    print('done')
+
+    print("done")
diff --git a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi.py b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi.py
index cc207c9a..ee6d46c0 100644
--- a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi.py
+++ b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi.py
@@ -2,8 +2,18 @@
 
 from numpy import array, zeros
 
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import _get_critical_band_data, _get_equal_critical_band_data, _get_octave_band_data, _get_third_octave_band_data
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import _get_critical_band_speech_data, _get_equal_critical_band_speech_data, _get_octave_band_speech_data, _get_third_octave_band_speech_data
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import (
+    _get_critical_band_data,
+    _get_equal_critical_band_data,
+    _get_octave_band_data,
+    _get_third_octave_band_data,
+)
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import (
+    _get_critical_band_speech_data,
+    _get_equal_critical_band_speech_data,
+    _get_octave_band_speech_data,
+    _get_third_octave_band_speech_data,
+)
 from mosqito.sq_metrics.speech_intelligibility.sii_ansi._main_sii import _main_sii
 from mosqito.sound_level_meter.spectrum import spectrum
 from mosqito.sound_level_meter.freq_band_synthesis import freq_band_synthesis
@@ -27,7 +37,7 @@ def sii_ansi(noise, fs, method, speech_level, threshold=None):
     threshold : array_like or 'zwicker'
         Threshold of hearing [dB ref. 2e-5 Pa] with same size as the chosen method frequency axis, or 'zwicker' to use the standard threshold.
         Default to None sets the threshold to zeros on each frequency band.
-        
+
     Returns
     -------
     sii: numpy.ndarray
@@ -36,7 +46,7 @@ def sii_ansi(noise, fs, method, speech_level, threshold=None):
         Specific SII values along the frequency axis.
     freq_axis: numpy.ndarray
         Frequency axis corresponding to the chosen method.
-        
+
     Examples
     --------
     .. plot::
@@ -58,34 +68,68 @@ def sii_ansi(noise, fs, method, speech_level, threshold=None):
         >>> plt.plot(freq_axis, SII_spec)
         >>> plt.xlabel("Frequency [Hz]")
         >>> plt.ylabel("Specific value ")
-        >>> plt.title("Speech Intelligibility Index = " + f"{SII:.2f}")   
-        
+        >>> plt.title("Speech Intelligibility Index = " + f"{SII:.2f}")
+
     """
-    
-    if (method!='critical') & (method!='equally_critical') & (method!='third_octave') & (method!='octave'):
-        raise ValueError('Method should be within {"critical", "equally_critical", "third_octave", "octave"}.')
-        
-    if (speech_level!='normal') & (speech_level!='raised') & (speech_level!='loud') & (speech_level!='shout'):
-        raise ValueError('Speech level should be within {"normal", "raised", "loud", "shout"} to use the corresponding standard data.')
-    
+
+    if (
+        (method != "critical")
+        & (method != "equally_critical")
+        & (method != "third_octave")
+        & (method != "octave")
+    ):
+        raise ValueError(
+            'Method should be within {"critical", "equally_critical", "third_octave", "octave"}.'
+        )
+
+    if (
+        (speech_level != "normal")
+        & (speech_level != "raised")
+        & (speech_level != "loud")
+        & (speech_level != "shout")
+    ):
+        raise ValueError(
+            'Speech level should be within {"normal", "raised", "loud", "shout"} to use the corresponding standard data.'
+        )
+
     # Get standard speech spectrum
-    if method == 'critical':
+    if method == "critical":
         speech_spectrum, speech_level = _get_critical_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = _get_critical_band_data()
-    elif method == 'equally_critical':
-        speech_spectrum, speech_level = _get_equal_critical_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = _get_equal_critical_band_data()
-    elif method == 'third_octave':
+        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = (
+            _get_critical_band_data()
+        )
+    elif method == "equally_critical":
+        speech_spectrum, speech_level = _get_equal_critical_band_speech_data(
+            speech_level
+        )
+        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = (
+            _get_equal_critical_band_data()
+        )
+    elif method == "third_octave":
         speech_spectrum, speech_level = _get_third_octave_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _, _ = _get_third_octave_band_data()
-    elif method == 'octave':
+        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _, _ = (
+            _get_third_octave_band_data()
+        )
+    elif method == "octave":
         speech_spectrum, speech_level = _get_octave_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _, _, = _get_octave_band_data()
-    
+        (
+            CENTER_FREQUENCIES,
+            LOWER_FREQUENCIES,
+            UPPER_FREQUENCIES,
+            _,
+            _,
+            _,
+            _,
+        ) = _get_octave_band_data()
+
     # Compute noise spectrum in dB
     spec, freqs = spectrum(noise, fs, nfft="default", window="blackman", db=True)
-    noise_spectrum, _ = freq_band_synthesis(spec, freqs, LOWER_FREQUENCIES, UPPER_FREQUENCIES)
-                
-    SII, SII_specific, freq_axis = _main_sii(method, speech_spectrum, noise_spectrum, threshold)    
-    
+    noise_spectrum, _ = freq_band_synthesis(
+        spec, freqs, LOWER_FREQUENCIES, UPPER_FREQUENCIES
+    )
+
+    SII, SII_specific, freq_axis = _main_sii(
+        method, speech_spectrum, noise_spectrum, threshold
+    )
+
     return SII, SII_specific, freq_axis
diff --git a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_freq.py b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_freq.py
index 3942084d..4c3c7b84 100644
--- a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_freq.py
+++ b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_freq.py
@@ -1,11 +1,22 @@
 # -*- coding: utf-8 -*-
 
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import _get_critical_band_data, _get_equal_critical_band_data, _get_octave_band_data, _get_third_octave_band_data
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import _get_critical_band_speech_data, _get_equal_critical_band_speech_data, _get_octave_band_speech_data, _get_third_octave_band_speech_data
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import (
+    _get_critical_band_data,
+    _get_equal_critical_band_data,
+    _get_octave_band_data,
+    _get_third_octave_band_data,
+)
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import (
+    _get_critical_band_speech_data,
+    _get_equal_critical_band_speech_data,
+    _get_octave_band_speech_data,
+    _get_third_octave_band_speech_data,
+)
 from mosqito.sq_metrics.speech_intelligibility.sii_ansi._main_sii import _main_sii
 
 from mosqito.sound_level_meter.freq_band_synthesis import freq_band_synthesis
 
+
 def sii_ansi_freq(spectrum, freqs, method, speech_level, threshold=None):
     """Calculate speech intelligibility index
 
@@ -24,7 +35,7 @@ def sii_ansi_freq(spectrum, freqs, method, speech_level, threshold=None):
     threshold : array_like or 'zwicker'
         Threshold of hearing [dB ref. 2e-5 Pa] with same size as the chosen method frequency axis, or 'zwicker' to use the standard threshold.
         Default to None sets the threshold to zeros on each frequency band.
-        
+
     Returns
     -------
     sii: numpy.ndarray
@@ -33,12 +44,12 @@ def sii_ansi_freq(spectrum, freqs, method, speech_level, threshold=None):
         Specific SII values along the frequency axis.
     freq_axis: numpy.ndarray
         Frequency axis corresponding to the chosen method.
-        
+
     See also
     --------
     sii : speech intelligibility with a time signal as background noise
     sii_level : speech intelligibility with an overall SPL level as background noise
-    
+
     Examples
     --------
     .. plot::
@@ -62,37 +73,70 @@ def sii_ansi_freq(spectrum, freqs, method, speech_level, threshold=None):
         >>> plt.plot(freq_axis, SII_spec)
         >>> plt.xlabel("Frequency [Hz]")
         >>> plt.ylabel("Specific value ")
-        >>> plt.title("Speech Intelligibility Index = " + f"{SII:.2f}")   
-    
+        >>> plt.title("Speech Intelligibility Index = " + f"{SII:.2f}")
+
     """
-    
-    if (method!='critical') & (method!='equally_critical') & (method!='third_octave') & (method!='octave'):
-        raise ValueError('Method should be within {"critical", "equally_critical", "third_octave", "octave"}.')
-        
-    if (speech_level!='normal') & (speech_level!='raised') & (speech_level!='loud') & (speech_level!='shout'):
-        raise ValueError('Speech level should be within {"normal", "raised", "loud", "shout"} to use the corresponding standard data.')
-    
+
+    if (
+        (method != "critical")
+        & (method != "equally_critical")
+        & (method != "third_octave")
+        & (method != "octave")
+    ):
+        raise ValueError(
+            'Method should be within {"critical", "equally_critical", "third_octave", "octave"}.'
+        )
+
+    if (
+        (speech_level != "normal")
+        & (speech_level != "raised")
+        & (speech_level != "loud")
+        & (speech_level != "shout")
+    ):
+        raise ValueError(
+            'Speech level should be within {"normal", "raised", "loud", "shout"} to use the corresponding standard data.'
+        )
+
     # Get standard speech spectrum
-    if method == 'critical':
+    if method == "critical":
         speech_spectrum, speech_level = _get_critical_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = _get_critical_band_data()
-    elif method == 'equally_critical':
-        speech_spectrum, speech_level = _get_equal_critical_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = _get_equal_critical_band_data()
-    elif method == 'third_octave':
+        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = (
+            _get_critical_band_data()
+        )
+    elif method == "equally_critical":
+        speech_spectrum, speech_level = _get_equal_critical_band_speech_data(
+            speech_level
+        )
+        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _ = (
+            _get_equal_critical_band_data()
+        )
+    elif method == "third_octave":
         speech_spectrum, speech_level = _get_third_octave_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _, _ = _get_third_octave_band_data()
-    elif method == 'octave':
+        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _, _ = (
+            _get_third_octave_band_data()
+        )
+    elif method == "octave":
         speech_spectrum, speech_level = _get_octave_band_speech_data(speech_level)
-        CENTER_FREQUENCIES, LOWER_FREQUENCIES, UPPER_FREQUENCIES, _, _, _, _, = _get_octave_band_data()
+        (
+            CENTER_FREQUENCIES,
+            LOWER_FREQUENCIES,
+            UPPER_FREQUENCIES,
+            _,
+            _,
+            _,
+            _,
+        ) = _get_octave_band_data()
     nbands = len(speech_spectrum)
-    
+
     if (len(spectrum) != nbands) or (freqs != CENTER_FREQUENCIES).any():
-        noise_spectrum,_ = freq_band_synthesis(spectrum, freqs, LOWER_FREQUENCIES, UPPER_FREQUENCIES)
+        noise_spectrum, _ = freq_band_synthesis(
+            spectrum, freqs, LOWER_FREQUENCIES, UPPER_FREQUENCIES
+        )
     else:
         noise_spectrum = spectrum
-        
-    SII, SII_specific, freq_axis = _main_sii(method, speech_spectrum, noise_spectrum, threshold)    
-    
-    return SII, SII_specific, freq_axis
 
+    SII, SII_specific, freq_axis = _main_sii(
+        method, speech_spectrum, noise_spectrum, threshold
+    )
+
+    return SII, SII_specific, freq_axis
diff --git a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_level.py b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_level.py
index d7fa0bd7..f4bc2c89 100644
--- a/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_level.py
+++ b/mosqito/sq_metrics/speech_intelligibility/sii_ansi/sii_ansi_level.py
@@ -2,8 +2,18 @@
 
 from numpy import ones, log10, power
 
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import _get_critical_band_data, _get_equal_critical_band_data, _get_octave_band_data, _get_third_octave_band_data
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import _get_critical_band_speech_data, _get_equal_critical_band_speech_data, _get_octave_band_speech_data, _get_third_octave_band_speech_data
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import (
+    _get_critical_band_data,
+    _get_equal_critical_band_data,
+    _get_octave_band_data,
+    _get_third_octave_band_data,
+)
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._speech_data import (
+    _get_critical_band_speech_data,
+    _get_equal_critical_band_speech_data,
+    _get_octave_band_speech_data,
+    _get_third_octave_band_speech_data,
+)
 from mosqito.sq_metrics.speech_intelligibility.sii_ansi._main_sii import _main_sii
 
 
@@ -16,7 +26,7 @@ def sii_ansi_level(noise_level, method, speech_level, threshold=None):
     Parameters
     ----------
     noise_level : float
-        Overall noise level in [dB ref. 2e-5 Pa]. 
+        Overall noise level in [dB ref. 2e-5 Pa].
     method: {"critical", "equally_critical", "third_octave", "octave"}
         Type of frequency band to be used for the calculation. See § 3.4 of the standard.
     speech_level : {'normal', 'raised', 'loud', 'shout'}
@@ -24,7 +34,7 @@ def sii_ansi_level(noise_level, method, speech_level, threshold=None):
     threshold : array_like or 'zwicker'
         Threshold of hearing [dB ref. 2e-5 Pa] with same size as the chosen method frequency axis, or 'zwicker' to use the standard threshold.
         Default to None sets the threshold to zeros on each frequency band.
-                
+
     Returns
     -------
     sii: numpy.ndarray
@@ -33,12 +43,12 @@ def sii_ansi_level(noise_level, method, speech_level, threshold=None):
         Specific SII values along the frequency axis.
     freq_axis: numpy.ndarray
         Frequency axis corresponding to the chosen method.
-        
+
     Examples
     --------
     .. plot::
        :include-source:
-       
+
         >>> import matplotlib.pyplot as plt
         >>> import numpy as np
         >>> from mosqito.sq_metrics.speech_intelligibility import sii_level
@@ -56,33 +66,50 @@ def sii_ansi_level(noise_level, method, speech_level, threshold=None):
         >>> plt.plot(freq_axis, SII_spec)
         >>> plt.xlabel("Frequency [Hz]")
         >>> plt.ylabel("Specific value ")
-        >>> plt.title("Speech Intelligibility Index = " + f"{SII:.2f} \n Speech level: " + speech_level)   
+        >>> plt.title("Speech Intelligibility Index = " + f"{SII:.2f} \n Speech level: " + speech_level)
 
     """
-    
-    if (method!='critical') & (method!='equally_critical') & (method!='third_octave') & (method!='octave'):
-        raise ValueError('Method should be within {"critical", "equally_critical", "third_octave", "octave"}.')
-        
-    if (speech_level!='normal') & (speech_level!='raised') & (speech_level!='loud') & (speech_level!='shout'):
-        raise ValueError('Speech level should be within {"normal", "raised", "loud", "shout"} to use the corresponding standard data.')
-    
+
+    if (
+        (method != "critical")
+        & (method != "equally_critical")
+        & (method != "third_octave")
+        & (method != "octave")
+    ):
+        raise ValueError(
+            'Method should be within {"critical", "equally_critical", "third_octave", "octave"}.'
+        )
+
+    if (
+        (speech_level != "normal")
+        & (speech_level != "raised")
+        & (speech_level != "loud")
+        & (speech_level != "shout")
+    ):
+        raise ValueError(
+            'Speech level should be within {"normal", "raised", "loud", "shout"} to use the corresponding standard data.'
+        )
+
     # Get standard speech spectrum
-    if method == 'critical':
+    if method == "critical":
         speech_spectrum, speech_level = _get_critical_band_speech_data(speech_level)
-    elif method == 'equally_critical':
-        speech_spectrum, speech_level = _get_equal_critical_band_speech_data(speech_level)
-    elif method == 'third_octave':
+    elif method == "equally_critical":
+        speech_spectrum, speech_level = _get_equal_critical_band_speech_data(
+            speech_level
+        )
+    elif method == "third_octave":
         speech_spectrum, speech_level = _get_third_octave_band_speech_data(speech_level)
-    elif method == 'octave':
+    elif method == "octave":
         speech_spectrum, speech_level = _get_octave_band_speech_data(speech_level)
     nbands = len(speech_spectrum)
-    
+
     # Create noise spectrum as uniform spectrum from overall level
-    band_level = 10 * log10(power(10, noise_level/10)/nbands)
+    band_level = 10 * log10(power(10, noise_level / 10) / nbands)
     noise_spectrum = ones((nbands)) * band_level
-        
+
     # Compute SII
-    SII, SII_specific, freq_axis = _main_sii(method, speech_spectrum, noise_spectrum, threshold)    
-    
-    return SII, SII_specific, freq_axis
+    SII, SII_specific, freq_axis = _main_sii(
+        method, speech_spectrum, noise_spectrum, threshold
+    )
 
+    return SII, SII_specific, freq_axis
diff --git a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/_pr_main_calc.py b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/_pr_main_calc.py
index 3ad5843d..b737a28d 100644
--- a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/_pr_main_calc.py
+++ b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/_pr_main_calc.py
@@ -10,8 +10,12 @@
     _lower_critical_band,
     _upper_critical_band,
 )
-from mosqito.sq_metrics.tonality.tone_to_noise_ecma._screening_for_tones import _screening_for_tones
-from mosqito.sq_metrics.tonality.tone_to_noise_ecma._find_highest_tone import _find_highest_tone
+from mosqito.sq_metrics.tonality.tone_to_noise_ecma._screening_for_tones import (
+    _screening_for_tones,
+)
+from mosqito.sq_metrics.tonality.tone_to_noise_ecma._find_highest_tone import (
+    _find_highest_tone,
+)
 
 
 def _pr_main_calc(spectrum_db, freq_axis):
@@ -53,12 +57,13 @@ def _pr_main_calc(spectrum_db, freq_axis):
 
     elif (len(spectrum_db.shape) > 1) & (len(freq_axis.shape) > 1):
         nseg = spectrum_db.shape[1]
-        freqs = [[]for i in range(nseg)]
-        spec_db = [[]for i in range(nseg)]
+        freqs = [[] for i in range(nseg)]
+        spec_db = [[] for i in range(nseg)]
         for i in range(nseg):
             # Frequency axis of interest
             freq_index_rows = np.where(
-                (freq_axis[:, i] > 89.1) & (freq_axis[:, i] < 11200))[0]
+                (freq_axis[:, i] > 89.1) & (freq_axis[:, i] < 11200)
+            )[0]
             freqs[i] = np.append(freqs[i], freq_axis[freq_index_rows, i])
             spec_db[i] = np.append(spec_db[i], spectrum_db[freq_index_rows, i])
         freqs = np.asarray(freqs)
@@ -89,10 +94,10 @@ def _pr_main_calc(spectrum_db, freq_axis):
         tones_freqs = []
         prominence = []
     else:
-        PR = [[]for i in range(nseg)]
-        t_pr = [[]for i in range(nseg)]
-        tones_freqs = [[]for i in range(nseg)]
-        prominence = [[]for i in range(nseg)]
+        PR = [[] for i in range(nseg)]
+        t_pr = [[] for i in range(nseg)]
+        tones_freqs = [[] for i in range(nseg)]
+        prominence = [[] for i in range(nseg)]
 
     for i in range(nseg):
 
@@ -211,8 +216,7 @@ def _pr_main_calc(spectrum_db, freq_axis):
 
         if nseg > 1:
             if sum(np.power(10, (pr[prominence[i]] / 10))) != 0:
-                t_pr[i] = 10 * \
-                    np.log10(sum(np.power(10, (pr[prominence[i]] / 10))))
+                t_pr[i] = 10 * np.log10(sum(np.power(10, (pr[prominence[i]] / 10))))
             else:
                 t_pr[i] = 0
             PR[i] = np.append(PR[i], pr)
@@ -220,7 +224,8 @@ def _pr_main_calc(spectrum_db, freq_axis):
         elif nseg == 1:
             if sum(np.power(10, (pr[prominence] / 10))) != 0:
                 t_pr = np.append(
-                    t_pr, 10 * np.log10(sum(np.power(10, (pr[prominence] / 10)))))
+                    t_pr, 10 * np.log10(sum(np.power(10, (pr[prominence] / 10))))
+                )
             else:
                 t_pr = 0
             PR = np.append(PR, pr)
diff --git a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_freq.py b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_freq.py
index b4667267..d0fe26b7 100644
--- a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_freq.py
+++ b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_freq.py
@@ -4,7 +4,9 @@
 import numpy as np
 
 # Local imports
-from mosqito.sq_metrics.tonality.prominence_ratio_ecma._pr_main_calc import _pr_main_calc
+from mosqito.sq_metrics.tonality.prominence_ratio_ecma._pr_main_calc import (
+    _pr_main_calc,
+)
 from mosqito.utils.conversion import amp2db
 
 
@@ -18,7 +20,7 @@ def pr_ecma_freq(spectrum, freqs, prominence=True):
     spectrum :numpy.array
         An amplitude or complex frequency spectrum [nperseg x nseg].
     freqs : np.array
-        Frequency axis [nperseg x nseg] or [nperseg]. 
+        Frequency axis [nperseg x nseg] or [nperseg].
     prominence : boolean
         If True, the algorithm only returns the prominent tones, if False it returns all tones detected.
         Default is True.
@@ -30,22 +32,21 @@ def pr_ecma_freq(spectrum, freqs, prominence=True):
     pr : array of float
         PR values for each detected tone.
     promi : array of bool
-        Prominence criterion for each detected tone.    
+        Prominence criterion for each detected tone.
     tones_freqs : array of float
         Frequency list of the detected tones.
     """
-    
 
-    if len(spectrum) != len(freqs) :
-        raise ValueError('Input spectrum and frequency axis must have the same size')
+    if len(spectrum) != len(freqs):
+        raise ValueError("Input spectrum and frequency axis must have the same size")
 
     # Compute spectrum dB values
     spectrum_db = amp2db(np.abs(spectrum), ref=2e-5)
-                  
+
     # Compute PR values
     tones_freqs, pr, prom, t_pr = _pr_main_calc(spectrum_db, freqs)
- 
+
     if prominence == False:
-        return t_pr, pr, prom, tones_freqs  
+        return t_pr, pr, prom, tones_freqs
     else:
         return t_pr, pr[prom], prom[prom], tones_freqs[prom]
diff --git a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_st.py b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_st.py
index df5c67c1..dbf79c95 100644
--- a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_st.py
+++ b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_st.py
@@ -2,7 +2,9 @@
 
 # Local imports
 from mosqito.sound_level_meter.spectrum import spectrum
-from mosqito.sq_metrics.tonality.prominence_ratio_ecma._pr_main_calc import _pr_main_calc
+from mosqito.sq_metrics.tonality.prominence_ratio_ecma._pr_main_calc import (
+    _pr_main_calc,
+)
 
 
 def pr_ecma_st(signal, fs, prominence=True):
@@ -31,14 +33,14 @@ def pr_ecma_st(signal, fs, prominence=True):
     tones_freqs : array of float
         Frequency list of the detected tones.
     """
-    
+
     # Compute db spectrum
     spectrum_db, freq_axis = spectrum(signal, fs, db=True)
-                  
+
     # Compute PR values
     tones_freqs, pr, prom, t_pr = _pr_main_calc(spectrum_db, freq_axis)
     prom = prom.astype(bool)
-    
+
     if prominence == False:
         return t_pr, pr, prom, tones_freqs
     else:
diff --git a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_tv.py b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_tv.py
index a0cfaf86..718abf40 100644
--- a/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_tv.py
+++ b/mosqito/sq_metrics/tonality/prominence_ratio_ecma/pr_ecma_tv.py
@@ -6,7 +6,9 @@
 # Local imports
 from mosqito.utils.time_segmentation import time_segmentation
 from mosqito.sound_level_meter.spectrum import spectrum
-from mosqito.sq_metrics.tonality.prominence_ratio_ecma._pr_main_calc import _pr_main_calc
+from mosqito.sq_metrics.tonality.prominence_ratio_ecma._pr_main_calc import (
+    _pr_main_calc,
+)
 
 
 def pr_ecma_tv(signal, fs, prominence=True, overlap=0):
@@ -37,41 +39,41 @@ def pr_ecma_tv(signal, fs, prominence=True, overlap=0):
     tones_freqs : array of float
         Frequency list of the detected tones.
     time  : array of float
-        Time axis.   
-     """
-    
+        Time axis.
+    """
+
     if len(signal.shape) == 1:
-      
+
         # Number of points within each frame according to the time resolution of 500ms
         nperseg = int(0.5 * fs)
         # Overlappinf segment length
-        noverlap = int(overlap * nperseg)               
+        noverlap = int(overlap * nperseg)
         # Time segmentation of the signal
-        sig, time = time_segmentation(signal, fs, nperseg=nperseg, noverlap=noverlap, is_ecma=False)
+        sig, time = time_segmentation(
+            signal, fs, nperseg=nperseg, noverlap=noverlap, is_ecma=False
+        )
         # Number of segments
-        nseg = sig.shape[1]        
+        nseg = sig.shape[1]
         # Spectrum computation
         spectrum_db, freq_axis = spectrum(sig, fs, db=True)
-        
+
     else:
         nseg = signal.shape[1]
-        time = np.linspace(0, nseg/fs, num=nseg)
-        
+        time = np.linspace(0, nseg / fs, num=nseg)
+
         # Compute spectrum
         spectrum_db, freq_axis = spectrum(sig, fs, db=True)
-            
-            
+
     # compute tnr values
     tones_freqs, pr_, prom, t_pr = _pr_main_calc(spectrum_db, freq_axis)
- 
-            
+
     # Retore the results in a time vs frequency array
     freqs = np.logspace(np.log10(90), np.log10(11200), num=1000)
     pr = np.empty((len(freqs), nseg))
     pr.fill(np.nan)
     promi = np.empty((len(freqs), nseg), dtype=bool)
     promi.fill(False)
-    
+
     for t in range(nseg):
         for f in range(len(tones_freqs[t])):
             ind = np.argmin(np.abs(freqs - tones_freqs[t][f]))
@@ -85,5 +87,4 @@ def pr_ecma_tv(signal, fs, prominence=True, overlap=0):
 
     t_pr = np.ravel(t_pr)
 
-    return t_pr, pr, promi, freqs, time 
-    
+    return t_pr, pr, promi, freqs, time
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_LTH.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_LTH.py
index 89446784..4f11022d 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_LTH.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_LTH.py
@@ -52,6 +52,6 @@ def _LTH(freqs):
             a5 = 15.61552048
 
         ff = (f - fmean) / fstd
-        LTH[i] = a1 * ff ** 4 + a2 * ff ** 3 + a3 * ff ** 2 + a4 * ff + a5
+        LTH[i] = a1 * ff**4 + a2 * ff**3 + a3 * ff**2 + a4 * ff + a5
 
     return LTH
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_critical_band.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_critical_band.py
index 92f487ce..b8c3e6f6 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_critical_band.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_critical_band.py
@@ -18,7 +18,7 @@ def _critical_band(f0):
         f2 = f0 + delta_fc / 2
 
     elif f0 >= 500:
-        f1 = -1 * delta_fc / 2 + np.sqrt(delta_fc ** 2 + 4 * f0 ** 2) / 2
+        f1 = -1 * delta_fc / 2 + np.sqrt(delta_fc**2 + 4 * f0**2) / 2
         f2 = f1 + delta_fc
 
     return f1, f2
@@ -44,7 +44,7 @@ def _lower_critical_band(f0):
         c1 = 0.806
         c2 = -8.2e-06
 
-    f1 = c0 + c1 * f0 + c2 * f0 ** 2
+    f1 = c0 + c1 * f0 + c2 * f0**2
 
     return f1, f2
 
@@ -65,6 +65,6 @@ def _upper_critical_band(f0):
         c1 = 1.215
         c2 = 2.16e-05
 
-    f2 = c0 + c1 * f0 + c2 * f0 ** 2
+    f2 = c0 + c1 * f0 + c2 * f0**2
 
     return f1, f2
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_peak_level.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_peak_level.py
index dbc9af1d..0404b629 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_peak_level.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_peak_level.py
@@ -39,7 +39,7 @@ def _peak_level(freqs, spec, peak_index):
 
     # Screen the right points of the peak
     temp = peak_index + 1
-    
+
     if temp != len(spec):
         Ltemp = Li
         # As long as the level decreases,
@@ -49,7 +49,7 @@ def _peak_level(freqs, spec, peak_index):
                 Ltemp = spec[temp]
                 # its level is summed up with the peak's one
                 L = 10 * np.log10(10 ** (L / 10) + 10 ** (spec[temp] / 10))
-                
+
                 temp += 1
                 if temp == len(spec):
                     temp -= 1
@@ -59,7 +59,7 @@ def _peak_level(freqs, spec, peak_index):
 
     # Screen the left points of the peak
     temp = peak_index - 1
-    
+
     if temp != -1:
         Ltemp = Li
         # As long as the level decreases,
@@ -69,9 +69,9 @@ def _peak_level(freqs, spec, peak_index):
                 Ltemp = spec[temp]
                 # its level is summed up with the peak's one
                 L = 10 * np.log10(10 ** (L / 10) + 10 ** (spec[temp] / 10))
-    
+
                 temp -= 1
-                if temp <0:
+                if temp < 0:
                     temp += 1
                     Ltemp = -1
             else:
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_screening_for_tones.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_screening_for_tones.py
index d9d8c4e4..5094d363 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_screening_for_tones.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_screening_for_tones.py
@@ -8,7 +8,9 @@
 import numpy as np
 
 # Mosqito functions import
-from mosqito.sq_metrics.tonality.tone_to_noise_ecma._spectrum_smoothing import _spectrum_smoothing
+from mosqito.sq_metrics.tonality.tone_to_noise_ecma._spectrum_smoothing import (
+    _spectrum_smoothing,
+)
 from mosqito.sq_metrics.tonality.tone_to_noise_ecma._LTH import _LTH
 from mosqito.sq_metrics.tonality.tone_to_noise_ecma._critical_band import _critical_band
 
@@ -52,24 +54,24 @@ def _screening_for_tones(freqs, spec_db, method, low_freq, high_freq):
     # Detection of the tonal candidates according to their level
 
     # Creation of the smoothed spectrum
-    smooth_spec = _spectrum_smoothing(freqs, spec_db.T, 24, low_freq, high_freq, freqs).T
-    
-    
+    smooth_spec = _spectrum_smoothing(
+        freqs, spec_db.T, 24, low_freq, high_freq, freqs
+    ).T
+
     n = spec_db.shape[0]
-    if len(spec_db.shape)>1:
-        m = spec_db.shape[1] 
-        stop = np.arange(1,n+1) * m -1
-        
+    if len(spec_db.shape) > 1:
+        m = spec_db.shape[1]
+        stop = np.arange(1, n + 1) * m - 1
+
     else:
         m = spec_db.shape[0]
         n = 1
         stop = [m]
-    
-    
+
     smooth_spec = smooth_spec.ravel()
     spec_db = spec_db.ravel()
     freqs = freqs.ravel()
- 
+
     if method == "smoothed":
 
         # Criteria 1 : the level of the spectral line is higher than the level of
@@ -116,18 +118,17 @@ def _screening_for_tones(freqs, spec_db, method, low_freq, high_freq):
 
     if n == 1:
         tones = []
-    else:   
-        tones = [[]for i in range(n)]
-        
+    else:
+        tones = [[] for i in range(n)]
+
     # Each candidate is evaluated
     while len(index) > 0:
         # Index of the candidate
         peak_index = index[0]
-        
+
         for i in range(n):
-            if (peak_index<stop[i]) & (peak_index>(stop[i]-m)):
+            if (peak_index < stop[i]) & (peak_index > (stop[i] - m)):
                 block = i
-                
 
         # Lower and higher limits of the tone width
         low_limit = peak_index
@@ -137,7 +138,7 @@ def _screening_for_tones(freqs, spec_db, method, low_freq, high_freq):
         temp = peak_index + 1
 
         # As long as the level decreases or remains above the smoothed spectrum,
-        while (spec_db[temp] > smooth_spec[temp] + 6) and (temp + 1 < (block+1)*m):
+        while (spec_db[temp] > smooth_spec[temp] + 6) and (temp + 1 < (block + 1) * m):
             # if a highest spectral line is found, it becomes the candidate
             if spec_db[temp] > spec_db[peak_index]:
                 peak_index = temp
@@ -147,7 +148,7 @@ def _screening_for_tones(freqs, spec_db, method, low_freq, high_freq):
         # Screen the left points of the peak
         temp = peak_index - 1
         # As long as the level decreases,
-        while (spec_db[temp] > smooth_spec[temp] + 6) and (temp +1 > (block)*m):
+        while (spec_db[temp] > smooth_spec[temp] + 6) and (temp + 1 > (block) * m):
             # if a highest spectral line is found, it becomes the candidate
             if spec_db[temp] > spec_db[peak_index]:
                 peak_index = temp
@@ -162,16 +163,15 @@ def _screening_for_tones(freqs, spec_db, method, low_freq, high_freq):
         t_width = freqs[high_limit] - freqs[low_limit]
 
         if t_width < cb_width:
-            if n>1:
-                tones[block] = np.append(tones[block], peak_index - block*m)
+            if n > 1:
+                tones[block] = np.append(tones[block], peak_index - block * m)
             else:
-                tones = np.append(tones, peak_index )
+                tones = np.append(tones, peak_index)
 
         # All the candidates already screened are deleted from the list
         sup = np.where(index <= high_limit)[0]
         index = np.delete(index, sup)
-    
-    tones = np.asarray(tones, dtype=object)
 
+    tones = np.asarray(tones, dtype=object)
 
     return tones
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_spectrum_smoothing.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_spectrum_smoothing.py
index 48314e58..44bf4358 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_spectrum_smoothing.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_spectrum_smoothing.py
@@ -57,7 +57,9 @@ def _spectrum_smoothing(freqs_in, spec, noct, low_freq, high_freq, freqs_out):
     # Each band is considered individually until all of them have been treated
     while nb_bands > 0:
         # Find the index of the spectral components within the frequency bin
-        bin_index = np.where((freqs_in >= filter_freqs[i, 0]) & (freqs_in <= filter_freqs[i, 2]))[0]
+        bin_index = np.where(
+            (freqs_in >= filter_freqs[i, 0]) & (freqs_in <= filter_freqs[i, 2])
+        )[0]
 
         # If the frequency bin is empty, it is deleted from the list
         if len(bin_index) == 0:
@@ -69,11 +71,31 @@ def _spectrum_smoothing(freqs_in, spec, noct, low_freq, high_freq, freqs_out):
             # The spectral components within the frequency bin are averaged on an energy basis
             spec_sum = np.zeros((nseg))
             for j in range(nseg):
-                if len(bin_index[(bin_index < stop[j]) & (bin_index > (stop[j] - nperseg))])!= 0:
-                    spec_sum[j] = np.mean(10** (spec[bin_index[(bin_index < stop[j]) & (bin_index > (stop[j] - nperseg))]]/ 10))
+                if (
+                    len(
+                        bin_index[
+                            (bin_index < stop[j]) & (bin_index > (stop[j] - nperseg))
+                        ]
+                    )
+                    != 0
+                ):
+                    spec_sum[j] = np.mean(
+                        10
+                        ** (
+                            spec[
+                                bin_index[
+                                    (bin_index < stop[j])
+                                    & (bin_index > (stop[j] - nperseg))
+                                ]
+                            ]
+                            / 10
+                        )
+                    )
                 else:
                     spec_sum[j] = 1e-12
-            smoothed_spectrum[i, :] = 10 * np.log10(spec_sum)# / len(bin_index[(bin_index < stop[j]) & (bin_index > (stop[j] - m))]))
+            smoothed_spectrum[i, :] = 10 * np.log10(
+                spec_sum
+            )  # / len(bin_index[(bin_index < stop[j]) & (bin_index > (stop[j] - m))]))
         nb_bands -= 1
         i += 1
     # Pose of the smoothed spectrum on the frequency-axis
@@ -82,16 +104,16 @@ def _spectrum_smoothing(freqs_in, spec, noct, low_freq, high_freq, freqs_out):
 
     # Index of the lower and higher limit of each frequency bin into the original spectrum
     for i in range(len(filter_freqs)):
-        low[i,:] = np.argmin(np.abs(freqs_out - filter_freqs[i, 0]))
-        high[i,:] = np.argmin(np.abs(freqs_out - filter_freqs[i, 2]))
+        low[i, :] = np.argmin(np.abs(freqs_out - filter_freqs[i, 0]))
+        high[i, :] = np.argmin(np.abs(freqs_out - filter_freqs[i, 2]))
     low = low.astype(int)
     high = high.astype(int)
 
     smooth_spec = np.zeros((nperseg, nseg))
     for i in range(nseg):
         for j in range(filter_freqs.shape[0]):
-            smooth_spec[low[j,i] : high[j,i], i] = smoothed_spectrum[j,i]
-    
+            smooth_spec[low[j, i] : high[j, i], i] = smoothed_spectrum[j, i]
+
     if smooth_spec.shape[1] == 1:
         smooth_spec = np.squeeze(smooth_spec)
 
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_tnr_main_calc.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_tnr_main_calc.py
index 69f69dca..d387fc6f 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_tnr_main_calc.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_tnr_main_calc.py
@@ -4,8 +4,12 @@
 
 # Local functions imports
 from mosqito.sq_metrics.tonality.tone_to_noise_ecma._critical_band import _critical_band
-from mosqito.sq_metrics.tonality.tone_to_noise_ecma._screening_for_tones import _screening_for_tones
-from mosqito.sq_metrics.tonality.tone_to_noise_ecma._find_highest_tone import _find_highest_tone
+from mosqito.sq_metrics.tonality.tone_to_noise_ecma._screening_for_tones import (
+    _screening_for_tones,
+)
+from mosqito.sq_metrics.tonality.tone_to_noise_ecma._find_highest_tone import (
+    _find_highest_tone,
+)
 from mosqito.sq_metrics.tonality.tone_to_noise_ecma._peak_level import _peak_level
 
 
@@ -39,38 +43,38 @@ def _tnr_main_calc(spectrum_db, freq_axis):
 
     #### Spectrum creation #######################################################
 
-
     if len(spectrum_db.shape) == 1:
         nseg = 1
         # Frequency axis of interest
         freq_index = np.where((freq_axis > 89.1) & (freq_axis < 11200))[0]
         freqs = freq_axis[freq_index]
         spec_db = spectrum_db[freq_index]
-        
+
     elif (len(spectrum_db.shape) > 1) & (len(freq_axis.shape) > 1):
         nseg = spectrum_db.shape[1]
-        freqs = [[]for i in range(nseg)]
-        spec_db = [[]for i in range(nseg)]
+        freqs = [[] for i in range(nseg)]
+        spec_db = [[] for i in range(nseg)]
         for i in range(nseg):
             # Frequency axis of interest
-            freq_index_rows = np.where((freq_axis[:,i] > 89.1) & (freq_axis[:,i] < 11200))[0]
-            freqs[i] = np.append(freqs[i],freq_axis[freq_index_rows,i])
-            spec_db[i] = np.append(spec_db[i],spectrum_db[freq_index_rows,i])
+            freq_index_rows = np.where(
+                (freq_axis[:, i] > 89.1) & (freq_axis[:, i] < 11200)
+            )[0]
+            freqs[i] = np.append(freqs[i], freq_axis[freq_index_rows, i])
+            spec_db[i] = np.append(spec_db[i], spectrum_db[freq_index_rows, i])
         freqs = np.asarray(freqs)
         spec_db = np.asarray(spec_db)
-    
+
     elif (len(spectrum_db.shape) > 1) & (len(freq_axis.shape) == 1):
         # Frequency axis of interest
         freq_index = np.where((freq_axis > 89.1) & (freq_axis < 11200))[0]
         # Initialization
-        nfreqs = len(freq_index)    
+        nfreqs = len(freq_index)
         nseg = spectrum_db.shape[1]
-        freqs = np.zeros((nseg,nfreqs))
-        spec_db = np.zeros((nseg,nfreqs))
+        freqs = np.zeros((nseg, nfreqs))
+        spec_db = np.zeros((nseg, nfreqs))
         for i in range(nseg):
-            freqs[i,:] = freq_axis[freq_index]
-            spec_db[i,:] = spectrum_db[freq_index,i]
-
+            freqs[i, :] = freq_axis[freq_index]
+            spec_db[i, :] = spectrum_db[freq_index, i]
 
     #### Screening to find the potential tonal components ########################
 
@@ -82,19 +86,18 @@ def _tnr_main_calc(spectrum_db, freq_axis):
         t_tnr = []
         tones_freqs = []
         prominence = []
-    else:   
-        TNR = [[]for i in range(nseg)]
-        t_tnr = [[]for i in range(nseg)]
-        tones_freqs = [[]for i in range(nseg)]
-        prominence = [[]for i in range(nseg)]
-    
+    else:
+        TNR = [[] for i in range(nseg)]
+        t_tnr = [[] for i in range(nseg)]
+        tones_freqs = [[] for i in range(nseg)]
+        prominence = [[] for i in range(nseg)]
 
     #### Evaluation of each candidate ############################################
 
     for i in range(nseg):
-        
+
         tnr = np.array([], dtype=object)
-        
+
         if nseg == 1:
             peaks = peak_index
             spec = spec_db
@@ -102,13 +105,13 @@ def _tnr_main_calc(spectrum_db, freq_axis):
             frs = freq_axis
         elif nseg > 1:
             peaks = peak_index[i]
-            spec = spec_db[i,:]
-            fr = freqs[i,:]
-            if len(freq_axis.shape)>1:
-                frs = freq_axis[:,i]
+            spec = spec_db[i, :]
+            fr = freqs[i, :]
+            if len(freq_axis.shape) > 1:
+                frs = freq_axis[:, i]
             else:
                 frs = freq_axis
-        
+
         nb_tones = len(peaks)
 
         # Each candidate is studied and then deleted from the list until all have been treated
@@ -121,74 +124,74 @@ def _tnr_main_calc(spectrum_db, freq_axis):
             else:
                 ind_p = ind
                 ind_s = None
-    
+
             # multiple tones in a critical band
             if ind_s != None:
                 fp = fr[ind_p]
                 fs = fr[ind_s]
-    
+
                 # proximity criterion
                 delta_f = 21 * 10 ** ((1.2 * (np.abs(np.log10(fp / 212))) ** 1.8))
                 if np.abs(fs - fp) < delta_f:
-    
+
                     # tone SPL
                     Lp = _peak_level(fr, spec, ind_p)
                     Ls = _peak_level(fr, spec, ind_s)
-    
+
                     Lt = 10 * np.log10(((10 ** (Lp / 10) + 10 ** (Ls / 10))))
-    
+
                     # total SPL in the critical band
                     f1, f2 = _critical_band(fp)
                     low_limit_idx = np.argmin(np.abs(fr - f1))
                     high_limit_idx = np.argmin(np.abs(fr - f2))
-    
+
                     spec_sum = sum(10 ** (spec[low_limit_idx:high_limit_idx] / 10))
                     Ltot = 10 * np.log10(spec_sum)
-    
+
                     # suppression of the second highest tone from the list of tones
                     sup = np.where(peaks == ind_s)[0]
                     peaks = np.delete(peaks, sup)
                     nb_tones -= 1
-    
+
                     delta_ft = 2 * (frs[1] - frs[0])
-    
+
                 else:
                     # the two highest tones are not close enough to be considered as one
                     # tone SPL
                     Lt = spec[ind_p]
-    
+
                     # total SPL in the critical band
                     f1, f2 = _critical_band(fr[ind_p])
                     low_limit_idx = np.argmin(np.abs(fr - f1))
                     high_limit_idx = np.argmin(np.abs(fr - f2))
-    
+
                     spec_sum = sum(10 ** (spec[low_limit_idx:high_limit_idx] / 10))
                     Ltot = 10 * np.log10(spec_sum)
-    
+
                     delta_ft = fr[1] - fr[0]
-    
+
             # single tone in a critical band
             else:
                 # tone SPL
                 Lt = _peak_level(fr, spec, ind_p)
-    
+
                 # total SPL in the critical band
                 f1, f2 = _critical_band(fr[ind_p])
                 low_limit_idx = np.argmin(np.abs(fr - f1))
                 high_limit_idx = np.argmin(np.abs(fr - f2))
-    
+
                 spec_sum = sum(10 ** (spec[low_limit_idx:high_limit_idx] / 10))
                 Ltot = 10 * np.log10(spec_sum)
-    
+
                 delta_ft = fr[1] - fr[0]
-    
+
             # SPL of the masking noise
             delta_fc = f2 - f1
             delta_ftot = frs[high_limit_idx] - frs[low_limit_idx]
             Ln = 10 * np.log10(10 ** (Ltot / 10) - 10 ** (Lt / 10)) + 10 * np.log10(
                 delta_fc / (delta_ftot - delta_ft)
             )
-    
+
             # Tone-to-noise ratio
             f = fr[ind_p]
             delta_t = Lt - Ln
@@ -198,57 +201,56 @@ def _tnr_main_calc(spectrum_db, freq_axis):
                 elif nseg == 1:
                     tones_freqs = np.append(tones_freqs, f)
                 tnr = np.append(tnr, delta_t)
-    
+
                 # Prominence criteria
                 if f >= 89.1 and f < 1000:
                     if delta_t >= 8 + 8.33 * np.log10(1000 / f):
                         if nseg > 1:
-                            prominence[i].append(True)                        
+                            prominence[i].append(True)
                         elif nseg == 1:
                             prominence.append(True)
                     else:
                         if nseg > 1:
                             prominence[i].append(False)
-                        
+
                         elif nseg == 1:
                             prominence.append(False)
                 elif f >= 1000 and f <= 11200:
                     if delta_t >= 8:
                         if nseg > 1:
                             prominence[i].append(True)
-                        
+
                         elif nseg == 1:
                             prominence.append(True)
                     else:
                         if nseg > 1:
                             prominence[i].append(False)
-                        
+
                         elif nseg == 1:
                             prominence.append(False)
-    
+
             # suppression from the list of tones
             sup = np.where(peaks == ind_p)[0]
             peaks = np.delete(peaks, sup)
             nb_tones -= 1
-    
 
         if nseg > 1:
             if sum(np.power(10, (tnr[prominence[i]] / 10))) != 0:
                 t_tnr[i] = 10 * np.log10(sum(np.power(10, (tnr[prominence[i]] / 10))))
             else:
-                t_tnr[i] =  0
-            TNR[i] = np.append(TNR[i], tnr)               
-                    
-                    
+                t_tnr[i] = 0
+            TNR[i] = np.append(TNR[i], tnr)
+
         elif nseg == 1:
             if sum(np.power(10, (tnr[prominence] / 10))) != 0:
-                t_tnr = np.append(t_tnr,10 * np.log10(sum(np.power(10, (tnr[prominence] / 10)))))
+                t_tnr = np.append(
+                    t_tnr, 10 * np.log10(sum(np.power(10, (tnr[prominence] / 10))))
+                )
             else:
-                t_tnr =  0
+                t_tnr = 0
             TNR = np.append(TNR, tnr)
-        
+
     tones_freqs = np.asarray(tones_freqs, dtype=object)
     prominence = np.asarray(prominence, dtype=object)
 
-    
-    return tones_freqs, TNR , prominence, t_tnr
+    return tones_freqs, TNR, prominence, t_tnr
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_freq.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_freq.py
index beaa46a5..a77bda0a 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_freq.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_freq.py
@@ -2,11 +2,13 @@
 
 # External import
 import numpy as np
+
 # Local functions imports
 from mosqito.sq_metrics.tonality.tone_to_noise_ecma._tnr_main_calc import _tnr_main_calc
 from mosqito.utils.conversion import amp2db
 
-def tnr_ecma_freq(spectrum, freqs,  prominence=True):
+
+def tnr_ecma_freq(spectrum, freqs, prominence=True):
     """Computation of tone-to-noise ration according to ECMA-74, annex D.9
     for an amplitude or complex spectrum.
         The T-TNR value is calculated according to ECMA-TR/108
@@ -16,7 +18,7 @@ def tnr_ecma_freq(spectrum, freqs,  prominence=True):
     spectrum :numpy.array
         Amplitude or complex frequency spectrum [nperseg x nseg].
     freqs : np.array
-        Frequency axis [nperseg x nseg] or [nperseg]. 
+        Frequency axis [nperseg x nseg] or [nperseg].
     prominence : boolean
         If True, the algorithm only returns the prominent tones, if False it returns all tones detected.
         Default is True.
@@ -32,16 +34,16 @@ def tnr_ecma_freq(spectrum, freqs,  prominence=True):
     tones_freqs : array of float
         Frequency list of the detected tones.
     """
-             
-    if len(spectrum) != len(freqs) :
-        raise ValueError('Input spectrum and frequency axis must have the same size')
-    
+
+    if len(spectrum) != len(freqs):
+        raise ValueError("Input spectrum and frequency axis must have the same size")
+
     # Compute spectrum dB values
     spectrum_db = amp2db(np.abs(spectrum), ref=2e-5)
-            
+
     # compute TNR values
     tones_freqs, tnr, prom, t_tnr = _tnr_main_calc(spectrum_db, freqs)
-  
+
     if prominence == False:
         return t_tnr, tnr, prom, tones_freqs
     else:
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_st.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_st.py
index 0c06b30a..6e9781da 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_st.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_st.py
@@ -31,14 +31,14 @@ def tnr_ecma_st(signal, fs, prominence=True):
     tones_freqs : array of float
         frequency of the detected tones
     """
-    
+
     # Compute db spectrum
     spectrum_db, freq_axis = spectrum(signal, fs, db=True)
-        
+
     # Compute tnr values
     tones_freqs, tnr, prom, t_tnr = _tnr_main_calc(spectrum_db, freq_axis)
     prom = prom.astype(bool)
-    
+
     if prominence == False:
         return t_tnr, tnr, prom, tones_freqs
     else:
diff --git a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_tv.py b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_tv.py
index 815da330..e40b5247 100644
--- a/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_tv.py
+++ b/mosqito/sq_metrics/tonality/tone_to_noise_ecma/tnr_ecma_tv.py
@@ -39,39 +39,39 @@ def tnr_ecma_tv(signal, fs, prominence=False, overlap=0):
     time  : array of float, only if is_stationary = False
         time axis
     """
-    
+
     if len(signal.shape) == 1:
-      
+
         # Number of points within each frame according to the time resolution of 500ms
         nperseg = int(0.5 * fs)
         # Overlappinf segment length
-        noverlap = int(overlap * nperseg)               
+        noverlap = int(overlap * nperseg)
         # Time segmentation of the signal
-        sig, time = time_segmentation(signal, fs, nperseg=nperseg, noverlap=noverlap, is_ecma=False)
+        sig, time = time_segmentation(
+            signal, fs, nperseg=nperseg, noverlap=noverlap, is_ecma=False
+        )
         # Number of segments
-        nseg = sig.shape[1] 
+        nseg = sig.shape[1]
         # Spectrum computation
         spectrum_db, freq_axis = spectrum(sig, fs, db=True)
-      
+
     else:
         nseg = signal.shape[1]
-        time = np.linspace(0, signal.shape[0]/fs, num=nseg)
-        
+        time = np.linspace(0, signal.shape[0] / fs, num=nseg)
+
         # Compute spectrum
         spectrum_db, freq_axis = spectrum(sig, fs, db=True)
-            
-            
+
     # compute tnr values
     tones_freqs, tnr_, prom, t_tnr = _tnr_main_calc(spectrum_db, freq_axis)
- 
-            
+
     # Retore the results in a time vs frequency array
     freqs = np.logspace(np.log10(90), np.log10(11200), num=1000)
     tnr = np.empty((len(freqs), nseg))
     tnr.fill(np.nan)
     promi = np.empty((len(freqs), nseg), dtype=bool)
     promi.fill(False)
-    
+
     for t in range(nseg):
         for f in range(len(tones_freqs[t])):
             ind = np.argmin(np.abs(freqs - tones_freqs[t][f]))
@@ -85,4 +85,4 @@ def tnr_ecma_tv(signal, fs, prominence=False, overlap=0):
 
     t_tnr = np.ravel(t_tnr)
 
-    return t_tnr, tnr, promi, freqs, time     
+    return t_tnr, tnr, promi, freqs, time
diff --git a/mosqito/utils/isoclose.py b/mosqito/utils/isoclose.py
index 953a8771..cc0678b9 100644
--- a/mosqito/utils/isoclose.py
+++ b/mosqito/utils/isoclose.py
@@ -10,11 +10,13 @@
 import numpy as np
 
 
-def isoclose(actual, desired, rtol=1e-7, atol=0, is_plot=False, tol_label=None, xaxis=None):
+def isoclose(
+    actual, desired, rtol=1e-7, atol=0, is_plot=False, tol_label=None, xaxis=None
+):
     """
     Check if two arrays are equal up to desired tolerance.
 
-    The test is inspired from section 5.1 of ISO 532-1. It compares 
+    The test is inspired from section 5.1 of ISO 532-1. It compares
     ``actual`` to ``desired +/- min(atol, rtol * abs(desired))``.
 
     Parameters
@@ -42,10 +44,8 @@ def isoclose(actual, desired, rtol=1e-7, atol=0, is_plot=False, tol_label=None,
     """
 
     # Tolerances
-    range_pos = np.amin(
-        [desired * (1 - abs(rtol)), desired - abs(atol)], axis=0)
-    range_neg = np.amax(
-        [desired * (1 + abs(rtol)), desired + abs(atol)], axis=0)
+    range_pos = np.amin([desired * (1 - abs(rtol)), desired - abs(atol)], axis=0)
+    range_neg = np.amax([desired * (1 + abs(rtol)), desired + abs(atol)], axis=0)
 
     # Test for ISO 532-1 comformance (section 5.1)
     is_isoclose = (actual >= range_pos).all() and (actual <= range_neg).all()
diff --git a/mosqito/utils/time_segmentation.py b/mosqito/utils/time_segmentation.py
index a1a7e06f..0affc95f 100644
--- a/mosqito/utils/time_segmentation.py
+++ b/mosqito/utils/time_segmentation.py
@@ -35,7 +35,7 @@ def time_segmentation(sig, fs, nperseg=2048, noverlap=None, is_ecma=False):
 
     if noverlap is None:
         noverlap = int(nperseg / 2)
-        
+
     if noverlap == 0:
         noverlap = nperseg
 
diff --git a/validations/sq_metrics/loudness_ecma/hearing_model_validation.py b/validations/sq_metrics/loudness_ecma/hearing_model_validation.py
index 85fba161..dfe2d2f0 100644
--- a/validations/sq_metrics/loudness_ecma/hearing_model_validation.py
+++ b/validations/sq_metrics/loudness_ecma/hearing_model_validation.py
@@ -17,18 +17,21 @@
 )
 
 
-def comp_loudness_wrapper(spl, freq=1000, n_1kHz=0):
-    """Return the difference between the loudness of a tone
-    at <freq> Hz and <spl> dB and a tone at 1 KHz and <spl> dB
+def comp_loudness_wrapper(spl, freq, phon_1kHz):
+    """Return the difference between the loudness of a tone at <freq> Hz
+    and <spl> dB SPL and a reference tone at 1 KHz and <phon_1kHz> dB SPL.
 
     Parameters
     ----------
     spl: float
         Test tone Sound Pressure Level [dB]
+
     freq: float
         Test tone frequency [Hz]
-    n_1kHz: float
-        Total loudness value of a 1 kHz / <spl> dB test tone
+
+    phon_1kHz: float
+        SPL of the 1 kHz reference tone [dB]
+
 
     Returns
     -------
@@ -37,21 +40,22 @@ def comp_loudness_wrapper(spl, freq=1000, n_1kHz=0):
 
     """
 
-    # test signal generation
-    duration = 0.25
+    # signal generation
+    duration = 0.5
     fs = 48000.0
+
     signal, _ = sine_wave_generator(fs, duration, spl, freq)
+    signal_1kHz, _ = sine_wave_generator(fs, duration, spl_value=phon_1kHz, freq=1000)
 
     # compute loudness for the test signal
-    n_specific, _ = loudness_ecma(signal)
-    n_specific = np.array(n_specific)
-    n_tot = np.sum(n_specific, axis=0)
-    n_tot_mean = np.mean(n_tot[5:])
+    N, _, N_spec, _, _ = loudness_ecma(signal_1kHz, fs)
+    N_spec = np.array(N_spec)
 
-    # Return n_tot_mean - n_1kHz
-    n_diff = n_tot_mean - n_1kHz
+    # Compute loudness for 1 kHz tone at 'phon_1kHz' dB SPL
+    N_1kHz, _, N_spec_1kHz, _, _ = loudness_ecma(signal, fs)
+    N_spec_1kHz = np.array(N_spec_1kHz)
 
-    return n_diff
+    return N - N_1kHz
 
 
 def hearing_model_validation():
@@ -61,7 +65,7 @@ def hearing_model_validation():
     if plt is None:
         raise RuntimeError(
             "In order to make this validation plot you need the 'matplotlib' package."
-            )
+        )
 
     phons = [80, 60, 40, 20]
 
@@ -74,7 +78,7 @@ def hearing_model_validation():
         spl_iso_vec, freq_vec = equal_loudness_contours(phon)
 
         # Compute ecma loudness of a 1 kHz tone
-        n_1kHz = comp_loudness_wrapper(spl=phon)
+        # n_1kHz = comp_loudness_wrapper(spl=phon)
         spl_ecma_vec = np.zeros(spl_iso_vec.shape)
         spl_ecma_vec[17] = phon
 
@@ -83,29 +87,42 @@ def hearing_model_validation():
             if i != 17:
                 spl = spl_iso_vec[i]
                 freq = freq_vec[i]
+
+                print(f"\tFreq: {freq} Hz")
+
                 # ... find the spl of the tone that produces the
                 # same loudness as the 1 kHz tone
                 spl_ecma_vec[i] = root_scalar(
-                    comp_loudness_wrapper,
-                    x0=spl,
-                    args=(freq, n_1kHz),
-                    bracket=[-5, 120],
+                    comp_loudness_wrapper, x0=spl, args=(freq, phon), bracket=[-5, 120]
                 ).root
+
         # Plot the ISO 226 equal loudness contour
         plt.semilogx(freq_vec, spl_iso_vec, ":", color=col)
+
         # Plot the ECMA equal contour loudness
         if phon == 0:
             label = "lower treshold of hearing"
         else:
             label = str(phon) + " phon"
-        plt.semilogx(freq_vec[5:], spl_ecma_vec[5:], color=col, label=label)
+
+        plt.semilogx(freq_vec[5:], spl_ecma_vec[5:], color=col)
+        plt.text(1000, phon + 5, label, fontsize=12, color=col)
 
     plt.xlim(left=80, right=11000)
     plt.ylim((-15, 105))
     plt.ylabel("Sound Pressure Level [dB]")
     plt.xlabel("Frequency [Hz]")
     plt.grid(which="both", linestyle="-", color="grey")
-    plt.legend()
+
+    # create custom artist for legend
+    from matplotlib.lines import Line2D
+
+    lines = [Line2D([0], [0], linestyle=":"), Line2D([0], [0], linestyle="-")]
+
+    plt.legend(
+        handles=lines,
+        labels=["ISO 226 Equal Loudness Contours", "MoSQITo [ECMA 418-2 (2022)]"],
+    )
     plt.savefig(
         "./validations/sq_metrics/loudness_ecma/output/"
         + "ecma_hearing_model_validation.png",
diff --git a/validations/sq_metrics/loudness_ecma/input/ear_filter_ecma.py b/validations/sq_metrics/loudness_ecma/input/ear_filter_ecma.py
index fe76a87e..917e025a 100644
--- a/validations/sq_metrics/loudness_ecma/input/ear_filter_ecma.py
+++ b/validations/sq_metrics/loudness_ecma/input/ear_filter_ecma.py
@@ -128,4 +128,4 @@
     -20.859756,
     -22.481707,
     -24.871952,
-]
\ No newline at end of file
+]
diff --git a/validations/sq_metrics/loudness_ecma/output/ecma_hearing_model_validation.png b/validations/sq_metrics/loudness_ecma/output/ecma_hearing_model_validation.png
index cd97b738..7db33641 100644
Binary files a/validations/sq_metrics/loudness_ecma/output/ecma_hearing_model_validation.png and b/validations/sq_metrics/loudness_ecma/output/ecma_hearing_model_validation.png differ
diff --git a/validations/sq_metrics/loudness_ecma/output/validation_auditory_filter.png b/validations/sq_metrics/loudness_ecma/output/validation_auditory_filter.png
index 01e63b56..534247f7 100644
Binary files a/validations/sq_metrics/loudness_ecma/output/validation_auditory_filter.png and b/validations/sq_metrics/loudness_ecma/output/validation_auditory_filter.png differ
diff --git a/validations/sq_metrics/loudness_ecma/output/validation_ear_filter_design.png b/validations/sq_metrics/loudness_ecma/output/validation_ear_filter_design.png
index 2cdc8744..9682d56e 100644
Binary files a/validations/sq_metrics/loudness_ecma/output/validation_ear_filter_design.png and b/validations/sq_metrics/loudness_ecma/output/validation_ear_filter_design.png differ
diff --git a/validations/sq_metrics/loudness_ecma/valid_ear_filter_design.py b/validations/sq_metrics/loudness_ecma/valid_ear_filter_design.py
index d9b97639..dc7ae984 100644
--- a/validations/sq_metrics/loudness_ecma/valid_ear_filter_design.py
+++ b/validations/sq_metrics/loudness_ecma/valid_ear_filter_design.py
@@ -4,10 +4,9 @@
 except ImportError:
     raise RuntimeError(
         "In order to perform this validation you need the 'matplotlib' package."
-        )
-
+    )
 
-import scipy.signal as sp_signal
+from scipy.signal import sos2tf, sosfreqz, sosfilt
 from numpy import (
     log10,
     abs as np_abs,
@@ -33,10 +32,10 @@
 # generate outer and middle/inner ear filter coeeficient
 sos_ear = _ear_filter_design()
 
-b, a = sp_signal.sos2tf(sos_ear)
+b, a = sos2tf(sos_ear)
 
 # Compute the frequency response of the filter
-w, h = sp_signal.sosfreqz(sos_ear, worN=1500, fs=48000)
+w, h = sosfreqz(sos_ear, worN=1500, fs=48000)
 db = 20 * log10(np_maximum(np_abs(h), 1e-5))
 
 # Apply filter on sine wave for test
@@ -52,10 +51,9 @@
         freq=f,
     )
     # Filter
-    signal_filtered = sp_signal.sosfilt(sos_ear, signal, axis=0)
+    signal_filtered = sosfilt(sos_ear, signal, axis=0)
     level.append(
-        20 * log10(sqrt(mean(signal_filtered ** 2)))
-        - 20 * log10(sqrt(mean(signal ** 2)))
+        20 * log10(sqrt(mean(signal_filtered**2))) - 20 * log10(sqrt(mean(signal**2)))
     )
     freq.append(f)
     f *= 2
@@ -76,4 +74,4 @@
     + "validation_ear_filter_design.png",
     format="png",
 )
-plt.clf()
\ No newline at end of file
+plt.clf()
diff --git a/validations/sq_metrics/loudness_ecma/valid_gammatone.py b/validations/sq_metrics/loudness_ecma/valid_gammatone.py
index 69d2f07f..d9cf8ecc 100644
--- a/validations/sq_metrics/loudness_ecma/valid_gammatone.py
+++ b/validations/sq_metrics/loudness_ecma/valid_gammatone.py
@@ -4,11 +4,11 @@
 except ImportError:
     raise RuntimeError(
         "In order to perform this validation you need the 'matplotlib' package."
-        )
+    )
 
 
 from scipy.signal import gammatone as scipy_gamma, freqz
-from numpy import log10, abs as np_abs
+import numpy as np
 
 from mosqito.sq_metrics.loudness.loudness_ecma._gammatone import (
     _gammatone as mosqito_gamma,
@@ -25,7 +25,28 @@
 freq = centre_freq[17]
 
 # Compute auditory filter coefficients
-b, a = mosqito_gamma(freq, is_plot=True)
+b, a = mosqito_gamma(freq)
+
+m = np.arange(6)
+exponential = np.exp(+1j * 2 * np.pi * freq * m / fs)
+
+am = a / exponential
+bm = b / exponential[:-1]
+
+
+w, h = freqz(bm, am, worN=round(fs / 2), fs=fs)
+h_db = 20.0 * np.log10(np.abs(h))
+plt.semilogx(w, h_db, label="am, bm from eq. 14 and 15")
+
+w, h = freqz(b, a, worN=round(fs / 2), fs=fs)
+h_db = 20.0 * np.log10(np.abs(h))
+plt.semilogx(w, h_db, label="am', bm' from eq. 16 and 17")
+
+plt.xlabel("Frequency [Hz]")
+plt.ylabel("Amplitude [dB]")
+plt.grid(which="both", axis="both")
+plt.legend()
+
 plt.title(
     "Auditory filter for critical band 18 (centre freq = " + str(int(freq)) + " Hz)"
 )
@@ -37,12 +58,12 @@
 
 # Compare MOSQITO filter with Scipy one
 w, h = freqz(b, a, worN=round(fs / 2), fs=fs)
-h_db = 20.0 * log10(np_abs(h))
+h_db = 20.0 * np.log10(np.abs(h))
 plt.semilogx(w, h_db, label="mosqito")
 
 b, a = scipy_gamma(freq, "iir", fs=fs)
 w, h = freqz(b, a, worN=round(fs / 2), fs=fs)
-h_db = 20.0 * log10(np_abs(h))
+h_db = 20.0 * np.log10(np.abs(h))
 plt.semilogx(w, h_db, label="scipy")
 
 plt.title("Gammatone filter frequency response")
@@ -53,4 +74,4 @@
 plt.savefig(
     "./validations/sq_metrics/loudness_ecma/output/" + "comparison_auditory_filter.png",
     format="png",
-)
\ No newline at end of file
+)
diff --git a/validations/sq_metrics/loudness_ecma/valid_segmentation.py b/validations/sq_metrics/loudness_ecma/valid_segmentation.py
index 4bfd5292..37dc7291 100644
--- a/validations/sq_metrics/loudness_ecma/valid_segmentation.py
+++ b/validations/sq_metrics/loudness_ecma/valid_segmentation.py
@@ -9,8 +9,12 @@
 
 # Local application imports
 from mosqito.utils import sine_wave_generator
-from mosqito.utils import time_segmentation
-
+from mosqito.sq_metrics.loudness.loudness_ecma._ecma_time_segmentation import (
+    _ecma_time_segmentation,
+)
+from mosqito.sq_metrics.loudness.loudness_ecma._band_pass_signals import (
+    _band_pass_signals,
+)
 
 signal, _ = sine_wave_generator(
     fs=48000,
@@ -18,14 +22,15 @@
     spl_value=60,
     freq=40,
 )
-blocks, _ = time_segmentation(signal, 48000, 8192, 2048, is_ecma=True)
+block_signals = _band_pass_signals(signal)
+blocks, time = _ecma_time_segmentation(block_signals, 8192, 2048, 12288)
 
 plt.subplot(211)
 plt.plot(signal)
 plt.subplot(212)
-plt.plot(blocks[:, 0], label="block 1")
-plt.plot(blocks[:, 1], label="block 2")
-plt.plot(blocks[:, 2], label="block 3")
-plt.plot(blocks[:, 5], label="block 6")
+plt.plot(time[0][0, :], blocks[0][0, :], label="block 1")
+plt.plot(time[0][1, :], blocks[0][1, :], label="block 2")
+plt.plot(time[0][2, :], blocks[0][2, :], label="block 3")
+plt.plot(time[0][5, :], blocks[0][5, :], label="block 6")
 plt.legend()
-plt.show()
\ No newline at end of file
+plt.show(block=True)
diff --git a/validations/sq_metrics/loudness_zwst/validation_loudness_zwst.py b/validations/sq_metrics/loudness_zwst/validation_loudness_zwst.py
index e10ac187..7a6333b1 100644
--- a/validations/sq_metrics/loudness_zwst/validation_loudness_zwst.py
+++ b/validations/sq_metrics/loudness_zwst/validation_loudness_zwst.py
@@ -48,9 +48,7 @@ def validation_loudness_zwst_3oct():
     # Load ISO reference outputs
     file_path = "input/ISO_532_1/test_signal_1.csv"
     N_iso = 83.296
-    N_specif_iso = np.genfromtxt(
-        file_path, skip_header=1
-    )
+    N_specif_iso = np.genfromtxt(file_path, skip_header=1)
 
     # Compute loudness
     Nm = _main_loudness(test_signal_1, field_type="free")
@@ -59,14 +57,27 @@ def validation_loudness_zwst_3oct():
     bark_axis = np.linspace(0.1, 24, int(24 / 0.1))
 
     # Test
-    is_isoclose_N = isoclose(N, N_iso, rtol=5/100,
-                             atol=0.1, is_plot=False, xaxis=None)
+    is_isoclose_N = isoclose(
+        N, N_iso, rtol=5 / 100, atol=0.1, is_plot=False, xaxis=None
+    )
     is_isoclose_N_specific = isoclose(
-        N_specific, N_specif_iso, rtol=5/100, atol=0.1, is_plot=True, tol_label='ISO 532-1 tolerance', xaxis=bark_axis)
+        N_specific,
+        N_specif_iso,
+        rtol=5 / 100,
+        atol=0.1,
+        is_plot=True,
+        tol_label="ISO 532-1 tolerance",
+        xaxis=bark_axis,
+    )
 
     # Format and save validation plot
-    _format_plot(is_isoclose_N, is_isoclose_N_specific, N,
-                 N_iso, splitext(basename(file_path))[0])
+    _format_plot(
+        is_isoclose_N,
+        is_isoclose_N_specific,
+        N,
+        N_iso,
+        splitext(basename(file_path))[0],
+    )
 
 
 def validation_loudness_zwst():
@@ -115,7 +126,7 @@ def validation_loudness_zwst():
 
     for signal in signals:
         # Load signal and compute third octave band spectrum
-        sig, fs = load(signal["data_file"], wav_calib=2 * 2 ** 0.5)
+        sig, fs = load(signal["data_file"], wav_calib=2 * 2**0.5)
 
         # Compute Loudness
         N, N_specific, bark_axis = loudness_zwst(sig, fs)
@@ -125,34 +136,51 @@ def validation_loudness_zwst():
         N_specif_iso = np.genfromtxt(signal["N_specif_file"], skip_header=1)
 
         # Test
-        is_isoclose_N = isoclose(N, N_iso, rtol=5/100,
-                                 atol=0.1, is_plot=False, xaxis=None)
+        is_isoclose_N = isoclose(
+            N, N_iso, rtol=5 / 100, atol=0.1, is_plot=False, xaxis=None
+        )
         is_isoclose_N_specific = isoclose(
-            N_specific, N_specif_iso, rtol=5/100, atol=0.1, is_plot=True, tol_label='ISO 532-1 tolerance', xaxis=bark_axis)
+            N_specific,
+            N_specif_iso,
+            rtol=5 / 100,
+            atol=0.1,
+            is_plot=True,
+            tol_label="ISO 532-1 tolerance",
+            xaxis=bark_axis,
+        )
 
         # Format and save validation plot
-        _format_plot(is_isoclose_N, is_isoclose_N_specific, N,
-                     N_iso, splitext(basename(signal["data_file"]))[0])
+        _format_plot(
+            is_isoclose_N,
+            is_isoclose_N_specific,
+            N,
+            N_iso,
+            splitext(basename(signal["data_file"]))[0],
+        )
 
 
 def _format_plot(is_isoclose_N, is_isoclose_N_specific, N, N_iso, filename):
     # Format plot
-    plt.xlabel('Critical band rate [Bark]')
-    plt.ylabel('N\'_zwst [sone/Bark]')
-    color = 'tab:green'
+    plt.xlabel("Critical band rate [Bark]")
+    plt.ylabel("N'_zwst [sone/Bark]")
+    color = "tab:green"
     if is_isoclose_N:
         txt_label = "N within tolerance (%.1f sone for an ISO value of %.1f sone)" % (
-            N, N_iso)
+            N,
+            N_iso,
+        )
     else:
         txt_label = "N without tolerance (%.1f sone for an ISO value of %.1f sone)" % (
-            N, N_iso)
-        color = 'tab:red'
+            N,
+            N_iso,
+        )
+        color = "tab:red"
     if is_isoclose_N_specific:
-        txt_label += '\n N\' within tolerance'
+        txt_label += "\n N' within tolerance"
     else:
-        txt_label += '\n N\' without tolerance'
-        color = 'tab:red'
-    props = dict(boxstyle='round', facecolor=color, alpha=0.3)
+        txt_label += "\n N' without tolerance"
+        color = "tab:red"
+    props = dict(boxstyle="round", facecolor=color, alpha=0.3)
     plt.text(
         0.5,
         0.05,
@@ -164,8 +192,7 @@ def _format_plot(is_isoclose_N, is_isoclose_N_specific, N, N_iso, filename):
     )
     out_dir = "output/"
     plt.savefig(
-        out_dir + 'validation_loudness_zwst_' +
-        "_".join(filename.split(" ")) + ".png",
+        out_dir + "validation_loudness_zwst_" + "_".join(filename.split(" ")) + ".png",
         format="png",
     )
     plt.close()
diff --git a/validations/sq_metrics/loudness_zwtv/validation_loudness_zwtv.py b/validations/sq_metrics/loudness_zwtv/validation_loudness_zwtv.py
index 9b0a89db..305da37f 100644
--- a/validations/sq_metrics/loudness_zwtv/validation_loudness_zwtv.py
+++ b/validations/sq_metrics/loudness_zwtv/validation_loudness_zwtv.py
@@ -10,7 +10,7 @@
 except ImportError:
     raise RuntimeError(
         "In order to perform this validation you need the 'matplotlib' package."
-        )
+    )
 
 # Third party imports
 import numpy as np
@@ -193,16 +193,18 @@ def validation_loudness_zwtv(signal):
     """
 
     # Load signal and compute third octave band spectrum
-    sig, fs = load(signal["data_file"], wav_calib=2 * 2 ** 0.5)
+    sig, fs = load(signal["data_file"], wav_calib=2 * 2**0.5)
 
     # Compute Loudness
 
     start = time.time()
     N, N_spec, bark_axis, _ = loudness_zwtv(sig, fs, signal["field"])
     end = time.time()
-    print("[Info] " + signal["tab"] +
-          " loudness_zwtv computation: {:2.2f} s".format(end - start)
-          )
+    print(
+        "[Info] "
+        + signal["tab"]
+        + " loudness_zwtv computation: {:2.2f} s".format(end - start)
+    )
 
     loudness = {
         "name": "Loudness",
@@ -212,9 +214,7 @@ def validation_loudness_zwtv(signal):
     }
 
     # Check ISO 532-1 compliance
-    _check_compliance(
-        loudness, signal, "output/"
-    )
+    _check_compliance(loudness, signal, "output/")
 
 
 def _check_compliance(loudness, signal, out_dir):
@@ -270,7 +270,9 @@ def _check_compliance(loudness, signal, out_dir):
             header=None,
             skiprows=10,
             usecols="B",
-        ).squeeze("columns").to_numpy()
+        )
+        .squeeze("columns")
+        .to_numpy()
     )
     N_iso = N_iso[~np.isnan(N_iso)]
     N_specif_iso = np.transpose(
@@ -280,7 +282,9 @@ def _check_compliance(loudness, signal, out_dir):
             header=None,
             skiprows=10,
             usecols="L",
-        ).squeeze("columns").to_numpy()
+        )
+        .squeeze("columns")
+        .to_numpy()
     )
     N_specif_iso = N_specif_iso[~np.isnan(N_specif_iso)]
 
@@ -336,8 +340,7 @@ def _check_compliance(loudness, signal, out_dir):
             # Data to plot
             Ni = [N, N_specific[i_bark, :]]
             Ni_ref = [N_iso, N_specif_iso]
-            Ni_label = ["Loudness",
-                        "Specific loudness at " + str(bark) + " Bark"]
+            Ni_label = ["Loudness", "Specific loudness at " + str(bark) + " Bark"]
         else:
             #
             # Data to plot
@@ -371,10 +374,8 @@ def _check_compliance(loudness, signal, out_dir):
                 )
             #
             # Check compliance
-            comp_10 = np.array([comp[0, i] and comp[3, i]
-                                for i in np.arange(N.size)])
-            comp_5 = np.array([comp[1, i] and comp[2, i]
-                               for i in np.arange(N.size)])
+            comp_10 = np.array([comp[0, i] and comp[3, i] for i in np.arange(N.size)])
+            comp_5 = np.array([comp[1, i] and comp[2, i] for i in np.arange(N.size)])
             ind_10 = np.nonzero(comp_10 == 0)[0]
             ind_5 = np.nonzero(comp_5 == 0)[0]
             if ind_5.size == 0:
diff --git a/validations/sq_metrics/roughness_dw/comparison_roughness_danielweber.py b/validations/sq_metrics/roughness_dw/comparison_roughness_danielweber.py
index 263747c3..d9b0bcfc 100644
--- a/validations/sq_metrics/roughness_dw/comparison_roughness_danielweber.py
+++ b/validations/sq_metrics/roughness_dw/comparison_roughness_danielweber.py
@@ -64,10 +64,8 @@ def comparison_roughness():
     axs1.plot(
         fmod[0:12], r_dw[0, 0:12], marker="x", color="red", label="Daniel and Weber"
     )
-    axs1.plot(fmod[0:12], r_ps[0, 0:12], marker="o",
-              color="#0069a1", label="Psysound")
-    axs1.plot(fmod[0:12], R[0, 0:12], marker="s",
-              color="#69c3c5", label="mosqito")
+    axs1.plot(fmod[0:12], r_ps[0, 0:12], marker="o", color="#0069a1", label="Psysound")
+    axs1.plot(fmod[0:12], R[0, 0:12], marker="s", color="#69c3c5", label="mosqito")
     axs1.set(xlim=(0, 170), ylim=(0, 1.1))
     axs1.set_title("Carrier frequency of 250 Hz", fontsize=11)
     axs1.legend(loc="upper right", shadow=True)
diff --git a/validations/sq_metrics/roughness_dw/validation_roughness_danielweber.py b/validations/sq_metrics/roughness_dw/validation_roughness_danielweber.py
index bb5dcce7..f3ec0843 100644
--- a/validations/sq_metrics/roughness_dw/validation_roughness_danielweber.py
+++ b/validations/sq_metrics/roughness_dw/validation_roughness_danielweber.py
@@ -238,8 +238,7 @@ def _check_compliance(R, signal):
         label="17% tolerance",
         linewidth=1,
     )
-    plt.plot(fc, tol_curve_max, color="red",
-             linestyle="solid", label="", linewidth=1)
+    plt.plot(fc, tol_curve_max, color="red", linestyle="solid", label="", linewidth=1)
     plt.legend()
 
     # Compliance plot
diff --git a/validations/sq_metrics/sharpness_din/validation_sharpness_din.py b/validations/sq_metrics/sharpness_din/validation_sharpness_din.py
index 1203acfd..8e629467 100644
--- a/validations/sq_metrics/sharpness_din/validation_sharpness_din.py
+++ b/validations/sq_metrics/sharpness_din/validation_sharpness_din.py
@@ -302,11 +302,7 @@ def _check_compliance(sharpness, reference, noise_type):
     plt.ylabel("Sharpness, [acum]")
 
     plt.savefig(
-        "output/"
-        + "validation_sharpness_"
-        + noise_type
-        + "_noise"
-        + ".png",
+        "output/" + "validation_sharpness_" + noise_type + "_noise" + ".png",
         format="png",
     )
     plt.clf()
diff --git a/validations/sq_metrics/speech_intelligibility/validation_sii.py b/validations/sq_metrics/speech_intelligibility/validation_sii.py
index b502db9d..af5ddcd6 100644
--- a/validations/sq_metrics/speech_intelligibility/validation_sii.py
+++ b/validations/sq_metrics/speech_intelligibility/validation_sii.py
@@ -11,14 +11,17 @@
 from numpy import array, empty, amin, amax, zeros, log10, maximum, float64
 
 # Local application imports
-from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import  _get_third_octave_band_data
+from mosqito.sq_metrics.speech_intelligibility.sii_ansi._band_procedure_data import (
+    _get_third_octave_band_data,
+)
 from mosqito.sq_metrics.speech_intelligibility.sii_ansi._main_sii import _main_sii
 
 # Reference values from ANSI S3.5 standard
 reference = empty(2, dtype=dict)
 
-reference[0] = {"noise_spectrum": array([70, 65, 45, 25, 1, -15]),
-    "speech_spectrum": array([50, 40, 40, 30, 20, 0]),         
+reference[0] = {
+    "noise_spectrum": array([70, 65, 45, 25, 1, -15]),
+    "speech_spectrum": array([50, 40, 40, 30, 20, 0]),
     "freq_axis": array([250, 500, 1000, 2000, 4000, 8000]),
     "method": "octave",
     "SII": 0.504,
@@ -26,69 +29,33 @@
 }
 
 
-reference[1] = {"noise_spectrum": array([
-        40,
-        30,
-        20,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0    ]
-), 
-    "speech_spectrum": array([
-        54,
-        54,
-        54,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0    ]
-),         
-    "freq_axis": array(        [
-        160,
-        200,
-        250,
-        315,
-        400,
-        500,
-        630,
-        800,
-        1000,
-        1250,
-        1600,
-        2000,
-        2500,
-        3150,
-        4000,
-        5000,
-        6300,
-        8000
+reference[1] = {
+    "noise_spectrum": array([40, 30, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
+    "speech_spectrum": array([54, 54, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
+    "freq_axis": array(
+        [
+            160,
+            200,
+            250,
+            315,
+            400,
+            500,
+            630,
+            800,
+            1000,
+            1250,
+            1600,
+            2000,
+            2500,
+            3150,
+            4000,
+            5000,
+            6300,
+            8000,
         ]
-),
+    ),
     "method": "third_octave",
-    "SII_spec": array([40,34.66,25.04]),
+    "SII_spec": array([40, 34.66, 25.04]),
 }
 
 
@@ -102,20 +69,31 @@ def validation_sii_octave(reference):
 
     """
     # Compute SII
-    SII, SII_spec, _ = _main_sii(reference["method"], reference["speech_spectrum"], reference["noise_spectrum"], threshold=None)
+    SII, SII_spec, _ = _main_sii(
+        reference["method"],
+        reference["speech_spectrum"],
+        reference["noise_spectrum"],
+        threshold=None,
+    )
 
     plt.figure()
 
     # Frequency bark axis
     freqs = reference["freq_axis"]
 
-    tstS = (SII_spec >= amin([reference["SII_spec"] * 0.99, reference["SII_spec"] - 0.01], axis=0)).all() and (
-        SII_spec <= amax([reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0)
+    tstS = (
+        SII_spec
+        >= amin([reference["SII_spec"] * 0.99, reference["SII_spec"] - 0.01], axis=0)
+    ).all() and (
+        SII_spec
+        <= amax([reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0)
     ).all()
 
     # Tolerance curves definition
     tol_low = amin([reference["SII_spec"] * 0.99, reference["SII_spec"] - 0.01], axis=0)
-    tol_high = amax([reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0)
+    tol_high = amax(
+        [reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0
+    )
 
     # Plot tolerance curves
     plt.plot(
@@ -147,17 +125,20 @@ def validation_sii_octave(reference):
 
     # Plot the calculated sharpness
     plt.plot(freqs, SII_spec, label="MOSQITO")
-    plt.title("Speech intelligibility index = "+f"{SII:.3f}"+"\n Octave band procedure", fontsize=10)
+    plt.title(
+        "Speech intelligibility index = " + f"{SII:.3f}" + "\n Octave band procedure",
+        fontsize=10,
+    )
     plt.legend()
     plt.xlabel("Center frequency [Hz]")
     plt.ylabel("Specific SII")
     plt.savefig(
-        "validations/sq_metrics/speech_intelligibility/output/"
-        + "validation_sii.png",
+        "validations/sq_metrics/speech_intelligibility/output/" + "validation_sii.png",
         format="png",
     )
     plt.clf()
-    
+
+
 def validation_sii_third_octave(reference):
     """Test function for the script _main_sii with third octave band procedure
 
@@ -167,45 +148,66 @@ def validation_sii_third_octave(reference):
     One .png compliance plot is generated.
 
     """
-    
+
     noise_spectrum = reference["noise_spectrum"]
     speech_spectrum = reference["speech_spectrum"]
-    
+
     # Get band data for third-octave procedure
-    CENTER_FREQUENCIES, _, _, BANDWIDTH_ADJUSTEMENT, _, _, _ = _get_third_octave_band_data()
+    CENTER_FREQUENCIES, _, _, BANDWIDTH_ADJUSTEMENT, _, _, _ = (
+        _get_third_octave_band_data()
+    )
     nbands = len(CENTER_FREQUENCIES)
-    
+
     T = zeros((nbands))
-        
+
     # STEP 3
     V = speech_spectrum - 24
     B = maximum(noise_spectrum, V)
-    C = -80 + 0.6 * (B + 10*log10(CENTER_FREQUENCIES)-6.353)
+    C = -80 + 0.6 * (B + 10 * log10(CENTER_FREQUENCIES) - 6.353)
     Z = zeros((nbands))
-    for i in range(nbands): 
+    for i in range(nbands):
         s = 0
         for k in range(i):
-            s += 10**(0.1*(B[k] + 3.32 * C[k] * log10(0.89 * CENTER_FREQUENCIES[i] / CENTER_FREQUENCIES[k])))
-        Z[i] = 10 * log10(10**(0.1*noise_spectrum[i]) + s)
+            s += 10 ** (
+                0.1
+                * (
+                    B[k]
+                    + 3.32
+                    * C[k]
+                    * log10(0.89 * CENTER_FREQUENCIES[i] / CENTER_FREQUENCIES[k])
+                )
+            )
+        Z[i] = 10 * log10(10 ** (0.1 * noise_spectrum[i]) + s)
     # 4.3.2.4
     Z[0] = B[0]
-    
+
     plt.figure()
-    
+
     # Frequency bark axis
     freqs = reference["freq_axis"]
 
-    tstS = (Z[:3] >= amin([reference["SII_spec"] * 0.99, reference["SII_spec"] - 0.01], axis=0)).all() and (
-       Z[:3] <= amax([reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0)
+    tstS = (
+        Z[:3]
+        >= amin([reference["SII_spec"] * 0.99, reference["SII_spec"] - 0.01], axis=0)
+    ).all() and (
+        Z[:3]
+        <= amax([reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0)
     ).all()
 
     # Tolerance curves definition
     tol_low = amin([reference["SII_spec"] * 0.99, reference["SII_spec"] - 0.01], axis=0)
-    tol_high = amax([reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0)
+    tol_high = amax(
+        [reference["SII_spec"] * 1.01, reference["SII_spec"] + 0.01], axis=0
+    )
 
     # Plot tolerance curves
     plt.plot(
-        freqs[:3], tol_low, color="red", linestyle="solid", label="tolerance", linewidth=1
+        freqs[:3],
+        tol_low,
+        color="red",
+        linestyle="solid",
+        label="tolerance",
+        linewidth=1,
     )
     plt.plot(freqs[:3], tol_high, color="red", linestyle="solid", linewidth=1)
 
@@ -247,6 +249,6 @@ def validation_sii_third_octave(reference):
 
 # test de la fonction
 if __name__ == "__main__":
-    # generate compliance plot 
+    # generate compliance plot
     validation_sii_octave(reference[0])
     validation_sii_third_octave(reference[1])


Test patch:
diff --git a/tests/input/Test_signal_1.py b/tests/input/Test_signal_1.py
index 51ff0de5..7dc59c69 100644
--- a/tests/input/Test_signal_1.py
+++ b/tests/input/Test_signal_1.py
@@ -33,4 +33,4 @@
         45,
         30.0,
     ]
-)
\ No newline at end of file
+)
diff --git a/tests/sound_level_meter/noct_spectrum/test_noct_synthesis.py b/tests/sound_level_meter/noct_spectrum/test_noct_synthesis.py
index 62549f47..2a02f0bb 100644
--- a/tests/sound_level_meter/noct_spectrum/test_noct_synthesis.py
+++ b/tests/sound_level_meter/noct_spectrum/test_noct_synthesis.py
@@ -4,10 +4,8 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package."
-    )
-#import matplotlib.pyplot as plt
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
+# import matplotlib.pyplot as plt
 
 # External library imports
 import numpy as np
@@ -25,9 +23,11 @@ def _dB(amp):
 
 @pytest.mark.noct_synthesis  # to skip or run only loudness noct_synthesis tests
 def test_noct_synthesis_technical():
-    
+
     ############################## TECHNICAL SIGNAL ##########################
-    sig, fs = load("tests/input/Test signal 5 (pinknoise 60 dB).wav", wav_calib=2*2**0.5)
+    sig, fs = load(
+        "tests/input/Test signal 5 (pinknoise 60 dB).wav", wav_calib=2 * 2**0.5
+    )
 
     spec_3t, freq_3t = noct_spectrum(sig, fs, fmin=24, fmax=12600, n=3)
     spec_1t, freq_1t = noct_spectrum(sig, fs, fmin=24, fmax=12600, n=1)
@@ -37,30 +37,30 @@ def test_noct_synthesis_technical():
     # /np.sqrt(2) to go from amplitude peak to amplitude RMS
     # /n normalization for the numpy fft function
     n = len(sig)
-    spectrum = 2 / np.sqrt(2) / n * fft(sig)[0:n//2]
+    spectrum = 2 / np.sqrt(2) / n * fft(sig)[0 : n // 2]
 
     # Frequency axis
-    freqs = fftfreq(n, 1/fs)[0:n//2]
+    freqs = fftfreq(n, 1 / fs)[0 : n // 2]
 
     spec_3f, freq_3f = noct_synthesis(np.abs(spectrum), freqs, fmin=24, fmax=12600, n=3)
     spec_1f, freq_1f = noct_synthesis(np.abs(spectrum), freqs, fmin=24, fmax=12600, n=1)
 
-   # plt.figure()
-   # plt.semilogx(freq_3t, _dB(spec_3t), label='noct spectrum')
-   # plt.semilogx(freq_3f, _dB(spec_3f), label='noct synth')
-   # plt.legend()
+    # plt.figure()
+    # plt.semilogx(freq_3t, _dB(spec_3t), label='noct spectrum')
+    # plt.semilogx(freq_3f, _dB(spec_3f), label='noct synth')
+    # plt.legend()
 
-   # plt.figure()
-   # plt.semilogx(freq_1t, _dB(spec_1t), label='noct spectrum')
-   # plt.semilogx(freq_1f, _dB(spec_1f), label='noct synth')
-   # plt.legend()
+    # plt.figure()
+    # plt.semilogx(freq_1t, _dB(spec_1t), label='noct spectrum')
+    # plt.semilogx(freq_1f, _dB(spec_1f), label='noct synth')
+    # plt.legend()
 
-   # plt.show()
+    # plt.show()
 
     np.testing.assert_allclose(_dB(spec_3t[:, 0]), _dB(spec_3f), atol=0.3)
     np.testing.assert_allclose(_dB(spec_1t[:, 0]), _dB(spec_1f), atol=0.3)
-    
-    
+
+
 # @pytest.mark.noct_synthesis  # to skip or run only loudness noct_synthesis tests
 # def test_noct_synthesis_synthetic():
 
@@ -99,7 +99,6 @@ def test_noct_synthesis_technical():
 #     np.testing.assert_allclose(_dB(spec_1t[:, 0]), _dB(spec_1f), atol=0.3)
 
 
-
 # test de la fonction
 if __name__ == "__main__":
     test_noct_synthesis_technical()
diff --git a/tests/sq_metrics/loudness/test_loudness_ecma.py b/tests/sq_metrics/loudness/test_loudness_ecma.py
index d91cd867..0c4aa50e 100644
--- a/tests/sq_metrics/loudness/test_loudness_ecma.py
+++ b/tests/sq_metrics/loudness/test_loudness_ecma.py
@@ -15,7 +15,6 @@
 )
 from mosqito.sq_metrics import loudness_ecma
 
-
 @pytest.mark.loudness_ecma  # to skip or run only loudness ecma tests
 def test_loudness_ecma():
     """Test function for the Loudness_ecma calculation"""
@@ -27,26 +26,21 @@ def test_loudness_ecma():
         spl_value=80,
         freq=1000,
     )
-    n_specific, _ = loudness_ecma(signal)
-    n_specific = np.array(n_specific)
-    n_tot = np.sum(n_specific, axis=0)
-    n_tot_mean_1kHz = np.mean(n_tot[5:])
+    n_1kHz, _, _, _, _ = loudness_ecma(signal, fs=48000)
 
     # Generate a 5kHz / 78.7 dB test tone and compute loudness
     signal, _ = sine_wave_generator(
         fs=48000,
         t=0.25,
-        spl_value=78.73977248964925,
+        spl_value=78.49095, 
         freq=5000,
     )
-    n_specific, _ = loudness_ecma(signal)
-    n_specific = np.array(n_specific)
-    n_tot = np.sum(n_specific, axis=0)
-    n_tot_mean_5kHz = np.mean(n_tot[5:])
+    n_5kHz, _, _, _, _ = loudness_ecma(signal, fs=48000)
 
     # Compare loudness
-    np.testing.assert_almost_equal(n_tot_mean_1kHz, n_tot_mean_5kHz)
-
+    
+    assert np.isclose(n_1kHz, n_5kHz)
+    
 
 # test de la fonction
 if __name__ == "__main__":
diff --git a/tests/sq_metrics/loudness/test_loudness_zwtv.py b/tests/sq_metrics/loudness/test_loudness_zwtv.py
index da655214..22965ce2 100644
--- a/tests/sq_metrics/loudness/test_loudness_zwtv.py
+++ b/tests/sq_metrics/loudness/test_loudness_zwtv.py
@@ -39,7 +39,7 @@ def test_loudness_zwtv():
     }
 
     # Load signal and compute third octave band spectrum
-    sig, fs = load(signal["data_file"], wav_calib=2 * 2 ** 0.5)
+    sig, fs = load(signal["data_file"], wav_calib=2 * 2**0.5)
 
     # Compute Loudness
     N, N_spec, bark_axis, time_axis = loudness_zwtv(sig, fs, field_type=signal["field"])
diff --git a/tests/sq_metrics/roughness/signals_test_generation.py b/tests/sq_metrics/roughness/signals_test_generation.py
index 7b344ed9..b20068ce 100644
--- a/tests/sq_metrics/roughness/signals_test_generation.py
+++ b/tests/sq_metrics/roughness/signals_test_generation.py
@@ -72,9 +72,8 @@ def wav_test(fc, fmod, mdepth, fs, d, dB, folder):
     """
 
     values = signal_test(fc, fmod, mdepth, fs, d, dB)
-    values = values / (2 * 2 ** 0.5)
+    values = values / (2 * 2**0.5)
     values = values.astype(np.int16)
     write(
-        folder + "/Test_signal_fc" +
-        str(fc) + "_fmod" + str(fmod) + ".wav", fs, values
+        folder + "/Test_signal_fc" + str(fc) + "_fmod" + str(fmod) + ".wav", fs, values
     )
diff --git a/tests/sq_metrics/sharpness/test_sharpness_din.py b/tests/sq_metrics/sharpness/test_sharpness_din.py
index f4629d39..9f061dd8 100644
--- a/tests/sq_metrics/sharpness/test_sharpness_din.py
+++ b/tests/sq_metrics/sharpness/test_sharpness_din.py
@@ -19,6 +19,7 @@
 )
 from mosqito.sound_level_meter.spectrum import spectrum
 
+
 @pytest.fixture
 def test_signal():
     # Input signal from DIN 45692_2009E
@@ -127,9 +128,7 @@ def test_sharpness_din_perseg(test_signal):
     sharpness, _ = sharpness_din_perseg(sig, fs, nperseg=2**14, weighting="aures")
     sharpness, _ = sharpness_din_perseg(sig, fs, nperseg=2**14, weighting="bismarck")
     sharpness, _ = sharpness_din_perseg(sig, fs, nperseg=2**14, weighting="fastl")
-    sharpness, time_axis = sharpness_din_perseg(
-        sig, fs, nperseg=2**14, weighting="din"
-    )
+    sharpness, time_axis = sharpness_din_perseg(sig, fs, nperseg=2**14, weighting="din")
 
     # Check that the value is within the desired values +/- 5%
     # as per DIN 45692_2009E (chapter 6)
diff --git a/tests/sq_metrics/speech_intelligibility/test_sii_ansi.py b/tests/sq_metrics/speech_intelligibility/test_sii_ansi.py
index 7d777dad..f50c5053 100644
--- a/tests/sq_metrics/speech_intelligibility/test_sii_ansi.py
+++ b/tests/sq_metrics/speech_intelligibility/test_sii_ansi.py
@@ -9,8 +9,7 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package.")
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
 
 # Local application imports
 from mosqito import sii_ansi, sii_ansi_freq, sii_ansi_level
@@ -19,25 +18,27 @@
 
 @pytest.fixture
 def test_signal():
-    
+
     spec = array([70, 65, 45, 25, 1, -15])
     freqs = array([250, 500, 1000, 2000, 4000, 8000])
     fs = 44100
     n = int(44100 * 0.2)
-    f = linspace(0,fs//2,2*n)
+    f = linspace(0, fs // 2, 2 * n)
     sig = ifft(interp(f, freqs, spec, left=0, right=0)).real[4410:13230]
-    test_signal = {"noise_spectrum": spec,
-        "speech_spectrum": array([50, 40, 40, 30, 20, 0]),         
+    test_signal = {
+        "noise_spectrum": spec,
+        "speech_spectrum": array([50, 40, 40, 30, 20, 0]),
         "freq_axis": freqs,
         "signal": sig,
         "fs": fs,
         "method": "octave",
         "SII": 0.504,
         "SII_spec": array([0, 0, 0.08, 0.17, 0.21, 0.04]),
-        }
+    }
 
     return test_signal
 
+
 @pytest.mark.sii_ansi  # to skip or run sharpness test
 def test_sii(test_signal):
     """Test function for the sharpness calculation of an audio signal
@@ -56,13 +57,13 @@ def test_sii(test_signal):
     fs = test_signal["fs"]
 
     # Compute sharpness
-    SII, _, _ = sii_ansi(sig, fs, 'third_octave', 'raised')
-    SII, _, _ = sii_ansi(sig, fs, 'critical', 'loud')
-    SII, _, _ = sii_ansi(sig, fs, 'equally_critical', 'shout')
-    SII, _, _ = sii_ansi(sig, fs, 'octave', 'normal')
-    
+    SII, _, _ = sii_ansi(sig, fs, "third_octave", "raised")
+    SII, _, _ = sii_ansi(sig, fs, "critical", "loud")
+    SII, _, _ = sii_ansi(sig, fs, "equally_critical", "shout")
+    SII, _, _ = sii_ansi(sig, fs, "octave", "normal")
+
 
-@pytest.mark.sii_ansi # to skip or run sharpness test
+@pytest.mark.sii_ansi  # to skip or run sharpness test
 def test_sii_freq(test_signal):
     """Test function for the sharpness calculation of an time-varying audio signal.
 
@@ -76,33 +77,38 @@ def test_sii_freq(test_signal):
 
     # Input signal
     spec = test_signal["noise_spectrum"]
-    freqs = test_signal["freq_axis"]    
+    freqs = test_signal["freq_axis"]
     # Compute sharpness
-    SII, _, _ = sii_ansi_freq(spec, freqs, "critical", 'loud')
-    SII, _, _ = sii_ansi_freq(spec, freqs, "equally_critical", 'raised')
-    SII, _, _ = sii_ansi_freq(spec, freqs, "third_octave", 'shout')
-    SII, _, _ = sii_ansi_freq(spec, freqs, "octave", 'normal')
-    
+    SII, _, _ = sii_ansi_freq(spec, freqs, "critical", "loud")
+    SII, _, _ = sii_ansi_freq(spec, freqs, "equally_critical", "raised")
+    SII, _, _ = sii_ansi_freq(spec, freqs, "third_octave", "shout")
+    SII, _, _ = sii_ansi_freq(spec, freqs, "octave", "normal")
+
+
 @pytest.mark.sii_ansi
 def test_sii_level():
-    
+
     # Compute sharpness
-    SII, _, _ = sii_ansi_level(60, 'critical', 'normal')
-    SII, _, _ = sii_ansi_level(60, 'equally_critical', 'raised')
-    SII, _, _ = sii_ansi_level(60, 'octave', 'loud')
-    SII, _, _ = sii_ansi_level(60, 'third_octave', 'shout')
-    
-    
-@pytest.mark.sii_ansi # to skip or run sharpness test
+    SII, _, _ = sii_ansi_level(60, "critical", "normal")
+    SII, _, _ = sii_ansi_level(60, "equally_critical", "raised")
+    SII, _, _ = sii_ansi_level(60, "octave", "loud")
+    SII, _, _ = sii_ansi_level(60, "third_octave", "shout")
+
+
+@pytest.mark.sii_ansi  # to skip or run sharpness test
 def test_main_sii(test_signal):
-    """Test function for the sharpness calculation of an time-varying audio signal.
+    """Test function for the sharpness calculation of an time-varying audio signal."""
 
-    """
-    
-    SII, _, _ = _main_sii(test_signal["method"], test_signal["speech_spectrum"], test_signal["noise_spectrum"], threshold=None)
+    SII, _, _ = _main_sii(
+        test_signal["method"],
+        test_signal["speech_spectrum"],
+        test_signal["noise_spectrum"],
+        threshold=None,
+    )
 
     assert check_compliance(SII, test_signal["SII"])
 
+
 def check_compliance(SII, reference):
     """Check the compliance of SII with ANSI S3.5
 
@@ -114,14 +120,13 @@ def check_compliance(SII, reference):
         computed sharpness value
     reference : float
         reference value
-    
+
     Outputs
     -------
     tst : bool
         Compliance to the reference data
     """
 
-
     # Test for DIN 45692_2009E comformance (chapter 6)
     tst = (SII >= np.amax([reference * 0.999, reference - 0.01], axis=0)).all() and (
         SII <= np.amin([reference * 1.01, reference + 0.01], axis=0)
@@ -132,23 +137,24 @@ def check_compliance(SII, reference):
 
 # test de la fonction
 if __name__ == "__main__":
-    
+
     spec = array([70, 65, 45, 25, 1, -15])
     freqs = array([250, 500, 1000, 2000, 4000, 8000])
     fs = 44100
     n = int(44100 * 0.2)
-    f = linspace(0,fs//2,2*n)
+    f = linspace(0, fs // 2, 2 * n)
     sig = ifft(interp(f, freqs, spec, left=0, right=0)).real[4410:13230]
-    sig = {"noise_spectrum": spec,
-        "speech_spectrum": array([50, 40, 40, 30, 20, 0]),         
+    sig = {
+        "noise_spectrum": spec,
+        "speech_spectrum": array([50, 40, 40, 30, 20, 0]),
         "freq_axis": freqs,
         "signal": sig,
         "fs": fs,
         "method": "octave",
         "SII": 0.504,
         "SII_spec": array([0, 0, 0.08, 0.17, 0.21, 0.04]),
-        }
-    
+    }
+
     test_sii(sig)
     test_sii_freq(sig)
     test_sii_level()
diff --git a/tests/sq_metrics/tonality/test_pr_ecma_freq.py b/tests/sq_metrics/tonality/test_pr_ecma_freq.py
index 199bbc7b..747d8dc0 100644
--- a/tests/sq_metrics/tonality/test_pr_ecma_freq.py
+++ b/tests/sq_metrics/tonality/test_pr_ecma_freq.py
@@ -4,9 +4,7 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package."
-    )
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
 # External import
 import numpy as np
 
@@ -15,6 +13,7 @@
 from mosqito.sound_level_meter.spectrum import spectrum
 from mosqito.sq_metrics import pr_ecma_freq
 
+
 @pytest.mark.pr_freq  # to skip or run PR test
 def test_pr_ecma_freq():
     """Test function for the prominence ratio calculation of an audio signal
@@ -33,32 +32,30 @@ def test_pr_ecma_freq():
     # Test signal as input for prominence ratio calculation
     # signals generated using audacity : white noise + tones at 200 and 2000 Hz
 
-
-    signal =         {
-            "is_stationary": True,
-            "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav"
-        }
-
+    signal = {
+        "is_stationary": True,
+        "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav",
+    }
 
     # Load signal
     audio, fs = load(signal["data_file"], wav_calib=0.01)
     # convert to frequency domain
-    spec, freqs = spectrum(audio, fs, window='hanning', db=False)
+    spec, freqs = spectrum(audio, fs, window="hanning", db=False)
 
     # Compute tone-to-noise ratio
     # 1D input
     # Compute tone-to-noise ratio
-    t_pr, pr, promi, freq = pr_ecma_freq(spec, freqs=freqs, prominence=False )
+    t_pr, pr, promi, freq = pr_ecma_freq(spec, freqs=freqs, prominence=False)
 
     # 2D spectrum, 1D freq axis
-    spec = np.tile(spec, (4,1)).T
-    
-    t_pr, pr, promi, freq = pr_ecma_freq(spec, freqs=freqs, prominence=False )
+    spec = np.tile(spec, (4, 1)).T
+
+    t_pr, pr, promi, freq = pr_ecma_freq(spec, freqs=freqs, prominence=False)
 
     # 2D spectrum, 2D freq axis
-    freqs = np.tile(freqs,(4,1)).T
-    t_pr, pr, promi, freq = pr_ecma_freq(spec, freqs=freqs, prominence=False )
-        
+    freqs = np.tile(freqs, (4, 1)).T
+    t_pr, pr, promi, freq = pr_ecma_freq(spec, freqs=freqs, prominence=False)
+
+
 if __name__ == "__main__":
     test_pr_ecma_freq()
-
diff --git a/tests/sq_metrics/tonality/test_pr_ecma_st.py b/tests/sq_metrics/tonality/test_pr_ecma_st.py
index e1baec3d..29562652 100644
--- a/tests/sq_metrics/tonality/test_pr_ecma_st.py
+++ b/tests/sq_metrics/tonality/test_pr_ecma_st.py
@@ -4,11 +4,10 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package."
-    )
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
 
 import numpy as np
+
 # Local application imports
 from mosqito.utils import load
 from mosqito.sq_metrics import pr_ecma_st
@@ -32,9 +31,7 @@ def test_pr_ecma_st():
     # Test signal as input for prominence ratio calculation
     # signals generated using audacity : white noise + tones at 442 and 1768 Hz
 
-    signal = {
-            "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav"
-        }
+    signal = {"data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav"}
 
     # Load signal
     audio, fs = load(signal["data_file"], wav_calib=0.01)
@@ -48,4 +45,3 @@ def test_pr_ecma_st():
 
 if __name__ == "__main__":
     test_pr_ecma_st()
-
diff --git a/tests/sq_metrics/tonality/test_pr_ecma_tv.py b/tests/sq_metrics/tonality/test_pr_ecma_tv.py
index ff4777bf..be700393 100644
--- a/tests/sq_metrics/tonality/test_pr_ecma_tv.py
+++ b/tests/sq_metrics/tonality/test_pr_ecma_tv.py
@@ -4,11 +4,10 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package."
-    )
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
 
 import numpy as np
+
 # Local application imports
 from mosqito.utils import load
 from mosqito.sq_metrics import pr_ecma_tv
@@ -32,9 +31,7 @@ def test_pr_ecma_tv():
     # Test signal as input for prominence ratio calculation
     # signals generated using audacity : white noise + tones at 442 and 1768 Hz
 
-    signal = {
-            "data_file": "tests/input/white_noise_442_1768_Hz_varying.wav"
-        }
+    signal = {"data_file": "tests/input/white_noise_442_1768_Hz_varying.wav"}
 
     # Load signal
     audio, fs = load(signal["data_file"], wav_calib=0.01)
@@ -42,13 +39,10 @@ def test_pr_ecma_tv():
     # Compute tone-to-noise ratio
     t_pr, pr, prom, freq, time = pr_ecma_tv(audio, fs, prominence=True)
     np.testing.assert_almost_equal(max(t_pr), 34.02082433185258)
-    assert pr[np.argmin(np.abs(freq-442)),:].all() != np.nan
-    assert pr[np.argmin(np.abs(freq-1768)),2:3].all() != np.nan
+    assert pr[np.argmin(np.abs(freq - 442)), :].all() != np.nan
+    assert pr[np.argmin(np.abs(freq - 1768)), 2:3].all() != np.nan
     assert np.count_nonzero(prom == True) == 8
 
 
-
 if __name__ == "__main__":
     test_pr_ecma_tv()
-
-
diff --git a/tests/sq_metrics/tonality/test_tnr_ecma_freq.py b/tests/sq_metrics/tonality/test_tnr_ecma_freq.py
index c927524e..eea41f22 100644
--- a/tests/sq_metrics/tonality/test_tnr_ecma_freq.py
+++ b/tests/sq_metrics/tonality/test_tnr_ecma_freq.py
@@ -4,9 +4,7 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package."
-    )
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
 
 # External import
 import numpy as np
@@ -16,6 +14,7 @@
 from mosqito.sound_level_meter.spectrum import spectrum
 from mosqito.sq_metrics import tnr_ecma_freq
 
+
 @pytest.mark.tnr_freq  # to skip or run TNR test
 def test_tnr_ecma_freq():
     """Test function for the prominence ratio calculation of an audio signal
@@ -34,30 +33,28 @@ def test_tnr_ecma_freq():
     # Test signal as input for prominence ratio calculation
     # signals generated using audacity : white noise + tones at 200 and 2000 Hz
 
-
-    signal =     {
-            "is_stationary": True,
-            "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav"
-        }
-    
+    signal = {
+        "is_stationary": True,
+        "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav",
+    }
 
     # Load signal
     audio, fs = load(signal["data_file"], wav_calib=0.01)
     # convert to frequency domain
-    spec, freqs = spectrum(audio, fs, window='hanning', db=False)
+    spec, freqs = spectrum(audio, fs, window="hanning", db=False)
 
     # 1D input
     # Compute tone-to-noise ratio
-    t_tnr, tnr, promi, freq = tnr_ecma_freq(spec, freqs=freqs, prominence=False )
+    t_tnr, tnr, promi, freq = tnr_ecma_freq(spec, freqs=freqs, prominence=False)
 
     # 2D spectrum, 1D freq axis
-    spec = np.tile(spec, (4,1)).T
-    
-    t_tnr, tnr, promi, freq = tnr_ecma_freq(spec, freqs=freqs, prominence=False )
+    spec = np.tile(spec, (4, 1)).T
+
+    t_tnr, tnr, promi, freq = tnr_ecma_freq(spec, freqs=freqs, prominence=False)
 
     # 2D spectrum, 2D freq axis
-    freqs = np.tile(freqs,(4,1)).T
-    t_tnr, tnr, promi, freq = tnr_ecma_freq(spec, freqs=freqs, prominence=False )
+    freqs = np.tile(freqs, (4, 1)).T
+    t_tnr, tnr, promi, freq = tnr_ecma_freq(spec, freqs=freqs, prominence=False)
 
 
 if __name__ == "__main__":
diff --git a/tests/sq_metrics/tonality/test_tnr_ecma_st.py b/tests/sq_metrics/tonality/test_tnr_ecma_st.py
index 3480ebf8..7614de3a 100644
--- a/tests/sq_metrics/tonality/test_tnr_ecma_st.py
+++ b/tests/sq_metrics/tonality/test_tnr_ecma_st.py
@@ -5,11 +5,10 @@
 try:
     import pytest
 except ImportError:
-    raise RuntimeError(
-        "In order to perform the tests you need the 'pytest' package."
-    )
+    raise RuntimeError("In order to perform the tests you need the 'pytest' package.")
 
 import numpy as np
+
 # Local application imports
 from mosqito.utils import load
 from mosqito.sq_metrics import tnr_ecma_st
@@ -33,10 +32,10 @@ def test_tnr_ecma_st():
     # Test signal as input for tone to noise ratio calculation
     # signals generated using audacity : white noise + tones at 442 and 1768 Hz
 
-    signal =  {
-            "tones freq": [442, 1768],
-            "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav"
-        }
+    signal = {
+        "tones freq": [442, 1768],
+        "data_file": "tests/input/white_noise_442_1768_Hz_stationary.wav",
+    }
 
     # Load signal
     audio, fs = load(signal["data_file"], wav_calib=0.01)
@@ -45,8 +44,7 @@ def test_tnr_ecma_st():
     np.testing.assert_almost_equal(t_tnr, 32.7142766)
     np.testing.assert_almost_equal(freq.astype(np.int32), [442, 1768])
     assert np.count_nonzero(prom == True) == 2
-        
-if __name__ == "__main__":
-    test_tnr_ecma_st()
 
 
+if __name__ == "__main__":
+    test_tnr_ecma_st()
diff --git a/tests/sq_metrics/tonality/test_tnr_ecma_tv.py b/tests/sq_metrics/tonality/test_tnr_ecma_tv.py
index 26207d68..d9ad9325 100644
--- a/tests/sq_metrics/tonality/test_tnr_ecma_tv.py
+++ b/tests/sq_metrics/tonality/test_tnr_ecma_tv.py
@@ -30,8 +30,10 @@ def test_tnr_ecma_tv():
     # Test signal as input for prominence ratio calculation
     # signals generated using audacity : white noise + tones at 442 and 1768 Hz
 
-    signal = {"freq": [442, 1768],
-        "data_file": "tests/input/white_noise_442_1768_Hz_varying.wav"}
+    signal = {
+        "freq": [442, 1768],
+        "data_file": "tests/input/white_noise_442_1768_Hz_varying.wav",
+    }
 
     # Load signal
     audio, fs = load(signal["data_file"], wav_calib=0.01)
@@ -39,8 +41,8 @@ def test_tnr_ecma_tv():
     # Compute tone-to-noise ratio
     t_tnr, tnr, prom, freq, time = tnr_ecma_tv(audio, fs, prominence=True)
     np.testing.assert_almost_equal(max(t_tnr), 34.710964273840155)
-    assert tnr[np.argmin(np.abs(freq-442)),:].all() != np.nan
-    assert tnr[np.argmin(np.abs(freq-1768)),2:3].all() != np.nan
+    assert tnr[np.argmin(np.abs(freq - 442)), :].all() != np.nan
+    assert tnr[np.argmin(np.abs(freq - 1768)), 2:3].all() != np.nan
     assert np.count_nonzero(prom == True) == 8
 
 
diff --git a/tests/utils/test_time_segmentation.py b/tests/utils/test_time_segmentation.py
index 43851cb6..1d8b6dba 100644
--- a/tests/utils/test_time_segmentation.py
+++ b/tests/utils/test_time_segmentation.py
@@ -29,4 +29,4 @@ def test_time_segmentation():
 
 # test de la fonction
 if __name__ == "__main__":
-    test_time_segmentation()
\ No newline at end of file
+    test_time_segmentation()