Example #1
0
    def __init__(self,
                 N=None,
                 taps=None,
                 fs=96000,
                 repeats=2,
                 B=(1, 0, 0),
                 A=(1, 0, 0)):
        """N is the order of the MLS, taps are preferably selected from the mlstaps
        dictionary, like
        
            >>> taps=TAPS[N][0]
            
        B and A are emphasis filter coefficients. The filter used as emphasis must
        be a minimum phase filter. This means that all the poles and the zeroes are
        withing the unit circle. We can then invert the filter to apply de-emphasis.
        
        The filters.biquads.RBJ class can be used to generate a suitable emphasis
        filter.
        """
        assert repeats > 1, "at least two sequences are needed, (repeats=2)"

        _MLS_base.__init__(self, N=N, taps=taps)
        Audio.__init__(self,
                       fs=fs,
                       initialdata=self.get_full_sequence(repeats=repeats))

        self.repeats = repeats
        self._length_impresp = self.L / self.fs
        self._filter_emphasis = Filter(B=B, A=A, fs=self.fs)
        self._filter_deemphasis = Filter(B=A, A=B,
                                         fs=self.fs)  # inverse filter

        assert self._filter_emphasis.is_minimum_phase(), \
            "The emphasis filter must be minimum phase, i.e. possible to invert"
Example #2
0
 def __init__(self, N=None, taps=None, fs=96000, repeats=2, B=(1, 0, 0), A=(1, 0, 0)):
     """N is the order of the MLS, taps are preferably selected from the mlstaps
     dictionary, like
     
         >>> taps=TAPS[N][0]
         
     B and A are emphasis filter coefficients. The filter used as emphasis must
     be a minimum phase filter. This means that all the poles and the zeroes are
     withing the unit circle. We can then invert the filter to apply de-emphasis.
     
     The filters.biquads.RBJ class can be used to generate a suitable emphasis
     filter.
     """
     assert repeats > 1, "at least two sequences are needed, (repeats=2)"
     
     _MLS_base.__init__(self, N=N, taps=taps)
     Audio.__init__(self, fs=fs, initialdata=self.get_full_sequence(repeats=repeats))
     
     self.repeats            = repeats
     self._length_impresp    = self.L/self.fs
     self._filter_emphasis   = Filter(B=B, A=A, fs=self.fs)
     self._filter_deemphasis = Filter(B=A, A=B, fs=self.fs) # inverse filter
     
     assert self._filter_emphasis.is_minimum_phase(), \
         "The emphasis filter must be minimum phase, i.e. possible to invert"