Example #1
0
 def __init__(self,
              sample_rate=44100,
              normalize=None,
              resample=False,
              time_start=0.0,
              time_limit=0.0):
     if type(normalize) == int:
         normalize = '%i' % normalize
     elif type(normalize) == float:
         normalize = '%f' % normalize
     elif normalize and type(normalize) != str:
         normalize = str(normalize)
     self.features = {}
     self.resample = resample
     self.sample_rate = sample_rate
     self.audio_params = {
         'SampleRate': str(sample_rate),
         'Resample': 'yes' if resample else 'no',
         'TimeStart': '%ss' % time_start,
         'TimeLimit': '%ss' % time_limit
     }
     if normalize:
         self.audio_params['RemoveMean'] = 'yes'
         self.audio_params['ScaleMax'] = normalize
     self.out_attrs = {
         'normalize': normalize or '-1',
         'version': yaafecore.getYaafeVersion(),
         'samplerate': str(sample_rate),
         'resample': 'yes' if resample else 'no'
     }
     self.dataflow = DataFlow()
Example #2
0
 def __init__(self, sample_rate=44100, normalize=None, resample=False,
              time_start=0.0, time_limit=0.0):
     if type(normalize) == int:
         normalize = '%i' % normalize
     elif type(normalize) == float:
         normalize = '%f' % normalize
     elif normalize and type(normalize) != str:
         normalize = str(normalize)
     self.features = {}
     self.resample = resample
     self.sample_rate = sample_rate
     self.audio_params = {
         'SampleRate': str(sample_rate),
         'Resample': 'yes' if resample else 'no',
         'TimeStart': '%ss' % time_start,
         'TimeLimit': '%ss' % time_limit
     }
     if normalize:
         self.audio_params['RemoveMean'] = 'yes'
         self.audio_params['ScaleMax'] = normalize
     self.out_attrs = {'normalize': normalize or '-1',
                       'version': yaafecore.getYaafeVersion(),
                       'samplerate': str(sample_rate),
                       'resample': 'yes' if resample else 'no'}
     self.dataflow = DataFlow()
Example #3
0
    def load(self, dataflow):
        """
            Configure engine according to the given dataflow.

            :param dataflow: dataflow object or filename of a dataflow file.
            :type dataflow: :py:class:`DataFlow` or string
            :return: True on success, False on fail.
        """
        if type(dataflow) is str:
            df = DataFlow()
            if df.load(dataflow):
                dataflow = df
        if type(dataflow) is DataFlow:
            return yc.engine_load(self.ptr, dataflow.ptr) and True or False
        raise TypeError('dataflow parameter must be a DataFlow object or '
                        'dataflow filename !')
Example #4
0
    def load(self, dataflow):
        """
            Configure engine according to the given dataflow.

            :param dataflow: dataflow object or filename of a dataflow file.
            :type dataflow: :py:class:`DataFlow` or string
            :return: True on success, False on fail.
        """
        if type(dataflow) is str:
            df = DataFlow()
            if df.load(dataflow):
                dataflow = df
        if type(dataflow) is DataFlow:
            return yc.engine_load(self.ptr, dataflow.ptr) and True or False
        raise TypeError('dataflow parameter must be a DataFlow object or '
                        'dataflow filename !')
Example #5
0
    def addFeature(self, definition):
        """
            Add a feature defined according the
            :ref:`feature definition syntax <featplan>`.

            :param definition: feature definition
            :type definition: string
            :rtype: True on success, False on fail.
        """
        data = definition.split(':')
        if not len(data) == 2:
            print 'Syntax error in "%s"' % definition
            return False
        name, featdef = data
        dataflow = DataFlow()
        dataflow.createInput('audio', self.audio_params)
        if featdef.strip():
            for s in featdef.split('>'):
                s = s.strip()
                bb = s.split(' ')
                feat = AudioFeatureFactory.get_feature(bb[0])
                if not feat:
                    return False
                params = {}
                for d in bb[1:]:
                    if len(d) == 0:
                        continue
                    if not '=' in d:
                        print 'Invalid feature parameter "%s"' % d
                        return False
                    dd = d.split('=')
                    if not len(dd) == 2:
                        print 'Syntax error in feature parameter "%s"' % d
                        return False
                    params[dd[0]] = dd[1]
                dataflow.append(feat.get_dataflow(params, self.sample_rate))
        fNode = dataflow.finalNodes()[0]
        feat_attrs = self.out_attrs.copy()
        feat_attrs['yaafedefinition'] = featdef.strip()
        outNode = dataflow.createOutput(name, feat_attrs)
        dataflow.link(fNode, '', outNode, '')
        self.dataflow.merge(dataflow)
        return True
Example #6
0
    def addFeature(self, definition):
        """
            Add a feature defined according the
            :ref:`feature definition syntax <featplan>`.

            :param definition: feature definition
            :type definition: string
            :rtype: True on success, False on fail.
        """
        data = definition.split(':')
        if not len(data) == 2:
            print 'Syntax error in "%s"' % definition
            return False
        name, featdef = data
        dataflow = DataFlow()
        dataflow.createInput('audio', self.audio_params)
        if featdef.strip():
            for s in featdef.split('>'):
                s = s.strip()
                bb = s.split(' ')
                feat = AudioFeatureFactory.get_feature(bb[0])
                if not feat:
                    return False
                params = {}
                for d in bb[1:]:
                    if len(d) == 0:
                        continue
                    if not '=' in d:
                        print 'Invalid feature parameter "%s"' % d
                        return False
                    dd = d.split('=')
                    if not len(dd) == 2:
                        print 'Syntax error in feature parameter "%s"' % d
                        return False
                    params[dd[0]] = dd[1]
                dataflow.append(feat.get_dataflow(params, self.sample_rate))
        fNode = dataflow.finalNodes()[0]
        feat_attrs = self.out_attrs.copy()
        feat_attrs['yaafedefinition'] = featdef.strip()
        outNode = dataflow.createOutput(name, feat_attrs)
        dataflow.link(fNode, '', outNode, '')
        self.dataflow.merge(dataflow)
        return True
Example #7
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('SlopeIntegrator', params)
     return df
Example #8
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('Derivate', params)
     return df
Example #9
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     dataflow_safe_append(df, 'Cepstrum', params)
     return df
Example #10
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('FrameTokenizer', params)
     return df
Example #11
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     dataflow_safe_append(df, 'AutoCorrelationPeaksIntegrator', params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('SimpleThresholdClassification', params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('DilationFilter', params)
     return df
Example #14
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('SlopeIntegrator', params)
     return df
Example #15
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('FrameTokenizer', params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode("SimpleThresholdClassification", params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode("AccumulateSameValues", params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode("WindowConvolution", params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode("DilationFilter", params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode("SimpleNoiseGate", params)
     return df
Example #21
0
    def get_dataflow(cls, params, samplerate):
        nboct = decimal.Decimal(params['CQTNbOctaves'])
        original_fs = samplerate
        original_step = int(params['stepSize'])
        samplerate = decimal.Decimal(samplerate)
        minFreq = decimal.Decimal(params['CQTMinFreq']) * (2 ** (nboct - 1))
        bandwidth = decimal.Decimal('0.95')
        # create dataflow
        df = DataFlow()
        signal_node = None
        # decimate until first octave to analyse
        nbdecim = 0
        while ((bandwidth * samplerate / 8) > minFreq):
            s = df.createNode('Decimate2', {})
            if signal_node:
                df.link(signal_node, '', s, '')
            signal_node = s
            samplerate = samplerate / 2
            nbdecim = nbdecim + 1
        # check stepsize is OK with decimation
#        stepSize = int(params['stepSize'])
#        if (stepSize % (2**(nbdecim+nboct-1)))!=0:
#            stepSize = stepSize - stepSize % (2**(nbdecim+nboct-1))
#            print 'WARNING: adjust stepSize to %i to make it compatible with successive decimation'%stepSize
        # compute octave CQT parameters
        Q = 2 / (2 ** (1.0 / int(params['CQTBinsPerOctave'])) - 1)
        fftLen = Q * float(samplerate / minFreq)
        fftLen = pow(2, math.ceil(math.log(fftLen) / math.log(2)))
#        current_stepSize = stepSize / (2**nbdecim)
        oct_params = {'CQTBinsPerOctave': params['CQTBinsPerOctave'],
                      'CQTAlign': params['CQTAlign'],
                      'CQTMinFreq': '%s' % str(minFreq / samplerate),
                      'CQTMaxFreq': '%s' % str(2 * minFreq / samplerate - decimal.Decimal('1e-14'))}
        # for each octave, analysis, concatenate and decimation
        concat_node = df.createNode('Concatenate', {})
        for oct in range(nboct, 0, -1):
            frames = df.createNode('AdvancedFrameTokenizer',
                                   {'blockSize': '%i' % fftLen,
                                    'outStepSize': '%i' % original_step,
                                    'outSampleRate': '%f' % original_fs})
            if signal_node:
                df.link(signal_node, '', frames, '')
            cspec = df.createNode(
                'FFT', {'FFTLength': '%i' % fftLen, 'FFTWindow': 'None'})
            df.link(frames, '', cspec, '')
            oct_cq = df.createNode('CQT', oct_params)
            df.link(cspec, '', oct_cq, '')
            df.link(oct_cq, '', concat_node, '%i' % (oct - 1))
            if (oct == 1):
                # no more octave to analyze, no need to decimate any more
                break
            # decimation for next actave analysis
            s = df.createNode('Decimate2', {})
            if signal_node:
                df.link(signal_node, '', s, '')
            signal_node = s
#            current_stepSize = current_stepSize / 2
            minFreq = minFreq / 2
        return df
Example #22
0
class FeaturePlan(object):
    """
        FeaturePlan is a collection of features to extract, configured for a
        specific sample rate.

        :param sample_rate: analysis samplerate
        :param normalize: signal maximum normalization, in [0,1],
                          or `None` to skip normalization.
        :param resample: force resample the sample rate of input audio to
                         param `sample_rate`, default: False.
        :param time_start: time offset where to start analyse,
                           if given a negative value(e.g: \"-10s\" ),
                           it will start at the last 10s. default: 0.0(s)
        :param time_limit: longest time duration to keep, 0s means no limit.
                           If the given value is longer than the available
                           duration, the excess should be ignored.
                           default: 0.0(s)

        This collection can be load from a file using the
        :py:meth:`loadFeaturePlan` method, or built by adding features with
        the :py:meth:`addFeature` method.

        Then, the :py:meth:`getDataFlow` method retrieve the corresponding
        :py:class:`DataFlow` object.

        .. doctest::

            >>> fp = FeaturePlan(sample_rate=16000)
            >>> fp.addFeature('mfcc: MFCC blockSize=512 stepSize=256')
            True
            >>> fp.addFeature('mfcc_d1: MFCC blockSize=512 stepSize=256 > '\
                              'Derivate DOrder=1')
            True
            >>> fp.addFeature('mfcc_d2: MFCC blockSize=512 stepSize=256 > '\
                              'Derivate DOrder=2')
            True
            >>> df = fp.getDataFlow()
            >>> df.display()
            ...
    """

    def __init__(self, sample_rate=44100, normalize=None, resample=False,
                 time_start=0.0, time_limit=0.0):
        if type(normalize) == int:
            normalize = '%i' % normalize
        elif type(normalize) == float:
            normalize = '%f' % normalize
        elif normalize and type(normalize) != str:
            normalize = str(normalize)
        self.features = {}
        self.resample = resample
        self.sample_rate = sample_rate
        self.audio_params = {
            'SampleRate': str(sample_rate),
            'Resample': 'yes' if resample else 'no',
            'TimeStart': '%ss' % time_start,
            'TimeLimit': '%ss' % time_limit
        }
        if normalize:
            self.audio_params['RemoveMean'] = 'yes'
            self.audio_params['ScaleMax'] = normalize
        self.out_attrs = {'normalize': normalize or '-1',
                          'version': yaafecore.getYaafeVersion(),
                          'samplerate': str(sample_rate),
                          'resample': 'yes' if resample else 'no'}
        self.dataflow = DataFlow()

    def addFeature(self, definition):
        """
            Add a feature defined according the
            :ref:`feature definition syntax <featplan>`.

            :param definition: feature definition
            :type definition: string
            :rtype: True on success, False on fail.
        """
        data = definition.split(':')
        if not len(data) == 2:
            print 'Syntax error in "%s"' % definition
            return False
        name, featdef = data
        dataflow = DataFlow()
        dataflow.createInput('audio', self.audio_params)
        if featdef.strip():
            for s in featdef.split('>'):
                s = s.strip()
                bb = s.split(' ')
                feat = AudioFeatureFactory.get_feature(bb[0])
                if not feat:
                    return False
                params = {}
                for d in bb[1:]:
                    if len(d) == 0:
                        continue
                    if not '=' in d:
                        print 'Invalid feature parameter "%s"' % d
                        return False
                    dd = d.split('=')
                    if not len(dd) == 2:
                        print 'Syntax error in feature parameter "%s"' % d
                        return False
                    params[dd[0]] = dd[1]
                dataflow.append(feat.get_dataflow(params, self.sample_rate))
        fNode = dataflow.finalNodes()[0]
        feat_attrs = self.out_attrs.copy()
        feat_attrs['yaafedefinition'] = featdef.strip()
        outNode = dataflow.createOutput(name, feat_attrs)
        dataflow.link(fNode, '', outNode, '')
        self.dataflow.merge(dataflow)
        return True

    def loadFeaturePlan(self, filename):
        """
            Loads feature extraction plan from a file.
            The file must be a text file,
            where each line defines a feature
            (see :ref:`feature definition syntax <feat-def-format>`).

            :rtype: True on success, False on fail.
        """
        fin = open(filename, 'r')
        for line in fin:
            if line.startswith('#'):
                continue
            line = line.strip()
            if line:
                if not self.addFeature(line):
                    return False
        fin.close()
        return True

    def getDataFlow(self):
        """
            Get the :py:class:`DataFlow` object representing how to extract
            defined features.

            :rtype: DataFlow
        """
        return self.dataflow
Example #23
0
 def get_dataflow(cls, params, samplerate):
     nboct = decimal.Decimal(params["CQTNbOctaves"])
     original_fs = samplerate
     original_step = int(params["stepSize"])
     samplerate = decimal.Decimal(samplerate)
     minFreq = decimal.Decimal(params["CQTMinFreq"]) * (2 ** (nboct - 1))
     bandwidth = decimal.Decimal("0.95")
     # create dataflow
     df = DataFlow()
     signal_node = None
     # decimate until first octave to analyse
     nbdecim = 0
     while (bandwidth * samplerate / 8) > minFreq:
         s = df.createNode("Decimate2", {})
         if signal_node:
             df.link(signal_node, "", s, "")
         signal_node = s
         samplerate = samplerate / 2
         nbdecim = nbdecim + 1
     # check stepsize is OK with decimation
     #        stepSize = int(params['stepSize'])
     #        if (stepSize % (2**(nbdecim+nboct-1)))!=0:
     #            stepSize = stepSize - stepSize % (2**(nbdecim+nboct-1))
     #            print 'WARNING: adjust stepSize to %i to make it compatible with successive decimation'%stepSize
     # compute octave CQT parameters
     Q = 2 / (2 ** (1.0 / int(params["CQTBinsPerOctave"])) - 1)
     fftLen = Q * float(samplerate / minFreq)
     fftLen = pow(2, math.ceil(math.log(fftLen) / math.log(2)))
     #        current_stepSize = stepSize / (2**nbdecim)
     oct_params = {
         "CQTBinsPerOctave": params["CQTBinsPerOctave"],
         "CQTAlign": params["CQTAlign"],
         "CQTMinFreq": "%s" % str(minFreq / samplerate),
         "CQTMaxFreq": "%s" % str(2 * minFreq / samplerate - decimal.Decimal("1e-14")),
     }
     # for each octave, analysis, concatenate and decimation
     concat_node = df.createNode("Concatenate", {})
     for oct in range(nboct, 0, -1):
         frames = df.createNode(
             "AdvancedFrameTokenizer",
             {"blockSize": "%i" % fftLen, "outStepSize": "%i" % original_step, "outSampleRate": "%f" % original_fs},
         )
         if signal_node:
             df.link(signal_node, "", frames, "")
         cspec = df.createNode("FFT", {"FFTLength": "%i" % fftLen, "FFTWindow": "None"})
         df.link(frames, "", cspec, "")
         oct_cq = df.createNode("CQT", oct_params)
         df.link(cspec, "", oct_cq, "")
         df.link(oct_cq, "", concat_node, "%i" % (oct - 1))
         if oct == 1:
             # no more octave to analyze, no need to decimate any more
             break
         # decimation for next actave analysis
         s = df.createNode("Decimate2", {})
         if signal_node:
             df.link(signal_node, "", s, "")
         signal_node = s
         #            current_stepSize = current_stepSize / 2
         minFreq = minFreq / 2
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('WindowConvolution', params)
     return df
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('AccumulateSameValues', params)
     return df
Example #26
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode('Derivate', params)
     return df
Example #27
0
class FeaturePlan(object):
    """
        FeaturePlan is a collection of features to extract, configured for a
        specific sample rate.

        :param sample_rate: analysis samplerate
        :param normalize: signal maximum normalization, in [0,1],
                          or `None` to skip normalization.
        :param resample: force resample the sample rate of input audio to
                         param `sample_rate`, default: False.
        :param time_start: time offset where to start analyse,
                           if given a negative value(e.g: \"-10s\" ),
                           it will start at the last 10s. default: 0.0(s)
        :param time_limit: longest time duration to keep, 0s means no limit.
                           If the given value is longer than the available
                           duration, the excess should be ignored.
                           default: 0.0(s)

        This collection can be load from a file using the
        :py:meth:`loadFeaturePlan` method, or built by adding features with
        the :py:meth:`addFeature` method.

        Then, the :py:meth:`getDataFlow` method retrieve the corresponding
        :py:class:`DataFlow` object.

        .. doctest::

            >>> fp = FeaturePlan(sample_rate=16000)
            >>> fp.addFeature('mfcc: MFCC blockSize=512 stepSize=256')
            True
            >>> fp.addFeature('mfcc_d1: MFCC blockSize=512 stepSize=256 > '\
                              'Derivate DOrder=1')
            True
            >>> fp.addFeature('mfcc_d2: MFCC blockSize=512 stepSize=256 > '\
                              'Derivate DOrder=2')
            True
            >>> df = fp.getDataFlow()
            >>> df.display()
            ...
    """
    def __init__(self,
                 sample_rate=44100,
                 normalize=None,
                 resample=False,
                 time_start=0.0,
                 time_limit=0.0):
        if type(normalize) == int:
            normalize = '%i' % normalize
        elif type(normalize) == float:
            normalize = '%f' % normalize
        elif normalize and type(normalize) != str:
            normalize = str(normalize)
        self.features = {}
        self.resample = resample
        self.sample_rate = sample_rate
        self.audio_params = {
            'SampleRate': str(sample_rate),
            'Resample': 'yes' if resample else 'no',
            'TimeStart': '%ss' % time_start,
            'TimeLimit': '%ss' % time_limit
        }
        if normalize:
            self.audio_params['RemoveMean'] = 'yes'
            self.audio_params['ScaleMax'] = normalize
        self.out_attrs = {
            'normalize': normalize or '-1',
            'version': yaafecore.getYaafeVersion(),
            'samplerate': str(sample_rate),
            'resample': 'yes' if resample else 'no'
        }
        self.dataflow = DataFlow()

    def addFeature(self, definition):
        """
            Add a feature defined according the
            :ref:`feature definition syntax <featplan>`.

            :param definition: feature definition
            :type definition: string
            :rtype: True on success, False on fail.
        """
        data = definition.split(':')
        if not len(data) == 2:
            print 'Syntax error in "%s"' % definition
            return False
        name, featdef = data
        dataflow = DataFlow()
        dataflow.createInput('audio', self.audio_params)
        if featdef.strip():
            for s in featdef.split('>'):
                s = s.strip()
                bb = s.split(' ')
                feat = AudioFeatureFactory.get_feature(bb[0])
                if not feat:
                    return False
                params = {}
                for d in bb[1:]:
                    if len(d) == 0:
                        continue
                    if not '=' in d:
                        print 'Invalid feature parameter "%s"' % d
                        return False
                    dd = d.split('=')
                    if not len(dd) == 2:
                        print 'Syntax error in feature parameter "%s"' % d
                        return False
                    params[dd[0]] = dd[1]
                dataflow.append(feat.get_dataflow(params, self.sample_rate))
        fNode = dataflow.finalNodes()[0]
        feat_attrs = self.out_attrs.copy()
        feat_attrs['yaafedefinition'] = featdef.strip()
        outNode = dataflow.createOutput(name, feat_attrs)
        dataflow.link(fNode, '', outNode, '')
        self.dataflow.merge(dataflow)
        return True

    def loadFeaturePlan(self, filename):
        """
            Loads feature extraction plan from a file.
            The file must be a text file,
            where each line defines a feature
            (see :ref:`feature definition syntax <feat-def-format>`).

            :rtype: True on success, False on fail.
        """
        fin = open(filename, 'r')
        for line in fin:
            if line.startswith('#'):
                continue
            line = line.strip()
            if line:
                if not self.addFeature(line):
                    return False
        fin.close()
        return True

    def getDataFlow(self):
        """
            Get the :py:class:`DataFlow` object representing how to extract
            defined features.

            :rtype: DataFlow
        """
        return self.dataflow
Example #28
0
    def get_dataflow(cls, params, samplerate):
        nboct = decimal.Decimal(params['CQTNbOctaves'])
        original_fs = samplerate
        original_step = int(params['stepSize'])
        samplerate = decimal.Decimal(samplerate)
        minFreq = decimal.Decimal(params['CQTMinFreq']) * (2 ** (nboct - 1))
        bandwidth = decimal.Decimal('0.95')
        # create dataflow
        df = DataFlow()
        signal_node = None
        # decimate until first octave to analyse
        nbdecim = 0
        while ((bandwidth * samplerate / 8) > minFreq):
            s = df.createNode('Decimate2', {})
            if signal_node:
                df.link(signal_node, '', s, '')
            signal_node = s
            samplerate = samplerate / 2
            nbdecim = nbdecim + 1
        # check stepsize is OK with decimation
#        stepSize = int(params['stepSize'])
#        if (stepSize % (2**(nbdecim+nboct-1)))!=0:
#            stepSize = stepSize - stepSize % (2**(nbdecim+nboct-1))
#            print('WARNING: adjust stepSize to %i to make it compatible with successive decimation'%stepSize)
        # compute octave CQT parameters
        Q = 2 / (2 ** (1.0 / int(params['CQTBinsPerOctave'])) - 1)
        fftLen = Q * float(samplerate / minFreq)
        fftLen = pow(2, math.ceil(math.log(fftLen) / math.log(2)))
#        current_stepSize = stepSize / (2**nbdecim)
        oct_params = {'CQTBinsPerOctave': params['CQTBinsPerOctave'],
                      'CQTAlign': params['CQTAlign'],
                      'CQTMinFreq': '%s' % str(minFreq / samplerate),
                      'CQTMaxFreq': '%s' % str(2 * minFreq / samplerate - decimal.Decimal('1e-14'))}
        # for each octave, analysis, concatenate and decimation
        concat_node = df.createNode('Concatenate', {})
        for oct in range(int(nboct), 0, -1):
            frames = df.createNode('AdvancedFrameTokenizer',
                                   {'blockSize': '%i' % fftLen,
                                    'outStepSize': '%i' % original_step,
                                    'outSampleRate': '%f' % original_fs})
            if signal_node:
                df.link(signal_node, '', frames, '')
            cspec = df.createNode(
                'FFT', {'FFTLength': '%i' % fftLen, 'FFTWindow': 'None'})
            df.link(frames, '', cspec, '')
            oct_cq = df.createNode('CQT', oct_params)
            df.link(cspec, '', oct_cq, '')
            df.link(oct_cq, '', concat_node, '%i' % (oct - 1))
            if (oct == 1):
                # no more octave to analyze, no need to decimate any more
                break
            # decimation for next actave analysis
            s = df.createNode('Decimate2', {})
            if signal_node:
                df.link(signal_node, '', s, '')
            signal_node = s
#            current_stepSize = current_stepSize / 2
            minFreq = minFreq / 2
        return df
Example #29
0
 def get_dataflow(cls, params, samplerate):
     df = DataFlow()
     df.createNode("HistogramIntegrator", params)
     return df