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


C++ MarSystem类代码示例

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


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

示例1: basic_shifter

void
basic_shifter(string infile, string outfile)
{
	MarSystem* pnet = mng.create("Series", "pnet");
	addSource( pnet, infile );
	pnet->addMarSystem(mng.create("Shifter", "shift"));
	pnet->updctrl("Shifter/shift/mrs_natural/shift", 16);
	addDest( pnet, outfile);

	while (pnet->getctrl("mrs_bool/hasData")->to<mrs_bool>())
	{
		pnet->tick();
	}
	delete pnet;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:15,代码来源:basicChecks.cpp

示例2: basic_vibrato

// TODO: move
void
basic_vibrato(string infile, string outfile)
{
	MarSystem* pnet = mng.create("Series", "pnet");
	addSource( pnet, infile );
	pnet->addMarSystem(mng.create("Vibrato", "vib"));
	addDest( pnet, outfile);

	pnet->updctrl("Vibrato/vib/mrs_real/mod_freq", 10.0);
	while (pnet->getctrl("mrs_bool/hasData")->to<mrs_bool>())
	{
		pnet->tick();
	}
	delete pnet;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:16,代码来源:basicChecks.cpp

示例3:

MslModel::~MslModel() {
  map<string, MarSystem *>::const_iterator iter;
  for (iter=workingSet.begin(); iter != workingSet.end(); ++iter) {

    // we actually should only have to delete the most top
    // level composite marsystem as they take care of
    // deleting their internal marsystems...  here we assume
    // that there is only one type Series and its the top level.
    MarSystem* tmp = (MarSystem*)iter->second;
    string type = tmp->getType();
    if (type.compare("Series") == 0) {
      delete iter->second;
    }
  }
}
开发者ID:Amos-zq,项目名称:marsyas,代码行数:15,代码来源:MslModel.cpp

示例4: basic_windowing

void
basic_windowing(string infile, string outfile)
{
	MarSystem* pnet = mng.create("Series", "pnet");
	addSource( pnet, infile );
	pnet->addMarSystem(mng.create("Windowing", "win"));
	pnet->updctrl("Windowing/win/mrs_string/type", "Hanning");
	addDest( pnet, outfile);

	while (pnet->getctrl("mrs_bool/hasData")->to<mrs_bool>())
	{
		pnet->tick();
	}
	delete pnet;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:15,代码来源:basicChecks.cpp

示例5: main

int
main(int argc, const char **argv)
{	
    (void) argc;  // tells the compiler that we know that we're not
    (void) argv;  // using these two variables
	MRSDIAG("helloWorld.cpp - main");

	// cout << "This is probably the simplest Marsyas example code: it simply
	// generates a sine wave with a frequency of 440Hz and send it to the audio
	// card output. Simple press CTRL+C to quit." << endl;
	
	//we usualy start by creating a MarSystem manager 
	//to help us on MarSystem creation
	MarSystemManager mng;

	//create the network, which is a simple Series network with a sine wave
	//oscilator and a audio sink object to send the ausio data for playing 
	//in the sound card
	MarSystem *network = mng.create("Series", "network");
	network->addMarSystem(mng.create("SineSource", "src"));
	network->addMarSystem(mng.create("AudioSink", "dest"));
	network->addMarSystem(mng.create("SoundFileSink", "dest2"));

	//set the window (i.e. audio frame) size (in samples). Let's say, 256 samples.
	//This is done in the outmost MarSystem (i.e. the Series/network) because flow
	//controls (as is the case of inSamples) are propagated through the network.
	//Check the Marsyas documentation for mode details.
	network->updControl("mrs_natural/inSamples", 4096);
 

	//set oscilator frequency to 440Hz
	network->updControl("SineSource/src/mrs_real/frequency", 440.0);

	// set the sampling to 44100  - a safe choice in most configurations 
	network->updControl("mrs_real/israte", 44100.0);
	network->updControl("AudioSink/dest/mrs_bool/initAudio", true);
	network->updControl("SoundFileSink/dest2/mrs_string/filename", "helloworld.wav");
	

	//now it's time for ticking the network, 
	//ad aeternum (i.e. until the user quits by CTRL+C)
	while (1) 
	{
		network->tick();
	}

	//ok, this is not really necessary because we are quiting by CTRL+C, 
	//but it's a good habit anyway ;-)
	delete network;

	return(0);
}
开发者ID:abramhindle,项目名称:marsyas-fork,代码行数:52,代码来源:helloWorld.cpp

示例6: addFileSource

void
TranscriberExtract::getAllFromAudio(const std::string audioFilename, realvec&
                                    pitchList, realvec& ampList,
                                    realvec& boundaries)
{
	MarSystem* pitchSink = mng.create("RealvecSink", "pitchSink");
	MarSystem* ampSink = mng.create("RealvecSink", "ampSink");

	MarSystem* pnet = mng.create("Series", "pnet");
	mrs_real srate = addFileSource(pnet, audioFilename);
// TODO: double the number of observations?
//	pnet->updControl("SoundFileSource/src/mrs_natural/inSamples",256);
//	pnet->addMarSystem(mng.create("ShiftInput", "shift"));
//	pnet->updControl("ShiftInput/shift/mrs_natural/winSize",512);

	MarSystem* fanout = mng.create("Fanout", "fanout");
	fanout->addMarSystem(makePitchNet(srate, 100.0, pitchSink));
	fanout->addMarSystem(makeAmplitudeNet(ampSink));
	pnet->addMarSystem(fanout);

	while ( pnet->getctrl("mrs_bool/hasData")->to<mrs_bool>() )
		pnet->tick();

	pitchList = getPitchesFromRealvecSink(pitchSink, srate);
	ampList = getAmpsFromRealvecSink(ampSink);
	boundaries.create(2);
	boundaries(0) = 0;
	boundaries(1) = pitchList.getSize();
	delete pnet;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:30,代码来源:TranscriberExtract.cpp

示例7: Series

void
WHaSp::createSimMatrixNet()
{
  if(HWPSnet_)
    return;

  HWPSnet_ = new Series("HWPSnet");

  //add a feat selector and
  //set the features needed for HWPS
  MarSystem* peFeatSelect = new PeakFeatureSelect("peFeatSelect");
  peFeatSelect->updControl("mrs_natural/selectedFeatures",
                           PeakFeatureSelect::pkFrequency | PeakFeatureSelect::pkSetFrequencies| PeakFeatureSelect::pkSetAmplitudes);
  HWPSnet_->addMarSystem(peFeatSelect);

  //create a similarityMatrix MarSystem that uses the HPWS metric
  SelfSimilarityMatrix* simMat = new SelfSimilarityMatrix("simMat");
  simMat->addMarSystem(new HWPS("hwps"));

  HWPSnet_->addMarSystem(simMat);

  //link totalNumPeaks control to PeakFeatureSelect
  HWPSnet_->getctrl("PeakFeatureSelect/peFeatSelect/mrs_natural/totalNumPeaks")->linkTo(ctrl_totalNumPeaks_, NOUPDATE);
  HWPSnet_->update(); //only call update to HWPSnet_ since this is being called from WHaSp::update()! -> avoid potential infinite recursion!

  //link frameMaxNumPeaks control to PeakFeatureSelect
  HWPSnet_->getctrl("PeakFeatureSelect/peFeatSelect/mrs_natural/frameMaxNumPeaks")->linkTo(ctrl_frameMaxNumPeaks_, NOUPDATE);
  HWPSnet_->update(); //only call update to HWPSnet_ since this is being called from WHaSp::update()! -> avoid potential infinite recursion!

  //link histSize control to HWPS metric
  HWPSnet_->getctrl("SelfSimilarityMatrix/simMat/HWPS/hwps/mrs_natural/histSize")->linkTo(ctrl_histSize_, NOUPDATE);
  HWPSnet_->update(); //only call update to HWPSnet_ since this is being called from WHaSp::update()! -> avoid potential infinite recursion!

  HWPSnet_->setctrl("SelfSimilarityMatrix/simMat/HWPS/hwps/mrs_natural/histSize", 20);
  HWPSnet_->update(); //only call update to HWPSnet_ since this is being called from WHaSp::update()! -> avoid potential infinite recursion!

  HWPSnet_->updControl("SelfSimilarityMatrix/simMat/HWPS/hwps/mrs_bool/calcDistance", true);

  //HWPSnet_->setctrl("SelfSimilarityMatrix/simMat/HWPS/hwps/mrs_natural/histSize", 100);
  HWPSnet_->update(); //only call update to HWPSnet_ since this is being called from WHaSp::update()! -> avoid potential infinite recursion!

}
开发者ID:sanyaade-teachings,项目名称:marsyas,代码行数:42,代码来源:WHaSp.cpp

示例8:

mrs_natural
BeatAgent::getChildIndex()
{
	//check for parent:
	MarSystem* parent = this->getParent();
	myIndex_ = -1;
	if(parent)
	{
		vector<MarSystem*> siblings = parent->getChildren();
		for(mrs_natural i = 0; i < (mrs_natural)siblings.size(); i++)
		{
			if(this == siblings[i])
			{
				myIndex_ = i;
				break;
			}
		}
	}
	return myIndex_;
}
开发者ID:githubnemo,项目名称:marsyas,代码行数:20,代码来源:BeatAgent.cpp

示例9: Plugin

MarsyasBExtractRolloff::MarsyasBExtractRolloff(float inputSampleRate) :
  Plugin(inputSampleRate),
  m_stepSize(0),
  m_previousSample(0.f),
  m_network(0)
{
  MarSystemManager mng;
  // Overall extraction and classification network
  m_network = mng.create("Series", "mainNetwork");

  // Build the overall feature calculation network
  MarSystem *featureNetwork = mng.create("Series", "featureNetwork");

  // Add a realvec as the source
  featureNetwork->addMarSystem(mng.create("RealvecSource", "src"));

  // Convert the data to mono
  featureNetwork->addMarSystem(mng.create("Stereo2Mono", "m2s"));

  // Setup the feature extractor
  MarSystem* featExtractor = mng.create("TimbreFeatures", "featExtractor");
  featExtractor->updctrl("mrs_string/enableSPChild", "Rolloff/rlf");
  featureNetwork->addMarSystem(featExtractor);

  // Add the featureNetwork to the main network
  m_network->addMarSystem(featureNetwork);
}
开发者ID:Amos-zq,项目名称:marsyas,代码行数:27,代码来源:MarsyasBExtractRolloff.cpp

示例10: getNormalizingGain

realvec
TranscriberExtract::getAmpsFromAudio(const std::string audioFilename)
{
	mrs_real normalize = getNormalizingGain(audioFilename);

	MarSystem* pnet = mng.create("Series", "pnet");
	mrs_real srate;
	srate  = addFileSource(pnet, audioFilename);
	
	pnet->addMarSystem(mng.create("Gain", "normalizing"));
	pnet->updControl("Gain/normalizing/mrs_real/gain",normalize);
	MarSystem* rvSink = mng.create("RealvecSink", "rvSink");
	pnet->addMarSystem(makeAmplitudeNet(rvSink));

	while ( pnet->getctrl("mrs_bool/hasData")->to<mrs_bool>() )
		pnet->tick();

	realvec rmsList = getAmpsFromRealvecSink(rvSink);
	delete pnet;

	// normalize RMS
	rmsList -= rmsList.minval();
	mrs_real maxRms = rmsList.maxval();
	if (maxRms != 0)
		rmsList /= maxRms;
	return rmsList;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:27,代码来源:TranscriberExtract.cpp

示例11: run

int run( const string system_filename, const CommandLineOptions & opt )
{
    int ticks = 0;
    if (opt.has("count"))
    {
      ticks = opt.value<int>("count");
      if (ticks < 1)
      {
        cerr << "Invalid value for option 'count' (must be > 0)." << endl;
        return 1;
      }
    }

    ifstream system_istream(system_filename);
    MarSystemManager mng;
    MarSystem* system = mng.getMarSystem(system_istream);
    if (!system) {
        cerr << "Could not load filesystem file:" << system;
        return 1;
    }

    bool realtime = opt.value<bool>("realtime");
    mrs_real sr = opt.value<mrs_real>("samplerate");
    mrs_natural block = opt.value<mrs_natural>("block");

    if (sr > 0)
      system->setControl("mrs_real/israte", sr);
    if (block > 0)
      system->setControl("mrs_natural/inSamples", block);
    system->update();

    RealTime::Runner runner(system);
    runner.setRtPriorityEnabled(realtime);

    runner.start((unsigned int)ticks);
    runner.wait();

    return 0;
}
开发者ID:BitMax,项目名称:marsyas,代码行数:39,代码来源:runner-app.cpp

示例12: makeAmplitudeNet

MarSystem* TranscriberExtract::makeAmplitudeNet(MarSystem* rvSink)
{
	MarSystem *net = mng.create("Series", "amplitudeNet");
	net->addMarSystem(mng.create("ShiftInput", "sfiAmp"));
	net->addMarSystem(mng.create("Rms", "rms"));
	if (rvSink != NULL)
		net->addMarSystem(rvSink);

	net->updControl("mrs_natural/inSamples", 512);
	net->updControl("ShiftInput/sfiAmp/mrs_natural/winSize", 512);

	return net;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:13,代码来源:TranscriberExtract.cpp

示例13: basic_delay

void
basic_delay(string infile, string outfile)
{
	MarSystem* pnet = mng.create("Series", "pnet");
	addSource( pnet, infile );
	pnet->addMarSystem(mng.create("Delay", "delay"));
	pnet->updctrl("Delay/delay/mrs_natural/delaySamples", 16);
	pnet->updctrl("Delay/delay/mrs_real/feedback", (mrs_real) 0.5);
	addDest( pnet, outfile);

	while (pnet->getctrl("mrs_bool/hasData")->to<mrs_bool>())
	{
		pnet->tick();
	}
	delete pnet;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:16,代码来源:basicChecks.cpp

示例14: tempotest_sfplay

// take advantage of MarSystemManager 
void 
tempotest_sfplay(string sfName)
{
    cout << "Playing " << sfName << endl; 

    MarSystemManager mng;

    // Create a series Composite 
    MarSystem* series = mng.create("Series", "series");
    series->addMarSystem(mng.create("SoundFileSource", "src"));
    series->addMarSystem(mng.create("AudioSink", "dest"));

    // only update controls from Composite level 
    series->updctrl("mrs_natural/inSamples", 128);
    series->updctrl("SoundFileSource/src/mrs_string/filename", sfName);

    while (series->getctrl("SoundFileSource/src/mrs_bool/hasData")->to<mrs_bool>())
        series->tick();

    delete series;
}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:22,代码来源:midiTest.cpp

示例15: toy_with_csv_input

void
toy_with_csv_input(mrs_string sfname)
{
    MarSystemManager mng;

    MarSystem *net = mng.create("Series", "net");
    net->addMarSystem(mng.create("CsvFileSource", "src"));

    net->updControl("CsvFileSource/src/mrs_string/filename", sfname);
    net->updControl("mrs_natural/inSamples", 1);

    while ( net->getctrl("CsvFileSource/src/mrs_bool/hasData")->to<mrs_bool>() )
    {
        net->tick();
        mrs_realvec v = net->getctrl("mrs_realvec/processedData")->to<mrs_realvec>();
        for (mrs_natural i = 0; i<v.getSize(); ++i)
        {
            printf("%.5g\t", v(i));
        }
        cout<<endl;
    }
    delete net;
}
开发者ID:murraymeehan,项目名称:marsyas,代码行数:23,代码来源:wreckBeach.cpp


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