Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
@copyright: (c) 2015 Ronny Andersson
@license: MIT
'''

# standard library
from __future__ import print_function
import logging

# custom libraries
from zignal.filters.biquads import RBJ, Zolzer

if __name__ == '__main__':
    logging.basicConfig(format='%(levelname)-7s: %(module)s.%(funcName)-15s %(message)s',
                        level='DEBUG')
    
    gaindb  = -6
    f0      = 997
    Q       = 0.707
    fs      = 48000
    
    # Create a Robert Bristow-Johnson type biquad filter
    f1 = RBJ(filtertype=RBJ.Types.peak, gaindb=gaindb, f0=f0, Q=Q, fs=fs)
    
    f1.plot_mag_phase()
    f1.plot_pole_zero()
    
    # Create an Udo Zolzer type biquad filter
    f2 = Zolzer(filtertype=Zolzer.Types.peak, gaindb=gaindb, f0=f0, Q=Q, fs=fs)
    
    f2.plot_mag_phase()
    f2.plot_pole_zero()
Ejemplo n.º 4
0
@license: MIT
'''

# standard library
import logging

# custom libraries
from zignal.filters.biquads import RBJ, Zolzer

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

    gaindb = -6
    f0 = 997
    Q = 0.707
    fs = 48000

    # Create a Robert Bristow-Johnson type biquad filter
    f1 = RBJ(filtertype=RBJ.Types.peak, gaindb=gaindb, f0=f0, Q=Q, fs=fs)

    f1.plot_mag_phase()
    f1.plot_pole_zero()

    # Create an Udo Zolzer type biquad filter
    f2 = Zolzer(filtertype=Zolzer.Types.peak, gaindb=gaindb, f0=f0, Q=Q, fs=fs)

    f2.plot_mag_phase()
    f2.plot_pole_zero()
Ejemplo n.º 5
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 ++')
Ejemplo n.º 6
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 ++')