Example #1
0
 def __init__(self,
              inputSamples="samples",
              outputOnsetDetection="onsetDetection",
              parameterHopLength=512,
              parameterBacktrack="True",
              cachingLevel=2,
              forceRefreshCache=False):
     self.parameters = {"hopLength": Parameter(parameterHopLength), "backtrack": Parameter(parameterBacktrack)}
     self.inputs = [inputSamples]
     self.outputs = [outputOnsetDetection]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #2
0
 def __init__(
         self,
         parameterHopLength=512,
         parameterNieto=False,  # Use nieto's implementation
         #  parameterScale="Power",
         inputSamples="samples",
         outputPcp="pcp",
         cachingLevel=2,
         forceRefreshCache=False):
     self.parameters = {"hopLength": Parameter(parameterHopLength), "nieto": Parameter(parameterNieto)}
     self.inputs = [inputSamples]
     self.outputs = [outputPcp]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #3
0
    def __init__(self,
                 parameterMedianSize=16,
                 parameterRelativeThreshold=0.5,
                 parameterThresholdIndex=1,
                 parameterMinDistance=0,
                 inputSignal="barMSE",
                 outputPeaks="peaks",
                 cachingLevel=2,
                 forceRefreshCache=False):
        """
        Estimator computing returning peaks from a signal.
        Based on the method from MAXIMUM FILTER VIBRATO SUPPRESSION FOR ONSET DETECTION 2013 

        Parameters
        ----------
        parameterRelativeThreshold (optional float):
            return the maximum value of a continuous window exceeding the threshold in % of the max value

        parameterThresholdIndex
            Limit the search of the maximum value in this part of the signal (1 = 100% of the track, 0.5 = 50% from the start of 
            the track)

        parameterMinDistance
            return the highest peaks in a window of this size, 
            This value filter peaks within distance striclty inferior.
            (If min distance is set to 8 ticks, two peaks 8 ticks appart can be return) 
            
        parameterMedianSize
            When computing peaks without a static threshold


        windowSize (optional int):


        distance (optional int)
            min distance in indexes between two peaks
        """
        self.parameters = {
            "medianSize": Parameter(parameterMedianSize),
            "relativeThreshold": Parameter(parameterRelativeThreshold),
            "thresholdIndex": Parameter(parameterThresholdIndex),
            "minDistance": Parameter(parameterMinDistance)
        }
        self.inputs = [inputSignal]
        self.outputs = [outputPeaks]
        self.cachingLevel = cachingLevel
        self.forceRefreshCache = forceRefreshCache
Example #4
0
 def __init__(self,
              parameterWindowSize=8,
              parameterAbsoluteDiff=True,
              parameterGaussianCoef=5,
              inputSamples="normalizedBarMSE",
              outputNovelty="noveltyMSE",
              cachingLevel=2,
              forceRefreshCache=False):
     self.parameters = {
         "windowSize": Parameter(parameterWindowSize),
         "absoluteDiff": Parameter(parameterAbsoluteDiff),
         "gaussianCoef": Parameter(parameterGaussianCoef)
     }
     self.inputs = [inputSamples]
     self.outputs = [outputNovelty]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #5
0
File: cqt.py Project: jarey/Automix
 def __init__(self,
              parameterHopLength=512,
              parameterBinNumber=84,
              parameterScale="Power",
              inputSamples="samples",
              outputCqt="cqt",
              cachingLevel=2,
              forceRefreshCache=False):
     self.parameters = {
         "hopLength": Parameter(parameterHopLength),
         "binNumber": Parameter(parameterBinNumber),
         "scale": Parameter(parameterScale)
     }
     self.inputs = [inputSamples]
     self.outputs = [outputCqt]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #6
0
 def __init__(self,
              parameterWindowSize=16,
              parameterDistanceMetric="seuclidean",
              parameterDebugViz=False,
              parameterAddZerosStart=True,
              inputSamples="normalizedBarMSE",
              outputNovelty="noveltyMSE",
              cachingLevel=2,
              forceRefreshCache=False):
     self.parameters = {
         "windowSize": Parameter(parameterWindowSize),
         "distanceMetric": Parameter(parameterDistanceMetric),
         "debugViz": Parameter(parameterDebugViz),
         "addZerosStart": Parameter(parameterAddZerosStart)
     }
     self.inputs = [inputSamples]
     self.outputs = [outputNovelty]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #7
0
    def __init__(self,
                 parameterDiffThreshold=5,
                 parameterRatioThreshold=0,
                 parameterKMax=0,
                 parameterzeroThreshold=0.000001,
                 inputSignal="barMSE",
                 outputBoundaries="boundaries",
                 outputLabels="labels",
                 outputOnsets="onsets",
                 cachingLevel=0,
                 forceRefreshCache=False):
        """
        Estimator computing the structure of a track based on salient points in the input signal
        the input signal should not be too noisy. It works best when the input signal is already averaged per beats or per downbeats 

        Parameters
        ----------
        diffThreshold (optional float):
            threshold setting the difference between the previous sample and the current one to label it as a segment.
            this difference is computed in term of diffThreshold * (mean difference between each sample)

        kMax (optional int):
            If you don't want to use a factor for the saillance detection, you can specify to return the k-most saillant points.

        ratioThreshold (optional float):
            thresold setting the ratio difference between two point to consider them saillant

        zeroThreshold (float):
            Indicating the threshold under which an amplitude should be considered as being zero.
            it's usefull to set the first segment where the difference between the samples is not big because the signal is rizing from silence.
        """
        self.parameters = {
            "diffThreshold": Parameter(parameterDiffThreshold),
            "ratioThreshold": Parameter(parameterRatioThreshold),
            "kMax": Parameter(parameterKMax),
            "zeroThreshold": Parameter(parameterzeroThreshold)
        }
        raise DeprecationWarning()
        self.inputs = [inputSignal]
        self.outputs = [outputBoundaries, outputLabels, outputOnsets]
        self.cachingLevel = cachingLevel
        self.forceRefreshCache = forceRefreshCache
Example #8
0
 def __init__(self,
              inputPath="path",
              outputSamples="samples",
              parameterSampleRate=None,
              cachingLevel=2,
              forceRefreshCache=False):
     self.inputs = [inputPath]
     self.outputs = [outputSamples]
     self.parameters = {"sampleRate": Parameter(parameterSampleRate)}
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #9
0
 def __init__(
     self,
     inputFeatures=["cqtAmplitudeCheckerboard"],
     inputGrid="strongBeats",
     outputPeriod="period",
     parameterDistanceMetric="RMS",
     parameterFeatureAggregation="quantitative",
     parameterPeriod=2,
     cachingLevel=2,
     forceRefreshCache=True
 ):  #As long as there is no way of updating the cache when the input changes
     self.inputs = [inputFeatures, inputGrid]
     self.outputs = [outputPeriod]
     self.parameters = {
         "period": Parameter(parameterPeriod),
         "distanceMetric": Parameter(parameterDistanceMetric),
         "featureAggregation": Parameter(parameterFeatureAggregation)
     }
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #10
0
 def __init__(self,
              inputPath="path",
              outputClassification="vocals",
              outputPitch="vocalsMelody",
              parameterModel="Seg",
              cachingLevel=0,
              forceRefreshCache=False):
     self.inputs = [inputPath]
     self.outputs = [outputClassification, outputPitch]
     self.parameters = {"model": Parameter(parameterModel)}
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #11
0
 def __init__(self,
              inputSignal="cqtAmplitudeCheckerboardPeaks",
              inputGrid="period",
              outputSignal="cqtAmplitudeCheckerboardQuantized",
              parameterMaxThreshold=-1,
              cachingLevel=2,
              forceRefreshCache=False):
     self.inputs = [inputSignal, inputGrid]
     self.outputs = [outputSignal]
     self.parameters = {"maxThreshold": Parameter(parameterMaxThreshold)}
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #12
0
 def __init__(
         self,
         parameterAbsoluteTop=None,  # Absolute number of peaks to select. Set to None to kepp all the peaks
         parameterClusterDistance=0,  # The distance in seconds to cluster multiple features occuring at the same time.
         parameterMergeFunction=np.sum,  # How the clustered peaks' values are merged
         parameterRelativeDistance=1,  # Return peaks only within in the beginning % of the track
         parameterSalienceTreshold=0,  # Return peaks preceding a segment having at least this quantity in the Salience feature
         parameterSalienceWindow=8,  # the size of the window suceeding the peak to compute the salience
         inputPeaks=["cqtAmplitudeCheckerboardPeaks"],  # The peaks filtered
         inputGrid="strongBeats",  # The grid to compute the salience window and the duration of the track
         inputSalience=["cqtAmplitudeRMSE"],  # The list of features used for the salience
         outputPeaks="selectedPeaks",  # Name of the output
         outputNonSalient="nonSalientPeaks",
         cachingLevel=0,
         forceRefreshCache=True): #As long as there is no way of updating the cache when the input changes
     """
     Estimator selecting peaks from multiple list of peaks.
     """
     self.parameters = {
         "absoluteTop": Parameter(parameterAbsoluteTop),
         "clusterDistance": Parameter(parameterClusterDistance),
         "relativeDistance": Parameter(parameterRelativeDistance),
         "salienceTreshold": Parameter(parameterSalienceTreshold),
         "salienceWindow": Parameter(parameterSalienceWindow),
         "mergeFunction": Parameter(parameterMergeFunction)
     }
     self.inputs = [inputPeaks, inputGrid, inputSalience]
     self.outputs = [outputPeaks, outputNonSalient]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #13
0
 def __init__(self,
              parameterSnapDistance=0.05,
              parameterTransitionLambda=300,
              parameterCorrectToActivation=True,
              inputPath="path",
              outputBeats="beats",
              outputdownbeats="downbeats",
              outputStrongBeats="strongBeats",
              outputTempo="tempo",
              cachingLevel=0,
              forceRefreshCache=False):
     self.parameters = {
         "snapDistance": Parameter(parameterSnapDistance),
         "transitionLambda": Parameter(parameterTransitionLambda),
         "correctToActivation": Parameter(parameterCorrectToActivation)
     }
     self.inputs = [inputPath]
     self.outputs = [
         outputBeats, outputdownbeats, outputStrongBeats, outputTempo
     ]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #14
0
    def __init__(self,
                 parameterWindow="rectangular",
                 parameterAggregation="rmse",
                 parameterSteps=1,
                 parameterPanning=0,
                 inputSamples="samples",
                 inputGrid="downbeats",
                 output="RMSE",
                 cachingLevel=0,
                 forceRefreshCache=False):
        """
        Create a window of the input signal at each grid tick

        parameterWindow: the name of the window function to apply:
        - rectangular: Only window currently implemented

        parameterAggregation: What to do to the values in the window
        - None
        - rmse
        - sum

        parameterPanning: How much do you shift, in ratio of the median distance between the grid ticks, the windows boundaries.
        Use a neagtive value (ie -0.25) to shift the windows 1/4 of the grid to the left.

        parameterSteps: TODO
        """
        # parameterLength: TODO implement
        #  parameterBands=[[20, 250], [250, 3000], [3000, 22000]],
        self.parameters = {
            "window": Parameter(parameterWindow),
            "aggregation": Parameter(parameterAggregation),
            "steps": Parameter(parameterSteps),
            "panning": Parameter(parameterPanning)
        }
        self.inputs = [inputSamples, inputGrid]
        self.outputs = [output]
        self.cachingLevel = cachingLevel
        self.forceRefreshCache = forceRefreshCache
Example #15
0
 def __init__(self,
              parameterModel="CRNN_3",
              inputPath="path",
              outputKick="kick",
              outputSnare="snare",
              outputHihat="hihat",
              cachingLevel=0,
              forceRefreshCache=False):
     super().__init__()
     self.parameters = {"model": Parameter(parameterModel)}
     self.inputs = [inputPath]
     self.outputs = [outputKick, outputSnare, outputHihat]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #16
0
 def __init__(
         self,
         #  parameter_Mp_adaptive=28,
         #  parameter_offset_thres=0.05,
         parameter_M_gaussian=16,
         parameter_m_embedded=3,
         parameter_k_nearest=0.04,
         parameter_bound_norm_feats=np.inf,
         inputSamples="normalizedBarMSE",
         outputNovelty="noveltyMSE",
         cachingLevel=2,
         forceRefreshCache=False):
     self.parameters = {
         # "Mp_adaptive": Parameter(parameter_Mp_adaptive),
         # "offset_thres": Parameter(parameter_offset_thres),
         "M_gaussian": Parameter(parameter_M_gaussian),
         "m_embedded": Parameter(parameter_m_embedded),
         "k_nearest": Parameter(parameter_k_nearest),
         "bound_norm_feats": Parameter(parameter_bound_norm_feats)
     }
     self.inputs = [inputSamples]
     self.outputs = [outputNovelty]
     self.cachingLevel = cachingLevel
     self.forceRefreshCache = forceRefreshCache
Example #17
0
    def __init__(self,
                 inputValues="samples",
                 inputGrid="period",
                 parameterIncludeBorders=True,
                 outputPeaks="core",
                 cachingLevel=0,
                 forceRefreshCache=False):
        """Look at the rms of the signal for a segment and label it as a core if it's abov the rms of the full track

        """
        self.parameters = {
            "includeBorders": Parameter(parameterIncludeBorders)
        }
        self.inputs = [inputValues, inputGrid]
        self.outputs = [outputPeaks]
        self.cachingLevel = cachingLevel
        self.forceRefreshCache = forceRefreshCache