35                 tw: TimeWeighting = TimeWeighting.fast,
 
   36                 fw: FreqWeighting = FreqWeighting.A,
 
   40                 level_ref_value=P_REF,
 
   43        Initialize a sound level meter object. 
   46            fs: Sampling frequency of input data [Hz] 
   47            fbdesigner: FilterBankDesigner to use for creating the 
   48            (fractional) octave bank filters. Set this one to None to only do 
   50            fs: Sampling frequency [Hz] 
   51            tw: Time Weighting to apply 
   52            fw: Frequency weighting to apply 
   53            xmin: Filter designator of lowest band. 
   54            xmax: Filter designator of highest band 
   55            include_overall: If true, a non-functioning filter is added which 
   56            is used to compute the overall level. 
   57            level_ref_value: Reference value for computing the levels in dB 
   58            offset_t: Offset to be added to output time data [s] 
   62        if xmin 
is None and fbdesigner 
is not None:
 
   63            xmin = fbdesigner.xs[0]
 
   64        elif fbdesigner 
is None:
 
   67        if xmax 
is None and self.
fbdesigner is not None:
 
   68            xmax = fbdesigner.xs[-1]
 
   69        elif fbdesigner 
is None:
 
   72        self.
xs = list(range(xmin, xmax + 1))
 
   74        nfilters = len(self.
xs)
 
   81        if fw == FreqWeighting.A:
 
   82            prefilter = spld.A_Sos_design().flatten()
 
   83        elif fw == FreqWeighting.C:
 
   84            prefilter = spld.C_Sos_design().flatten()
 
   85        elif fw == FreqWeighting.Z:
 
   88            raise ValueError(f
'Not implemented prefilter {fw}')
 
   95        sos_overall = np.array([1, 0, 0, 1, 0, 0]*5, dtype=float)
 
   97        if fbdesigner 
is not None:
 
   98            assert fbdesigner.fs == fs
 
   99            sos_firstx = fbdesigner.createSOSFilter(self.
xs[0]).flatten()
 
  100            self.
nom_txt.append(fbdesigner.nominal_txt(self.
xs[0]))
 
  101            sos = np.empty((sos_firstx.size, nfilters), dtype=float, order=
'C')
 
  102            sos[:, 0] = sos_firstx
 
  104            for i, x 
in enumerate(self.
xs[1:]):
 
  105                sos[:, i+1] = fbdesigner.createSOSFilter(x).flatten()
 
  106                self.
nom_txt.append(fbdesigner.nominal_txt(x))
 
  112                sos[:, -1] = sos_overall
 
  119            sos = sos_overall[:, np.newaxis]
 
  125        dsfac = cppSLM.suggestedDownSamplingFac(fs, tw[0])
 
  127        if prefilter 
is not None:
 
  128            self.
slm = cppSLM.fromBiquads(fs, level_ref_value, dsfac,
 
  130                                          prefilter.flatten(), sos)
 
  132            self.
slm = cppSLM.fromBiquads(fs, level_ref_value, dsfac,