Example #1
0
Mfcc::ParameterList
Mfcc::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;
    desc.identifier = "nfilters";
    desc.name = "Number of filters";
    desc.description = "Size of mel filterbank used to compute MFCCs (fixed to 40 for now)";
    desc.minValue = 40;
    desc.maxValue = 40;
    desc.defaultValue = 40;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc = ParameterDescriptor();
    desc.identifier = "ncoeffs";
    desc.name = "Number of coefficients";
    desc.description = "Number of output coefficients to compute";
    desc.minValue = 1;
    desc.maxValue = 100;
    desc.defaultValue = 13;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    return list;
}
MzSpectrogramFFTW::ParameterList
MzSpectrogramFFTW::getParameterDescriptors(void) const {

   ParameterList       pdlist;
   ParameterDescriptor pd;

   // first parameter: The minimum spectral bin to display
   pd.identifier   = "minbin";
   pd.name         = "Minimum\nfrequency\nbin";
   pd.unit         = "";
   pd.minValue     = 0.0;
   pd.maxValue     = 30000.0;
   pd.defaultValue = 0.0;
   pd.isQuantized  = 1;
   pd.quantizeStep = 1.0;
   pdlist.push_back(pd);

   // second parameter: The maximum spectral bin to display
   pd.identifier   = "maxbin";
   pd.name         = "Maximum\nfrequency\nbin";
   pd.unit         = "";
   pd.minValue     = -1.0;
   pd.maxValue     = 30000.0;
   pd.defaultValue = -1.0;
   pd.isQuantized  = 1;
   pd.quantizeStep = 1.0;
   pdlist.push_back(pd);

   return pdlist;
}
PercussionOnsetDetector::ParameterList
PercussionOnsetDetector::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor d;
    d.identifier = "threshold";
    d.name = "Energy rise threshold";
    d.description = "Energy rise within a frequency bin necessary to count toward broadband total";
    d.unit = "dB";
    d.minValue = 0;
    d.maxValue = 20;
    d.defaultValue = 3;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "sensitivity";
    d.name = "Sensitivity";
    d.description = "Sensitivity of peak detector applied to broadband detection function";
    d.unit = "%";
    d.minValue = 0;
    d.maxValue = 100;
    d.defaultValue = 40;
    d.isQuantized = false;
    list.push_back(d);

    return list;
}
FixedTempoEstimator::ParameterList
FixedTempoEstimator::D::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor d;
    d.identifier = "minbpm";
    d.name = "Minimum estimated tempo";
    d.description = "Minimum beat-per-minute value which the tempo estimator is able to return";
    d.unit = "bpm";
    d.minValue = 10;
    d.maxValue = 360;
    d.defaultValue = 50;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "maxbpm";
    d.name = "Maximum estimated tempo";
    d.description = "Maximum beat-per-minute value which the tempo estimator is able to return";
    d.defaultValue = 190;
    list.push_back(d);

    d.identifier = "maxdflen";
    d.name = "Input duration to study";
    d.description = "Length of audio input, in seconds, which should be taken into account when estimating tempo.  There is no need to supply the plugin with any further input once this time has elapsed since the start of the audio.  The tempo estimator may use only the first part of this, up to eight times the slowest beat duration: increasing this value further than that is unlikely to improve results.";
    d.unit = "s";
    d.minValue = 2;
    d.maxValue = 40;
    d.defaultValue = 10;
    list.push_back(d);

    return list;
}
Example #5
0
Energy::ParameterList
Energy::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor threshold;
    threshold.identifier = "threshold";
    threshold.name = "Low energy threshold";
    threshold.description = "Ratio of threshold to average energy.";
    threshold.unit = "";
    threshold.minValue = 0;
    threshold.maxValue = 10;
    threshold.defaultValue = 1;
    threshold.isQuantized = false;
    list.push_back(threshold);

    ParameterDescriptor root;
    root.identifier = "root";
    root.name = "Use root";
    root.description = "Whether to apply root to energy calc.";
    root.unit = "";
    root.minValue = 0;
    root.maxValue = 1;
    root.defaultValue = 1;
    root.isQuantized = true;
    root.quantizeStep = 1;
    list.push_back(root);

    return list;
}
AmplitudeFollower::ParameterList
AmplitudeFollower::getParameterDescriptors() const
{
    ParameterList list;
	
    ParameterDescriptor att;
    att.identifier = "attack";
    att.name = "Attack time";
    att.description = "The 60dB convergence time for an increase in amplitude";
    att.unit = "s";
    att.minValue = 0.0f;
    att.maxValue = 1.f;
    att.defaultValue = 0.01f;
    att.isQuantized = false;
    
    list.push_back(att);
    
    ParameterDescriptor dec;
    dec.identifier = "release";
    dec.name = "Release time";
    dec.description = "The 60dB convergence time for a decrease in amplitude";
    dec.unit = "s";
    dec.minValue = 0.0f;
    dec.maxValue = 1.f;
    dec.defaultValue = 0.01f;
    dec.isQuantized = false;
    
    list.push_back(dec);
    
    return list;
}
Example #7
0
KeyDetector::ParameterList
KeyDetector::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;
    desc.identifier = "tuning";
    desc.name = "Tuning Frequency";
    desc.description = "Frequency of concert A";
    desc.unit = "Hz";
    desc.minValue = 420;
    desc.maxValue = 460;
    desc.defaultValue = 440;
    desc.isQuantized = false;
    list.push_back(desc);
    
    desc.identifier = "length";
    desc.name = "Window Length";
    desc.unit = "chroma frames";
    desc.description = "Number of chroma analysis frames per key estimation";
    desc.minValue = 1;
    desc.maxValue = 30;
    desc.defaultValue = 10;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    return list;
}
Example #8
0
void SegmentationBestFit::on_cylinderParameters_clicked()
{
    ParameterList list;
    std::vector<float> p = cylinderParameter;
    p.resize(7);
    QString base = tr("Base");
    QString axis = tr("Axis");
    QString radius = tr("Radius");
    QString x = QString::fromLatin1(" x");
    QString y = QString::fromLatin1(" y");
    QString z = QString::fromLatin1(" z");
    list.push_back(std::make_pair(base + x, p[0]));
    list.push_back(std::make_pair(base + y, p[1]));
    list.push_back(std::make_pair(base + z, p[2]));
    list.push_back(std::make_pair(axis + x, p[3]));
    list.push_back(std::make_pair(axis + y, p[4]));
    list.push_back(std::make_pair(axis + z, p[5]));
    list.push_back(std::make_pair(radius,   p[6]));

    static QPointer<QDialog> dialog = 0;
    if (!dialog)
        dialog = new ParametersDialog(cylinderParameter,
                                      new CylinderFitParameter,
                                      list, myMesh, this);
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->show();
}
Example #9
0
BarBeatTracker::ParameterList
BarBeatTracker::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;

    desc.identifier = "bpb";
    desc.name = "Beats per Bar";
    desc.description = "The number of beats in each bar";
    desc.minValue = 2;
    desc.maxValue = 16;
    desc.defaultValue = 4;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    // changes are as per the BeatTrack.cpp
    //Alpha Parameter of Beat Tracker
    desc.identifier = "alpha";
    desc.name = "Alpha";
    desc.description = "Inertia - Flexibility Trade Off";
    desc.minValue =  0.1;
    desc.maxValue = 0.99;
    desc.defaultValue = 0.90;
    desc.unit = "";
    desc.isQuantized = false;
    list.push_back(desc);

    // We aren't exposing tightness as a parameter, it's fixed at 4

    // changes are as per the BeatTrack.cpp
    //User input tempo
    desc.identifier = "inputtempo";
    desc.name = "Tempo Hint";
    desc.description = "User-defined tempo on which to centre the tempo preference function";
    desc.minValue =  50;
    desc.maxValue = 250;
    desc.defaultValue = 120;
    desc.unit = "BPM";
    desc.isQuantized = true;
    list.push_back(desc);

    // changes are as per the BeatTrack.cpp
    desc.identifier = "constraintempo";
    desc.name = "Constrain Tempo";
    desc.description = "Constrain more tightly around the tempo hint, using a Gaussian weighting instead of Rayleigh";
    desc.minValue = 0;
    desc.maxValue = 1;
    desc.defaultValue = 0;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    desc.unit = "";
    desc.valueNames.clear();
    list.push_back(desc);


    return list;
}
Example #10
0
DWT::ParameterList
DWT::getParameterDescriptors() const
{
    ParameterList list;
 
    ParameterDescriptor d;
    d.identifier = "scales";
    d.name = "Scales";
    d.description = "Scale depth";
    d.unit = "";
    d.minValue = 1.0f;
    d.maxValue = 16.0f;
    d.defaultValue = 10.0f;
    d.isQuantized = true;
    d.quantizeStep = 1.0f;
    list.push_back(d);
 
    d.identifier = "wavelet";
    d.name = "Wavelet";
    d.description = "Wavelet type to use";
    d.unit = "";
    d.minValue = 0.f;
    d.maxValue = int(Wavelet::LastType);
    d.defaultValue = int(Wavelet::Haar);
    d.isQuantized = true;
    d.quantizeStep = 1.0f;

    for (int i = 0; i <= int(Wavelet::LastType); ++i) {
        d.valueNames.push_back(Wavelet::getWaveletName(Wavelet::Type(i)));
    }
    list.push_back(d);
    d.valueNames.clear();

    d.identifier = "threshold";
    d.name = "Threshold";
    d.description = "Wavelet coefficient threshold";
    d.unit = "";
    d.minValue = 0.0f;
    d.maxValue = 0.01f;
    d.defaultValue = 0.0f;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "absolute";
    d.name = "Absolute values";
    d.description = "Return absolute values";
    d.unit = "";
    d.minValue = 0.0f;
    d.maxValue = 1.00f;
    d.defaultValue = 0.0f;
    d.isQuantized = true;
    d.quantizeStep = 1.0f;
    list.push_back(d);
 
    return list;
}
Example #11
0
CQChromaVamp::ParameterList
CQChromaVamp::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;

    desc.identifier = "lowestoct";
    desc.name = "Lowest Contributing Octave";
    desc.unit = "";
    desc.description = "Octave number of the lowest octave to include in the chromagram. Octave numbering is ASA standard, with -1 as the first octave in the MIDI range and middle-C being C4. The octave starts at C.";
    desc.minValue = -1;
    desc.maxValue = 12;
    desc.defaultValue = defaultLowestOctave;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc.identifier = "octaves";
    desc.name = "Contributing Octave Count";
    desc.unit = "octaves";
    desc.description = "Number of octaves to use when generating the Constant-Q transform. All octaves are wrapped around and summed to produce a single octave chromagram as output.";
    desc.minValue = 1;
    desc.maxValue = 12;
    desc.defaultValue = defaultOctaveCount;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc.identifier = "tuning";
    desc.name = "Tuning Frequency";
    desc.unit = "Hz";
    desc.description = "Frequency of concert A";
    desc.minValue = 360;
    desc.maxValue = 500;
    desc.defaultValue = defaultTuningFrequency;
    desc.isQuantized = false;
    list.push_back(desc);
    
    desc.identifier = "bpo";
    desc.name = "Bins per Octave";
    desc.unit = "bins";
    desc.description = "Number of constant-Q transform bins per octave";
    desc.minValue = 2;
    desc.maxValue = 480;
    desc.defaultValue = defaultBPO;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    return list;
}
Example #12
0
TonalChangeDetect::ParameterList TonalChangeDetect::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;
    desc.identifier = "smoothingwidth";
    desc.name = "Gaussian smoothing";
    desc.description = "Window length for the internal smoothing operation, in chroma analysis frames";
    desc.unit = "frames";
    desc.minValue = 0;
    desc.maxValue = 20;
    desc.defaultValue = 5;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc.identifier = "minpitch";
    desc.name = "Chromagram minimum pitch";
    desc.unit = "MIDI units";
    desc.description = "Lowest pitch in MIDI units to be included in the chroma analysis";
    desc.minValue = 0;
    desc.maxValue = 127;
    desc.defaultValue = 32;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc.identifier = "maxpitch";
    desc.name = "Chromagram maximum pitch";
    desc.unit = "MIDI units";
    desc.description = "Highest pitch in MIDI units to be included in the chroma analysis";
    desc.minValue = 0;
    desc.maxValue = 127;
    desc.defaultValue = 108;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc.identifier = "tuning";
    desc.name = "Chromagram tuning frequency";
    desc.unit = "Hz";
    desc.description = "Frequency of concert A in the music under analysis";
    desc.minValue = 420;
    desc.maxValue = 460;
    desc.defaultValue = 440;
    desc.isQuantized = false;
    list.push_back(desc);

    return list;
}
Example #13
0
PluginHostAdapter::ParameterList
PluginHostAdapter::getParameterDescriptors() const
{
    ParameterList list;
    for (unsigned int i = 0; i < m_descriptor->parameterCount; ++i) {
        const VampParameterDescriptor *spd = m_descriptor->parameters[i];
        ParameterDescriptor pd;
        pd.identifier = spd->identifier;
        pd.name = spd->name;
        pd.description = spd->description;
        pd.unit = spd->unit;
        pd.minValue = spd->minValue;
        pd.maxValue = spd->maxValue;
        pd.defaultValue = spd->defaultValue;
        pd.isQuantized = spd->isQuantized;
        pd.quantizeStep = spd->quantizeStep;
        if (pd.isQuantized && spd->valueNames) {
            for (unsigned int j = 0; spd->valueNames[j]; ++j) {
                pd.valueNames.push_back(spd->valueNames[j]);
            }
        }
        list.push_back(pd);
    }
    return list;
}
Example #14
0
MyPlugin::ParameterList
MyPlugin::getParameterDescriptors() const
{
    ParameterList list;

    // If the plugin has no adjustable parameters, return an empty
    // list here (and there's no need to provide implementations of
    // getParameter and setParameter in that case either).

    // Note that it is your responsibility to make sure the parameters
    // start off having their default values (e.g. in the constructor
    // above).  The host needs to know the default value so it can do
    // things like provide a "reset to default" function, but it will
    // not explicitly set your parameters to their defaults for you if
    // they have not changed in the mean time.

    ParameterDescriptor d;
    d.identifier = "parameter";
    d.name = "Some Parameter";
    d.description = "";
    d.unit = "";
    d.minValue = 0;
    d.maxValue = 10;
    d.defaultValue = 5;
    d.isQuantized = false;
    list.push_back(d);

    return list;
}
int dummyEffect(const ParameterList & parameterList,
          predicateCallbackType  predicateCallback,
          numericalFluentCallbackType numericalFluentCallback,
          int relaxed, vector<double>& writtenVars)
{
   ROS_DEBUG("Calling %s module", __func__);
   if(predicateCallback == NULL)
      return false;
   PredicateList pl;
   ParameterList paramList;
   paramList.push_back(Parameter("","","pos-1"));
   pl.push_back(Predicate("free", paramList));
   PredicateList* plp = &pl;
   bool ret = predicateCallback(plp); 
   if(!ret)
      return false;
   if(pl.empty())      // callback removed our predicate!
      return false;
   // now we could / should react on the value of the predicate. skip
   // this for the moment....
   std::cout << "(free pos-1) is currently " << pl.front().value <<
          std::endl;
   // write arbitrary value back
   writtenVars[0] = 17.0;
   return 0;
}
ParameterList lift2PL(const ParameterList& pl1,const ParameterList& pl2,
                      std::function<matrix::Matrix (const matrix::Matrix&, const matrix::Matrix&)> fun){
  ParameterList res;
  assert(pl1.size()==pl2.size());
  FOREACH2(pl1, pl2, p1, p2){
    res.push_back(fun(*p1,*p2));
  }
Example #17
0
BeatTracker::ParameterList
BeatTracker::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;

    desc.identifier = "method";
    desc.name = "Beat Tracking Method";
    desc.description = "Basic method to use ";
    desc.minValue = 0;
    desc.maxValue = 1;
    desc.defaultValue = METHOD_NEW;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    desc.valueNames.push_back("Old");
    desc.valueNames.push_back("New");
    list.push_back(desc);

    desc.identifier = "dftype";
    desc.name = "Onset Detection Function Type";
    desc.description = "Method used to calculate the onset detection function";
    desc.minValue = 0;
    desc.maxValue = 4;
    desc.defaultValue = 3;
    desc.valueNames.clear();
    desc.valueNames.push_back("High-Frequency Content");
    desc.valueNames.push_back("Spectral Difference");
    desc.valueNames.push_back("Phase Deviation");
    desc.valueNames.push_back("Complex Domain");
    desc.valueNames.push_back("Broadband Energy Rise");
    list.push_back(desc);

    desc.identifier = "whiten";
    desc.name = "Adaptive Whitening";
    desc.description = "Normalize frequency bin magnitudes relative to recent peak levels";
    desc.minValue = 0;
    desc.maxValue = 1;
    desc.defaultValue = 0;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    desc.unit = "";
    desc.valueNames.clear();
    list.push_back(desc);

    return list;
}
ParameterList ParameterCopyAudioFunctor::parameterList() {
    ParameterList parameterList;
    for (int i = 0; i < numParameters; ++i) {
        auto parameter = TestParameter::testParameter(i);
        parameterList.push_back(parameter);
    }
    return parameterList;
}
Example #19
0
 flightrec_status add_parameter(const char *name, size_t value)
 {
     fdr_parameters params = {};
     strlcpy(params.name, name, ID_LEN);
     params.value = value;
     parameters.push_back(params);
     return FDR_OK;
 }
Example #20
0
SegmenterPlugin::ParameterList SegmenterPlugin::getParameterDescriptors() const
{
    ParameterList list;
	
    ParameterDescriptor desc;
    desc.identifier = "nSegmentTypes";
    desc.name = "Number of segment-types";
    desc.description = "Maximum number of different kinds of segment to find";
    desc.unit = "";
    desc.minValue = 2;
    desc.maxValue = 12;
    desc.defaultValue = 10;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);
	
    ParameterDescriptor desc2;
    desc2.identifier = "featureType";
    desc2.name = "Feature Type";
    desc2.description = "Try Chromatic for acoustic or pre-1980 recordings, otherwise use Hybrid";
    desc2.unit = "";
    desc2.minValue = 1;
    desc2.maxValue = 3;
    desc2.defaultValue = 1;
    desc2.isQuantized = true;
    desc2.quantizeStep = 1;
    desc2.valueNames.push_back("Hybrid (Constant-Q)");
    desc2.valueNames.push_back("Chromatic (Chroma)");
    desc2.valueNames.push_back("Timbral (MFCC)");
    list.push_back(desc2);	
	
    ParameterDescriptor desc3;
    desc3.identifier = "neighbourhoodLimit";
    desc3.name = "Minimum segment duration";
    desc3.description = "Approximate expected minimum duration for each segment";
    desc3.unit = "s";
    desc3.minValue = 1;
    desc3.maxValue = 15;
    desc3.defaultValue = 4;
    desc3.isQuantized = true;
    desc3.quantizeStep = 0.2;
    list.push_back(desc3);

    return list;
}
Example #21
0
MFCCPlugin::ParameterList
MFCCPlugin::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;
    desc.identifier = "nceps";
    desc.name = "Number of Coefficients";
    desc.unit = "";
    desc.description = "Number of MFCCs to return, starting from C0 if \"Include C0\" is specified or from C1 otherwise";
    desc.minValue = 1;
    desc.maxValue = 40;
    desc.defaultValue = 20;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    desc.identifier = "logpower";
    desc.name = "Power for Mel Amplitude Logs";
    desc.unit = "";
    desc.description = "Power to raise the amplitude log values to before applying DCT.  Values greater than 1 may reduce contribution of noise";
    desc.minValue = 0;
    desc.maxValue = 5;
    desc.defaultValue = 1;
    desc.isQuantized = false;
    desc.quantizeStep = 0;
    list.push_back(desc);

    desc.identifier = "wantc0";
    desc.name = "Include C0";
    desc.unit = "";
    desc.description = "Whether to include the C0 (energy level) coefficient in the returned results";
    desc.minValue = 0;
    desc.maxValue = 1;
    desc.defaultValue = 1;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    return list;
}
Example #22
0
Var ExpressionNode::evaluate(){
    if(type == VARIABLE){
        return theVar;
    }else {
        int C= children.size();
        ParameterList list;
        for(int i=0;i<C;i++){
            Var v = children.at(i)->evaluate();
            list.push_back(v);
        }
        return theOp->evaluate(list);
    }
}
Example #23
0
Silence::ParameterList
Silence::getParameterDescriptors() const
{
    ParameterList list;
    ParameterDescriptor desc;

    desc = ParameterDescriptor();
    desc.identifier = "silencethreshold";
    desc.name = "Silence Threshold";
    desc.minValue = -120;
    desc.maxValue = 0;
    desc.defaultValue = -80;
    desc.unit = "dB";
    desc.isQuantized = false;
    list.push_back(desc);

    return list;
}
Example #24
0
MiniBpmVamp::ParameterList
MiniBpmVamp::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor d;

    d.identifier = "bpb";
    d.name = "Beats per bar";
    d.description = "Number of beats per bar, if known. If not known, leave this set to 4.";
    d.unit = "beats";
    d.minValue = 1;
    d.maxValue = 12;
    d.defaultValue = 4;
    d.isQuantized = true;
    d.quantizeStep = 1;
    list.push_back(d);

    return list;
}
Example #25
0
VampTestPlugin::ParameterList
VampTestPlugin::getParameterDescriptors() const
{
    ParameterList list;

    // Provide one parameter, and make it so that we can easily tell
    // whether it has been changed
    ParameterDescriptor d;
    d.identifier = "produce_output";
    d.name = "Produce some output";
    d.description = "Whether to produce any output. If this parameter is switched off, the plugin will produce no output. This is intended for basic testing of whether a host's parameter setting logic is functioning.";
    d.unit = "";
    d.minValue = 0;
    d.maxValue = 1;
    d.defaultValue = 1;
    d.isQuantized = true;
    d.quantizeStep = 1;
    list.push_back(d);
    
    return list;
}
Example #26
0
AdaptiveSpectrogram::ParameterList
AdaptiveSpectrogram::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor desc;
    desc.identifier = "n";
    desc.name = "Number of resolutions";
    desc.description = "Number of consecutive powers of two in the range to be used as spectrogram resolutions, starting with the minimum resolution specified";
    desc.unit = "";
    desc.minValue = 2;
    desc.maxValue = 10;
    desc.defaultValue = 3;
    desc.isQuantized = true;
    desc.quantizeStep = 1;
    list.push_back(desc);

    ParameterDescriptor desc2;
    desc2.identifier = "w";
    desc2.name = "Smallest resolution";
    desc2.description = "Smallest of the consecutive powers of two to use as spectrogram resolutions";
    desc2.unit = "";
    desc2.minValue = 1;
    desc2.maxValue = 14;
    desc2.defaultValue = 9;
    desc2.isQuantized = true;
    desc2.quantizeStep = 1;
    // I am so lazy
    desc2.valueNames.push_back("2");
    desc2.valueNames.push_back("4");
    desc2.valueNames.push_back("8");
    desc2.valueNames.push_back("16");
    desc2.valueNames.push_back("32");
    desc2.valueNames.push_back("64");
    desc2.valueNames.push_back("128");
    desc2.valueNames.push_back("256");
    desc2.valueNames.push_back("512");
    desc2.valueNames.push_back("1024");
    desc2.valueNames.push_back("2048");
    desc2.valueNames.push_back("4096");
    desc2.valueNames.push_back("8192");
    desc2.valueNames.push_back("16384");
    list.push_back(desc2);

    ParameterDescriptor desc3;
    desc3.identifier = "coarse";
    desc3.name = "Omit alternate resolutions";
    desc3.description = "Generate a coarser spectrogram faster by excluding every alternate resolution (first and last resolution are always retained)";
    desc3.unit = "";
    desc3.minValue = 0;
    desc3.maxValue = 1;
    desc3.defaultValue = 0;
    desc3.isQuantized = true;
    desc3.quantizeStep = 1;
    list.push_back(desc3);

    desc3.identifier = "threaded";
    desc3.name = "Multi-threaded processing";
    desc3.description = "Perform calculations using several threads in parallel";
    desc3.unit = "";
    desc3.minValue = 0;
    desc3.maxValue = 1;
    desc3.defaultValue = 1;
    desc3.isQuantized = true;
    desc3.quantizeStep = 1;
    list.push_back(desc3);

    return list;
}
Example #27
0
FindPulseBatch::ParameterList
FindPulseBatch::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor d;
    d.identifier = "minduration";
    d.name = "Minimum pulse duration";
    d.description = "Minimum duration of a pulse in milliseconds; shorter pulses are discarded";
    d.unit = "milliseconds";
    d.minValue = 0.1;
    d.maxValue = 50;
    d.defaultValue = FindPulseBatch::m_default_min_duration;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "maxduration";
    d.name = "Maximum pulse duration";
    d.description = "Maximum duration of a pulse in milliseconds; longer pulses are discarded";
    d.unit = "milliseconds";
    d.minValue = 0.1;
    d.maxValue = 50;
    d.defaultValue = FindPulseBatch::m_default_max_duration;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "minpower";
    d.name = "Power threshold (db above background)";
    d.description = "a pulse consists of consecutive samples with power at least this much above background, in dB";
    d.unit = "dB";
    d.minValue = 0.001;
    d.maxValue = 100;
    d.defaultValue = FindPulseBatch::m_default_min_power;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "maxfreqrsd";
    d.name = "Max frequency relative SD";
    d.description = "Maximum relative standard deviation in frequency for a pulse to qualify as real";
    d.unit = "";
    d.minValue = 0;
    d.maxValue = 1;
    d.defaultValue = FindPulseBatch::m_default_max_freq_rsd;
    d.isQuantized = false;
    list.push_back(d);

    d.identifier = "pulsepowwinsize";
    d.name = "Size of power-averaging window for pulse";
    d.description = "Number of samples in moving-average window for pulse power";
    d.unit = "samples";
    d.minValue = 1;
    d.maxValue = 1024;
    d.defaultValue = FindPulseBatch::m_default_pulse_power_win_size;
    d.isQuantized = true;
    d.quantizeStep = 1;
    list.push_back(d);

    d.identifier = "bkgdpowwinsize";
    d.name = "Size of power-averaging window for background";
    d.description = "Number of samples in moving-average window for background power";
    d.unit = "samples";
    d.minValue = 1;
    d.maxValue = 40960;
    d.defaultValue = FindPulseBatch::m_default_bkgd_power_win_size;
    d.isQuantized = true;
    d.quantizeStep = 1;
    list.push_back(d);

    return list;
}
Example #28
0
Energy::ParameterList
Energy::getParameterDescriptors() const
{
    ParameterList list;

    ParameterDescriptor root;
    root.identifier = "root";
    root.name = "Use root";
    root.description = "Whether to apply root to energy calc.";
    root.unit = "";
    root.minValue = 0;
    root.maxValue = 1;
    root.defaultValue = 1;
    root.isQuantized = true;
    root.quantizeStep = 1;
    list.push_back(root);

    ParameterDescriptor avgwindow;
    avgwindow.identifier = "avgwindow";
    avgwindow.name = "Moving average window size";
    avgwindow.description = "Size of moving averagw window, in seconds.";
    avgwindow.unit = "seconds";
    avgwindow.minValue = 0.001;
    avgwindow.maxValue = 10;
    avgwindow.defaultValue = 1;
    avgwindow.isQuantized = false;
    list.push_back(avgwindow);

    ParameterDescriptor avgpercentile;
    avgpercentile.identifier = "avgpercentile";
    avgpercentile.name = "Moving average percentile";
    avgpercentile.description = "Percentile to use when calculating moving average.";
    avgpercentile.unit = "";
    avgpercentile.minValue = 0;
    avgpercentile.maxValue = 100;
    avgpercentile.defaultValue = 3;
    avgpercentile.isQuantized = false;
    list.push_back(avgpercentile);

    ParameterDescriptor dipthresh;
    dipthresh.identifier = "dipthresh";
    dipthresh.name = "Dip threshold";
    dipthresh.description = "Threshold for calculating dips, as multiple of the moving average.";
    dipthresh.unit = "";
    dipthresh.minValue = 0;
    dipthresh.maxValue = 10;
    dipthresh.defaultValue = 3;
    dipthresh.isQuantized = false;
    list.push_back(dipthresh);

    ParameterDescriptor threshold;
    threshold.identifier = "threshold";
    threshold.name = "Low energy threshold";
    threshold.description = "Threshold to use for low energy, as a multiple of mean energy.";
    threshold.unit = "";
    threshold.minValue = 0;
    threshold.maxValue = 10;
    threshold.defaultValue = 1;
    threshold.isQuantized = false;
    list.push_back(threshold);

    return list;
}
double can_load(const ParameterList & parameterList,
       predicateCallbackType predicateCallback, numericalFluentCallbackType numericalFluentCallback, int )
{
  ROS_DEBUG("Calling module %s", __func__);

  static int count = 0;
  count++;
  //cout << "Count: " << count << endl;
   if(DEBUG_MOD)
      cout << parameterList << endl;

  PredicateList* list = NULL;
  predicateCallback(list);

  if(list == NULL) {
     exit(1);
     return false;
  }

  if(DEBUG_MOD) {
     cout << "Predicates are: " << endl;
     cout << *list << endl;
  }

  string me = parameterList.front().value;
  string pack = parameterList.back().value;

  deque<string> packs_in_truck;
  for(PredicateList::iterator it = list->begin(); it != list->end(); it++) {
      Predicate p = *it;
      if(!p.value)
         continue;
      if(p.name != "in")
         continue;
      if(p.parameters.back().value == me)
         packs_in_truck.push_back(p.parameters.front().value);
  }

  if(DEBUG_MOD) {
     for(deque<string>::iterator it = packs_in_truck.begin(); it != packs_in_truck.end(); it++) {
        cout << *it << endl;
     }
     if(packs_in_truck.empty()) {
        cout << "No packs in " << me << endl;
     } else {
        cout << packs_in_truck.size() << " packs i truck " << me << endl;
     }
  }
  packs_in_truck.push_back(pack);

  NumericalFluentList* nfl = new NumericalFluentList();
  for(deque<string>::iterator it = packs_in_truck.begin(); it != packs_in_truck.end(); it++) {
     ParameterList pl;
     pl.push_back(Parameter("p", "package", *it));
     nfl->push_back(NumericalFluent("package-size", pl));
  }
  ParameterList plt;
  plt.push_back(Parameter("v", "vehicle", me));
  nfl->push_back(NumericalFluent("capacity", plt));

  if(!numericalFluentCallback(nfl)) {
     exit(1);
     return false;
  }

  if(DEBUG_MOD)
     cout << *nfl << endl;

  // ideally: get sizes 1 - n-2, size n-1 == package, size n == capcity
  // 1..n-2 + n == full_load
  deque<double> packs;
  for(NumericalFluentList::iterator it = nfl->begin(); it != nfl->end(); it++) {
     packs.push_back((*it).value);
  } 
  double cap = packs.back();
  packs.erase(packs.end() - 1);
  double pSize = packs.back();
  packs.erase(packs.end() - 1);

  if(DEBUG_MOD)
      cout << "Packs" << packs.size() <<endl;
  double sumPacks = 0;
  for(deque<double>::iterator it = packs.begin(); it != packs.end(); it++) {
      if(DEBUG_MOD)
          cout << *it << endl;
      sumPacks += *it;
  }
  if(DEBUG_MOD) {
     cout << "newpack " << pSize << endl;
     cout << "cap " << cap << endl;
  }

  double loadCap = sumPacks + cap;
  if(DEBUG_MOD) {
     cout << "loadCap " << loadCap;

     cout << endl;
  }

  packs.push_back(pSize);

  bool loadPoss = checkLoading(packs, loadCap);
  return loadPoss;
}
Example #30
0
Rhythm::ParameterList Rhythm::getParameterDescriptors() const {
  ParameterList list;

  ParameterDescriptor numBandsParam;
  numBandsParam.identifier = "numBands";
  numBandsParam.name = "Sub-bands";
  numBandsParam.description = "Number of sub-bands.";
  numBandsParam.unit = "";
  numBandsParam.minValue = 2;
  numBandsParam.maxValue = 50;
  numBandsParam.defaultValue = 7;
  numBandsParam.isQuantized = true;
  numBandsParam.quantizeStep = 1.0;
  list.push_back(numBandsParam);

  ParameterDescriptor thresholdParam;
  thresholdParam.identifier = "threshold";
  thresholdParam.name = "Threshold";
  thresholdParam.description = "For peak picker.";
  thresholdParam.unit = "";
  thresholdParam.minValue = 0;
  thresholdParam.maxValue = 10;
  thresholdParam.defaultValue = 1;
  thresholdParam.isQuantized = false;
  list.push_back(thresholdParam);

  ParameterDescriptor average_windowParam;
  average_windowParam.identifier = "average_window";
  average_windowParam.name = "Moving average window length";
  average_windowParam.description = "Length of window used for moving average.";
  average_windowParam.unit = "frames";
  average_windowParam.minValue = 1;
  average_windowParam.maxValue = 500;
  average_windowParam.defaultValue = 200;
  average_windowParam.isQuantized = true;
  average_windowParam.quantizeStep = 1.0;
  list.push_back(average_windowParam);

  ParameterDescriptor peak_windowParam;
  peak_windowParam.identifier = "peak_window";
  peak_windowParam.name = "Onset peak window length";
  peak_windowParam.description = "Length of window used for peak picking.";
  peak_windowParam.unit = "frames";
  peak_windowParam.minValue = 1;
  peak_windowParam.maxValue = 20;
  peak_windowParam.defaultValue = 6;
  peak_windowParam.isQuantized = true;
  peak_windowParam.quantizeStep = 1.0;
  list.push_back(peak_windowParam);

  ParameterDescriptor min_bpmParam;
  min_bpmParam.identifier = "min_bpm";
  min_bpmParam.name = "Minimum BPM";
  min_bpmParam.description = "Minimum BPM calculated for autocorrelation.";
  min_bpmParam.unit = "bpm";
  min_bpmParam.minValue = 5;
  min_bpmParam.maxValue = 300;
  min_bpmParam.defaultValue = 12;
  min_bpmParam.isQuantized = true;
  min_bpmParam.quantizeStep = 1.0;
  list.push_back(min_bpmParam);

  ParameterDescriptor max_bpmParam;
  max_bpmParam.identifier = "max_bpm";
  max_bpmParam.name = "Maximum BPM";
  max_bpmParam.description = "Maximum BPM calculated for autocorrelation.";
  max_bpmParam.unit = "bpm";
  max_bpmParam.minValue = 50;
  max_bpmParam.maxValue = 400;
  max_bpmParam.defaultValue = 300;
  max_bpmParam.isQuantized = true;
  max_bpmParam.quantizeStep = 1.0;
  list.push_back(max_bpmParam);

  return list;
}