当前位置: 首页>>代码示例>>C++>>正文


C++ MarSystem::process方法代码示例

本文整理汇总了C++中MarSystem::process方法的典型用法代码示例。如果您正苦于以下问题:C++ MarSystem::process方法的具体用法?C++ MarSystem::process怎么用?C++ MarSystem::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MarSystem的用法示例。


在下文中一共展示了MarSystem::process方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: recognize

void recognize(string sfName, string outName)
{
  MarSystemManager mng;

  mrs_realvec out, tmpvec;
  mrs_natural inputsize, wsize;
  mrs_real samplingFreq;
  Collection inputs;

  MarSystem* all = mng.create("Series", "all");
  MarSystem* acc = mng.create("Accumulator", "acc");
  MarSystem* net = mng.create("Series", "net");
  MarSystem* total = mng.create("Series", "total");
  MarSystem* src = mng.create("SoundFileSource", "src");
  MarSystem* spc = mng.create("Spectrum", "spc");
  MarSystem* pws = mng.create("PowerSpectrum", "pws");
  MarSystem* crm = mng.create("Chroma","crm");
  MarSystem* csl = mng.create("ChromaScale","csl");
  MarSystem* ff = mng.create("Fanout", "ff");
  MarSystem* ss = mng.create("Fanout", "ss");
  MarSystem* mn = mng.create("Mean", "mn");
  MarSystem* std = mng.create("StandardDeviation", "std");

  MarSystem* mfccnet = mng.create("Series", "mfccnet");

  MarSystem* ant = mng.create("Annotator", "ant");
  MarSystem* wks = mng.create("WekaSink", "wks");
  MarSystem* wksnet = mng.create("Series", "wksnet");

  inputs.read(sfName);

  mfccnet->addMarSystem(mng.create("Spectrum","spc2"));
  mfccnet->addMarSystem(mng.create("PowerSpectrum","psc2"));
  mfccnet->addMarSystem(mng.create("MFCC", "mfcc"));

  total->addMarSystem(src);
  total->addMarSystem(ff);
  net->addMarSystem(spc);
  net->addMarSystem(pws);
  net->addMarSystem(crm);
  net->addMarSystem(csl);
  ff->addMarSystem(mfccnet);
  ff->addMarSystem(net);
  acc->addMarSystem(total);
  all->addMarSystem(acc);
  ss->addMarSystem(mn);
  ss->addMarSystem(std);
  all->addMarSystem(ss);

  wksnet->addMarSystem(ant);
  wksnet->addMarSystem(wks);

  wksnet->updControl("mrs_natural/inSamples", 1);
  wksnet->updControl("mrs_natural/inObservations", all->getctrl("mrs_natural/onObservations")->to<mrs_natural>());
  wksnet->updControl("WekaSink/wks/mrs_string/labelNames", inputs.getLabelNames()); // change to just sfName
  wksnet->updControl("WekaSink/wks/mrs_natural/nLabels", (mrs_natural)inputs.getNumLabels());  // change to just 1
  wksnet->updControl("WekaSink/wks/mrs_natural/downsample", 1);
  wksnet->updControl("WekaSink/wks/mrs_string/filename", outName);
  tmpvec.create(all->getctrl("mrs_natural/onObservations")->to<mrs_natural>()+1,1);

  for(mrs_natural i=0; i<inputs.size(); ++i) {
    cout << "Now processing: " << inputs.entry(i) << endl;

    src->updControl("mrs_string/filename", inputs.entry(i));
    //spc->updControl("mrs_natural/inSamples", 1024);
    inputsize = src->getctrl("mrs_natural/size")->to<mrs_natural>();
    wsize = src->getctrl("mrs_natural/onSamples")->to<mrs_natural>();
    inputsize /= wsize;
    acc->updControl("mrs_natural/nTimes", inputsize);
    samplingFreq = src->getctrl("mrs_real/israte")->to<mrs_real>();
    all->update();
    crm->setctrl("mrs_real/samplingFreq", samplingFreq);
    crm->setctrl("mrs_natural/lowOctNum", 2);
    crm->setctrl("mrs_natural/highOctNum", 5);
    crm->setctrl("mrs_natural/inObservations", wsize/2);
    crm->update();
    csl->setctrl("mrs_natural/inObservations", 12);
    csl->update();

    all->tick();

    out = all->getctrl("mrs_realvec/processedData")->to<mrs_realvec>();

    wksnet->updControl("Annotator/ant/mrs_natural/label", (mrs_natural)inputs.labelNum(inputs.labelEntry(i)));  // change to just 0
    wksnet->updControl("WekaSink/wks/mrs_string/currentlyPlaying", inputs.entry(i));
    wksnet->process(out, tmpvec);

  }

  delete all;
  delete wksnet;

}
开发者ID:Amos-zq,项目名称:marsyas,代码行数:93,代码来源:extractMoodFeatures.cpp

示例2: tags


//.........这里部分代码省略.........
	testpSink->updControl("mrs_natural/inSamples", 1);
	testpSink->updControl("mrs_natural/inObservations", nLabels+1);
	testpSink->updControl("mrs_natural/nLabels", nLabels);
	testpSink->updControl("mrs_string/labelNames", labelNames);
	testpSink->updControl("mrs_string/inObsNames", labelNames);
	testpSink->updControl("mrs_string/filename", testing_predictions_arff);

	// Set up the weka source to read the testing data
	cout << "Testing Filename = " << testing_arff << endl;
	net->updControl("WekaSource/wsrc/mrs_string/filename", testing_arff);
	cout << "Starting Prediction for Testing Collection" << endl;
	cout << "Writing .mf style predictions to " << testing_predictions << endl;
	cout << "The following output file can serve as a stacked testing .arff" << endl;
	cout << "Writing .arff style predictions to " << testing_predictions_arff << endl;

	mrs_realvec probs;
	mrs_realvec testpSinkOut;
	mrs_string currentlyPlaying;
	realvec data;
	realvec wsourcedata;
	vector<string> previouslySeenFilenames;

	// Open the non-stacked predictions output file to write to.
	ofstream prout;
	prout.open(testing_predictions.c_str());

	// Tick over the test WekaSource, saving our predictions for each line,
	// until all lines in the test file have been read.
	testpSinkOut.create(nLabels+1,1);
	while (!net->getctrl("WekaSource/wsrc/mrs_bool/done")->to<mrs_bool>())
	{
		net->tick();

		wsourcedata = net->getctrl("WekaSource/wsrc/mrs_realvec/processedData")->to<mrs_realvec>();
		data = net->getctrl("mrs_realvec/processedData")->to<mrs_realvec>();
		currentlyPlaying = net->getctrl("WekaSource/wsrc/mrs_string/currentFilename")->to<mrs_string>();

		if (!alreadySeen(currentlyPlaying, previouslySeenFilenames))
		{
			probs = net->getctrl("Classifier/cl/mrs_realvec/processedData")->to<mrs_realvec>();

			for (mrs_natural i=0; i < probs.getSize()-2; i++)
			{
				testpSinkOut(i,0) = probs(2+i);
				prout << currentlyPlaying << "\t" << classNames[i] << "\t" << probs(2+i) << endl;
			}

			testpSinkOut(probs.getSize()-2,0) = probs(0);
			testpSink->updControl("mrs_string/currentlyPlaying", currentlyPlaying);
			testpSink->process(testpSinkOut, testpSinkOut);

			// Mark this filename as seen!
			previouslySeenFilenames.push_back(currentlyPlaying);
		}
	}

	// Close the non-stacked predictions; they are written!
	prout.close();

	/**
	 * PREDICT STEP 2
	 *
	 *     Predictions for the training arff data
	 **/

	// Initialize the weka sink that we will use to write an .arff file
开发者ID:murraymeehan,项目名称:marsyas,代码行数:67,代码来源:kea.cpp

示例3: recognize


//.........这里部分代码省略.........
  total3->updControl("WekaSink/wks3/mrs_string/inObsNames",oss.str());
  oss.str("");
  oss << outName << "_LSA.arff";
  total3->updControl("WekaSink/wks3/mrs_string/filename",oss.str());

  total4->updControl("mrs_natural/inSamples",1);
  total4->updControl("mrs_natural/inObservations",outFeatures4.getRows());
  total4->updControl("WekaSink/wks4/mrs_string/labelNames",inputs.getLabelNames());
  total4->updControl("WekaSink/wks4/mrs_natural/nLabels",inputs.getNumLabels());
  total4->updControl("WekaSink/wks4/mrs_natural/downsample",1);
  total4->updControl("WekaSink/wks4/mrs_string/inObsNames",oss.str());
  oss.str("");
  oss << outName << "_distance.arff";
  total4->updControl("WekaSink/wks4/mrs_string/filename",oss.str());
  */


  /*** process ***/

  featuresInp.create(BIN,ACC_INPUT);
  b.create(BIN+2);
  simInput.create(BIN+featuresTpl.getRows(),ACC_INPUT);
  simOutput.create(outsize,ACC_INPUT);
  tmpsimin.create(BIN*2,ACC_INPUT);
  tmpsimout.create(ACC_INPUT,ACC_INPUT);
  algOutput.create(3*ACC_INPUT,2);
  tmpalgout.create(3*ACC_INPUT,2);
  delta.create(1,ACC_INPUT);
  tmpsizes.create(2);
  segments.create(1,1);
  tmpbegin.create(1,1);
  tmpend.create(1,1);
  for(l=0; l<(mrs_natural)inputs.size(); l++){
    cout << "Now processing: " << inputs.entry(l) << endl;

    /*** calculate input spectrogram ***/

    netInp->updControl("SoundFileSource/inpsrc/mrs_string/filename",inputs.entry(l));
    netInp2->updControl("SoundFileSource/inpsrc2/mrs_string/filename",hfiles.entry(l));
    inputsize = netInp->getctrl("SoundFileSource/inpsrc/mrs_natural/size")->to<mrs_natural>();
    wsize = netInp->getctrl("Windowing/ham/mrs_natural/size")->to<mrs_natural>();
    inputsize /= wsize;
    accInp->updControl("mrs_natural/nTimes",inputsize);
    accInp2->updControl("mrs_natural/nTimes",inputsize);
    Inp->tick();
    dataInp = Inp->getctrl("mrs_realvec/processedData")->to<mrs_realvec>();

    /*** calculate input feature vector of input ***/

    featuresInp.stretch(BIN,dataInp.getCols());
    for(i=0; i<featuresInp.getRows(); ++i){
      for(j=0; j<featuresInp.getCols(); j++){
	featuresInp(i,j) = 0;
      }
    }
    sfrq = netInp->getctrl("SoundFileSource/inpsrc/mrs_real/osrate")->to<mrs_real>();
    obs = netInp->getctrl("mrs_natural/onObservations")->to<mrs_natural>();
    for(i=0; i<BIN+2; ++i){
      b(i) = wsize*700/sfrq*(pow(10, (log10(1.0+sfrq/1400))*i/(BIN+1))-1);
    }
    for(j=0; j<BIN; j++){
      for(k=0; k<obs; k++){
	if(b(j) < k && k < b(j+1)){
	  for(i=0; i<dataInp.getCols(); ++i){
	    featuresInp(j,i) += dataInp(k,i)*(k-b(j))/(b(j+1)-b(j));
	  }
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:67,代码来源:extractRhythmFeatures.cpp

示例4: record_orcas


//.........这里部分代码省略.........

    dest1->updControl("mrs_natural/inObservations", 2);
    dest1->updControl("mrs_natural/inSamples", bufferSize);
    dest1->updControl("mrs_real/israte", sropt);
    dest1->updControl("mrs_string/filename", fname1);


    dest2->updControl("mrs_natural/inObservations", 2);
    dest2->updControl("mrs_natural/inSamples", bufferSize);
    dest2->updControl("mrs_real/israte", sropt);
    dest2->updControl("mrs_string/filename", fname2);

    dest3->updControl("mrs_natural/inObservations", 2);
    dest3->updControl("mrs_natural/inSamples", bufferSize);
    dest3->updControl("mrs_real/israte", sropt);
    dest3->updControl("mrs_string/filename", fname3);


    dest4->updControl("mrs_natural/inObservations", 2);
    dest4->updControl("mrs_natural/inSamples", bufferSize);
    dest4->updControl("mrs_real/israte", sropt);
    dest4->updControl("mrs_string/filename", fname4);

    asrc->setctrl("mrs_natural/nChannels", copt);
    asrc->setctrl("mrs_natural/inSamples", bufferSize);
    asrc->setctrl("mrs_real/israte", sropt);
    asrc->update();
    // asrc->updControl("mrs_real/gain", gain);



    mrs_real srate = asrc->getctrl("mrs_real/israte")->to<mrs_real>();
    mrs_natural inSamples = asrc->getctrl("mrs_natural/inSamples")->to<mrs_natural>();
    mrs_natural iterations = (mrs_natural)((srate * length * 60.0) / inSamples);

    realvec rin;
    realvec rout;
    realvec orca1;
    realvec orca2;
    realvec orca3;
    realvec orca4;


    rin.create(copt, bufferSize);
    rout.create(copt, bufferSize);

    orca1.create(2, bufferSize);
    orca2.create(2, bufferSize);
    orca3.create(2, bufferSize);
    orca4.create(2, bufferSize);

    mrs_natural t;

    cout << "Recording " << length << " minutes to files: " << endl;
    cout << fname1 << endl;
    cout << fname2 << endl;
    cout << fname3 << endl;
    cout << fname4 << endl;

    mrs_natural minutes =0;


    for (mrs_natural i = 0; i < iterations; ++i) 
    {
        if (((i % 430)==0)&&(i != 0))
        {
            minutes ++;
            cout << minutes << ":" << lengthopt << endl;
        }
        asrc->process(rin,rout);
        for (t=0; t < bufferSize; t++)
        { 
            orca1(0,t) = rout(0,t);
            orca1(1,t) = rout(1,t);
            orca2(0,t) = rout(2,t);
            orca2(1,t) = rout(3,t);
            orca3(0,t) = rout(4,t);
            orca3(1,t) = rout(5,t);
            orca4(0,t) = rout(6,t);
            orca4(1,t) = rout(7,t);
        }
        dest1->process(orca1,orca1);
        dest2->process(orca2, orca2);
        dest3->process(orca3, orca3);
        dest4->process(orca4, orca4);

    }

    cout << "Recording complete" << endl;
    cout << "Recorded to files: " << endl;
    cout << fname1 << endl;
    cout << fname2 << endl;
    cout << fname3 << endl;
    cout << fname4 << endl;
    delete dest1;
    delete dest2;
    delete dest3;
    delete dest4;
    delete asrc;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:101,代码来源:record.cpp

示例5: pitchres

void
old_pitchextract(string sfName, mrs_natural winSize, mrs_natural hopSize,
                 mrs_natural lowPitch, mrs_natural highPitch, mrs_real threshold,
                 mrs_real playPitches)
{
  (void) winSize;
  (void) hopSize;
  (void) threshold;
  (void) playPitches;
  MRSDIAG("pitchextract.cpp - pitchextract");

  MarSystemManager mng;

  // Build the pitch extractor network
  MarSystem* pitchExtractor = mng.create("Series", "pitchExtractor");
  // pitchExtractor->addMarSystem(mng.create("AudioSource", "src"));

  pitchExtractor->addMarSystem(mng.create("SoundFileSource", "src"));
  pitchExtractor->updControl("SoundFileSource/src/mrs_string/filename", sfName);


  pitchExtractor->addMarSystem(mng.create("AutoCorrelation", "acr"));
  pitchExtractor->updControl("AutoCorrelation/acr/mrs_real/magcompress", 0.67);
  pitchExtractor->addMarSystem(mng.create("HalfWaveRectifier", "hwr"));

  MarSystem* fanout = mng.create("Fanout", "fanout");
  fanout->addMarSystem(mng.create("Gain", "id1"));
  fanout->addMarSystem(mng.create("TimeStretch", "tsc"));

  pitchExtractor->addMarSystem(fanout);

  MarSystem* fanin = mng.create("Fanin", "fanin");
  fanin->addMarSystem(mng.create("Gain", "id2"));
  fanin->addMarSystem(mng.create("Negative", "nid"));

  pitchExtractor->addMarSystem(fanin);
  pitchExtractor->addMarSystem(mng.create("HalfWaveRectifier", "hwr"));

  pitchExtractor->addMarSystem(mng.create("PlotSink", "psink0"));
  pitchExtractor->addMarSystem(mng.create("Peaker", "pkr"));
  // pitchExtractor->addMarSystem(mng.create("PlotSink", "psink1"));
  pitchExtractor->addMarSystem(mng.create("MaxArgMax", "mxr"));

  // update controls
  pitchExtractor->updControl("mrs_natural/inSamples", 1024);
  pitchExtractor->updControl("Fanout/fanout/TimeStretch/tsc/mrs_real/factor", 0.5);
  // Convert pitch bounds to samples
  cout << "lowPitch = " << lowPitch << endl;
  cout << "highPitch = " << highPitch << endl;

  mrs_real lowFreq = pitch2hertz(lowPitch);
  mrs_real highFreq = pitch2hertz(highPitch);

  mrs_natural lowSamples =
    // hertz2samples(highFreq, pitchExtractor->getctrl("AudioSource/src/mrs_real/osrate")->to<mrs_real>());
    hertz2samples(highFreq, pitchExtractor->getctrl("SoundFileSource/src/mrs_real/osrate")->to<mrs_real>());
  mrs_natural highSamples =
    //     hertz2samples(lowFreq, pitchExtractor->getctrl("AudioSource/src/mrs_real/osrate")->to<mrs_real>());
    hertz2samples(lowFreq, pitchExtractor->getctrl("SoundFileSource/src/mrs_real/osrate")->to<mrs_real>());


  cout << "lowSamples" << lowSamples << endl;
  cout << "highSamples" << highSamples << endl;


  pitchExtractor->updControl("Peaker/pkr/mrs_real/peakSpacing", 0.00);
  pitchExtractor->updControl("Peaker/pkr/mrs_real/peakStrength", 0.4);
  pitchExtractor->updControl("Peaker/pkr/mrs_natural/peakStart", lowSamples);
  pitchExtractor->updControl("Peaker/pkr/mrs_natural/peakEnd", highSamples);
  pitchExtractor->updControl("MaxArgMax/mxr/mrs_natural/nMaximums", 1);

  cout << (*pitchExtractor) << endl;

  realvec pitchres(pitchExtractor->getctrl("mrs_natural/onObservations")->to<mrs_natural>(), pitchExtractor->getctrl("mrs_natural/onSamples")->to<mrs_natural>());


  realvec win(pitchExtractor->getctrl("mrs_natural/inObservations")->to<mrs_natural>(),
              pitchExtractor->getctrl("mrs_natural/inSamples")->to<mrs_natural>());


  /// playback network
  MarSystem* playback = mng.create("Series", "playback");
  playback->addMarSystem(mng.create("SineSource", "ss"));
  playback->addMarSystem(mng.create("AudioSink", "dest"));
  playback->updControl("mrs_natural/inSamples", 512);
  //playback->updControl("mrs_bool/initAudio", true);


  mrs_real pitch;
  while (pitchExtractor->getctrl("SoundFileSource/src/mrs_bool/hasData")->to<mrs_bool>())
  {
    if (plopt)
      playback->tick();

    pitchExtractor->process(win, pitchres);

    // pitch = samples2hertz((mrs_natural)pitchres(1), pitchExtractor->getctrl("AudioSource/src/mrs_real/osrate")->to<mrs_real>());
    pitch = samples2hertz((mrs_natural)pitchres(1), pitchExtractor->getctrl("SoundFileSource/src/mrs_real/osrate")->to<mrs_real>());

    cout << "conf" << "---" << pitchres(0) << endl;
//.........这里部分代码省略.........
开发者ID:sanyaade-teachings,项目名称:marsyas,代码行数:101,代码来源:pitchextract.cpp

示例6: recognize

void recognize(string sfName, string tpName)
{
  mrs_natural  i, j, k, l;
  mrs_natural nsamples, sfrq, obs, outsize;
  mrs_natural wsize = 0;

  mrs_natural maxsize, totalCount, inputsize;
  mrs_real msecondsPerFrame;
  MarSystemManager mng;
  MarSystem* netInp = mng.create("Series", "netInp");
  MarSystem* accInp = mng.create("Accumulator", "accInp");
  MarSystem* wavInp = mng.create("Series", "wavInp");
  MarSystem* wavaccInp = mng.create("Accumulator","wavaccInp");
  MarSystem* wavnetInp = mng.create("Series","wavnetInp");
  MarSystem* wavplOut = mng.create("Parallel","wavplOut");
  MarSystem* wavsrdOut = mng.create("Shredder","wavsrdOut");
  MarSystem* plTpl = mng.create("Parallel","plTpl");
  MarSystem* Inp = mng.create("Series","Inp");
  MarSystem* Tpl = mng.create("Series","Tpl");
  MarSystem* sim = mng.create("SimilarityMatrix", "sim");
  MarSystem* met = mng.create("Metric2", "met");
  MarSystem* dtw = mng.create("DTW", "dtw");
  MarSystem* ap = mng.create("AveragingPattern", "ap");
  Collection templates;
  ostringstream oss, oss2;
  string tmpStr;
  realvec sizes, b, countvector, segments;
  realvec beginPos, endPos, order;
  realvec dataInp, dataTpl, inpspec, allspec, tplspec;
  realvec featuresInp, featuresTpl;
  realvec simInput, simOutput, algOutput, tplOutput;
  mrs_bool b_begin;
  MarSystem* netTpl[MAX_TEMPLATES];
  MarSystem* accTpl[MAX_TEMPLATES];
  MarSystem* srsTpl[MAX_TEMPLATES];
  MarSystem* wavnetOut[MAX_TEMPLATES];

  templates.read(tpName);
  sizes.create(templates.size()+1);
  outsize = 0;

  /*** caluculate templates spectrogram ***/

  if(templates.size() > MAX_TEMPLATES) {
    cerr << "Error: invalied templates size!" << endl;
    exit(-1);
  }
  for(i=0; i< (mrs_natural)templates.size(); ++i) {
    oss.str(""); oss << "net" << i;
    tmpStr = oss.str();
    netTpl[i] = mng.create("Series", tmpStr);
    oss.str(""); oss << "srs" << i;
    srsTpl[i] = mng.create("Series", oss.str());
    oss.str(""); oss << "tplsrc" << i;
    netTpl[i]->addMarSystem(mng.create("SoundFileSource",oss.str()));
    oss2.str(""); oss2 << "SoundFileSource/" << oss.str() << "/mrs_string/filename";
    netTpl[i]->updControl(oss2.str(),templates.entry(i));
    oss2.str(""); oss2 << "SoundFileSource/" << oss.str() << "/mrs_natural/size";
    nsamples = netTpl[i]->getctrl(oss2.str())->to<mrs_natural>();
    oss.str(""); oss << "han" << i;
    netTpl[i]->addMarSystem(mng.create("Windowing",oss.str()));
    oss2.str(""); oss2 << "Windowing/" << oss.str() << "/mrs_natural/onSamples";
    wsize = netTpl[i]->getctrl(oss2.str())->to<mrs_natural>();
    sizes(i+1) = nsamples/wsize;
    oss.str(""); oss << "spc" << i;
    netTpl[i]->addMarSystem(mng.create("Spectrum",oss.str()));
    oss.str(""); oss << "psc" << i;
    netTpl[i]->addMarSystem(mng.create("PowerSpectrum",oss.str()));
    //oss.str(""); oss << "mfcc" << i;
    //netTpl[i]->addMarSystem(mng.create("MFCC",oss.str()));
    oss.str(""); oss << "acc" << i;
    accTpl[i] = mng.create("Accumulator",oss.str());
    accTpl[i]->addMarSystem(netTpl[i]);
    accTpl[i]->updControl("mrs_natural/nTimes",ACC_TEMPLATE);
    srsTpl[i]->addMarSystem(accTpl[i]);
    plTpl->addMarSystem(srsTpl[i]);
    outsize += sizes(i+1);
  }
  Tpl->addMarSystem(plTpl);
  Tpl->tick();
  dataTpl = Tpl->getctrl("mrs_realvec/processedData")->to<mrs_realvec>();
  maxsize = sizes.maxval();





  /*** calculate the feature vector of template ***/

  featuresTpl.create(BIN*(templates.size()+1),dataTpl.getCols());
  sfrq = netTpl[0]->getctrl("SoundFileSource/tplsrc0/mrs_real/osrate")->to<mrs_real>();
  obs = netTpl[0]->getctrl("mrs_natural/onObservations")->to<mrs_natural>();
  b.create(BIN+2);
  for(i=0; i<BIN+2; ++i) {
    b(i) = wsize*700/sfrq*(pow(10, (log10(1.0+sfrq/1400))*i/(BIN+1))-1);
  }
  for(j=0; j<BIN; j++) {
    for(l=0; l<(mrs_natural)templates.size(); l++) {
      for(k=0; k<obs; k++) {
        if(b(j) < k && k < b(j+1)) {
//.........这里部分代码省略.........
开发者ID:Amos-zq,项目名称:marsyas,代码行数:101,代码来源:rhythmMap.cpp

示例7: channel

int 
main(int argc, const char **argv)
{
	string name = argv[1];
	mrs_natural channel(atoi(argv[2]));
	mrs_natural window(atoi(argv[3]));
	mrs_real gain(atof(argv[4]));


	MarSystemManager mng;
	MarSystem* src = mng.create("SoundFileSource", "src");
	MarSystem* erb = mng.create("ERB","ERBfilterBank");
	MarSystem* dest = mng.create("AudioSink", "dest");
  



  
	src->updctrl("mrs_natural/inSamples", window);
	src->updctrl("mrs_string/filename", name);


	// This core dumps. Need to check it out. 
	erb->setctrl("mrs_natural/inObservations", src->getctrl("mrs_natural/onObservations"));
  
	cout << *src << endl;
  
	cout << src->getctrl("mrs_natural/onObservations") << endl;
	cout << src->getctrl("mrs_natural/onSamples") << endl;  
	erb->updctrl("mrs_natural/inObservations", 1);
  

	erb->updctrl("mrs_natural/inSamples", src->getctrl("mrs_natural/onSamples"));
	erb->updctrl("mrs_real/israte",src->getctrl("mrs_real/osrate"));
	erb->updctrl("mrs_natural/numChannels",64);
	erb->updctrl("mrs_real/lowFreq",100.0f);
  
	dest->updctrl("mrs_natural/inObservations", src->getctrl("mrs_natural/onObservations"));
	dest->updctrl("mrs_natural/inSamples", src->getctrl("mrs_natural/onSamples"));
	dest->updctrl("mrs_real/israte", src->getctrl("mrs_real/osrate"));
	dest->updctrl("mrs_natural/nChannels", 1);
	dest->updctrl("mrs_bool/initAudio", true);


  
	realvec src_in, dest_in;
	realvec src_out, erb_out, dest_out;
  
	src_in.create(src->getctrl("mrs_natural/inObservations")->to<mrs_natural>(), src->getctrl("mrs_natural/inSamples")->to<mrs_natural>());
	src_out.create(src->getctrl("mrs_natural/onObservations")->to<mrs_natural>(), src->getctrl("mrs_natural/onSamples")->to<mrs_natural>());
  
	erb_out.create(erb->getctrl("mrs_natural/onObservations")->to<mrs_natural>(), erb->getctrl("mrs_natural/onSamples")->to<mrs_natural>());
  
	dest_in.create(dest->getctrl("mrs_natural/inObservations")->to<mrs_natural>(), dest->getctrl("mrs_natural/inSamples")->to<mrs_natural>());
	dest_out.create(dest->getctrl("mrs_natural/onObservations")->to<mrs_natural>(), dest->getctrl("mrs_natural/onSamples")->to<mrs_natural>());
  
	while (src->getctrl("mrs_bool/hasData")->to<mrs_bool>()){
		src->process(src_in, src_out);
		erb->process(src_out, erb_out);
    
		for (mrs_natural i = 0; i < erb->getctrl("mrs_natural/onSamples")->to<mrs_natural>(); i++){
			dest_in(i) = gain*erb_out(channel,i);
		}
		dest->process(dest_in, dest_out);
	}
  
	return 0;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:68,代码来源:ERBTest.cpp


注:本文中的MarSystem::process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。