Beispiel #1
0
    def __init__(self, N=16, fs=96000, repeats=3):
        """Simplified usage for quick access to an MLS that performs the required
        message calls in the right order. Can also be used as an example on how
        to use the MLS class.
        
        Example:
            >>> mls = MLS_simple(N=18, fs=96000, repeats=4)
            >>> y = some_system_to_identify(mls.samples)
            >>> imp = mls.get_impulse(y)
            >>> imp.plot()
            >>> mls.plot_fft()
            
        The impulse response is stored as a member variable in this class after it
        has been extracted.
        """
        emphasis_filter = RBJ(filtertype="highshelf",
                              gaindb=-10,
                              f0=100,
                              Q=0.707,
                              fs=fs)
        B, A = emphasis_filter.get_coefficients()
        self._mls = MLS(N=N, taps=TAPS[N][0], fs=fs, repeats=repeats, B=B, A=A)
        self._mls.apply_emphasis()

        # map the name to the internal representation of the samples
        self.samples = self._mls.samples
Beispiel #2
0
 def __init__(self, N=16, fs=96000, repeats=3):
     """Simplified usage for quick access to an MLS that performs the required
     message calls in the right order. Can also be used as an example on how
     to use the MLS class.
     
     Example:
         >>> mls = MLS_simple(N=18, fs=96000, repeats=4)
         >>> y = some_system_to_identify(mls.samples)
         >>> imp = mls.get_impulse(y)
         >>> imp.plot()
         >>> mls.plot_fft()
         
     The impulse response is stored as a member variable in this class after it
     has been extracted.
     """
     emphasis_filter = RBJ(filtertype="highshelf", gaindb=-10, f0=100, Q=0.707, fs=fs)
     B, A = emphasis_filter.get_coefficients()
     self._mls = MLS(N=N, taps=TAPS[N][0], fs=fs, repeats=repeats, B=B, A=A)
     self._mls.apply_emphasis()
     
     # map the name to the internal representation of the samples
     self.samples = self._mls.samples
Beispiel #3
0
        # that would scale the impulse wrong.
        self._impulseresponse.plot_fft(plotname=plotname,
                                       window='rectangular',
                                       normalise=False)


if __name__ == '__main__':
    logging.basicConfig(
        format='%(levelname)-7s: %(module)s.%(funcName)-15s %(message)s',
        level='DEBUG')
    fs = 48000 * 2
    N = 13

    #mls = _MLS_base(N=N, taps=TAPS[N][0])
    #mls = MLS(N=N, taps=TAPS[N][0], fs=fs)

    f = RBJ(filtertype="highshelf", gaindb=-10, f0=100, Q=0.707, fs=fs)
    B, A = f.get_coefficients()
    #mls = MLS(N=N, taps=TAPS[N][0], fs=fs, repeats=5, B=B, A=A)

    mls = MLS_simple(N=N, fs=fs, repeats=4)

    print(repr(mls))
    print(mls)

    y = mls.get_impulse(mls.samples)
    #mls.plot_fft()                                      # used with MLS_simple
    y.plot_fft(window='rectangular', normalise=False)  # used with MLS

    print('++ End of script ++')
Beispiel #4
0
        """Plot the magnitude response. Phase is not included in this plot."""
        assert hasattr(self, "_impulseresponse"), "call get_impulse(...) before trying to plot"
        
        # A window function on the impulse response does not work here, since
        # that would scale the impulse wrong.
        self._impulseresponse.plot_fft(plotname=plotname, window='rectangular', normalise=False)
    
if __name__ == '__main__':
    logging.basicConfig(format='%(levelname)-7s: %(module)s.%(funcName)-15s %(message)s',
                        level='DEBUG')
    fs  = 48000*2
    N   = 13
    
    #mls = _MLS_base(N=N, taps=TAPS[N][0])
    #mls = MLS(N=N, taps=TAPS[N][0], fs=fs)
    
    f = RBJ(filtertype="highshelf", gaindb=-10, f0=100, Q=0.707, fs=fs)
    B, A = f.get_coefficients()
    #mls = MLS(N=N, taps=TAPS[N][0], fs=fs, repeats=5, B=B, A=A)
    
    mls = MLS_simple(N=N, fs=fs, repeats=4)
    
    print (repr(mls))
    print(mls)
    
    y = mls.get_impulse(mls.samples)
    #mls.plot_fft()                                      # used with MLS_simple
    y.plot_fft(window='rectangular', normalise=False)   # used with MLS
    
    print('++ End of script ++')