int
main(int argc, const char **argv)
{
  MRSDIAG("recvUDP.cpp - main");

  string progName = argv[0];  
  progName = progName.erase(0,3);

  initOptions();
  cmd_options.readOptions(argc, argv);
  loadOptions();
  
  
  vector<string> soundfiles = cmd_options.getRemaining();
  vector<string>::iterator sfi;

  

  if (helpopt) 
    printHelp(progName);
  
  if (usageopt)
    printUsage(progName);

  
  for (sfi = soundfiles.begin(); sfi != soundfiles.end(); ++sfi) 
    play(gain, *sfi);

  exit(1);
}
Example #2
0
int
main(int argc, const char **argv)
{
  MRSDIAG("carfac_testing.cpp - main");

  string progName = argv[0];
  if (argc == 1)
    printUsage(progName);

  // handling of command-line options
  initOptions();
  cmd_options.readOptions(argc, argv);
  loadOptions();

  vector<string> files = cmd_options.getRemaining();
  if (helpopt_)
    printHelp(progName);

  if (usageopt_)
    printUsage(progName);

  carfac_testing(files[0]);
  exit(0);

}
int
main(int argc, const char **argv)
{
	MRSDIAG("speakerSeg.cpp - main");

	string progName = argv[0];  
	if (argc == 1)
		printUsage(progName);

	// handling of command-line options 
	initOptions();
	cmd_options.readOptions(argc, argv);
	loadOptions();

	vector<string> soundfiles = cmd_options.getRemaining();
	if (helpopt) 
		printHelp(progName);

	if (usageopt)
		printUsage(progName);

	// play the soundfiles/collections 
	speakerSeg(soundfiles);

	exit(0);
}
Example #4
0
//****************************************************************************
ErrorCode MD5UtilCore::processDigest (const CommandLineOptions& options, std::string& output) {

	if (options.getHelpMode ()) {

		std::cout << MSG_DIGEST_HELP << std::endl;
		return ErrorCode::NONE;

	}

	if (options.getInputText ().length () == 0) {

		return ErrorCode::DIGEST_USAGE_ERROR;

	}

	output = hash (options.getInputText ());

	if (options.getOutputFilename ().length () != 0) {

		if (!saveToFile (options.getOutputFilename (), output)) {

			return ErrorCode::FILE_WRITE_ERROR;

		}

	}
	
	return ErrorCode::NONE;

}
Example #5
0
void
PingusMain::read_rc_file (void)
{
  if (!cmd_options.no_config_file.is_set() ||
      !cmd_options.no_config_file.get())
  {
    std::string filename = System::get_userdir() + "config";

    if (!System::exist(filename))
    {
      log_info(filename << ": config file not found");
    }
    else
    {
      try
      {
        CommandLineOptions options;
        options.merge(Options::from_file(Pathname(filename, Pathname::SYSTEM_PATH)));
        options.merge(cmd_options);
        cmd_options = options;
      }
      catch(const std::exception& err)
      {
        log_error(err.what());
      }
    }
  }
}
int
main(int argc, const char **argv)
{
	initOptions();
	cmd_options.readOptions(argc, argv);
	loadOptions();  

	vector<string> soundfiles = cmd_options.getRemaining();
	vector<string>::iterator sfi;

	cout << "vocalEffort Marsyas implementation" << endl;

	cout<<"LPC and LSP order: " <<lpcOrder <<endl;
	cout<<"hopSize: " <<hopSize <<endl;

	for (sfi=soundfiles.begin() ; sfi!=soundfiles.end() ; sfi++)
	{
		cout << "Sound to analyze: " << *sfi << endl;
		FileName Sfname(*sfi);
		outName = outputDirectory + "/" + Sfname.name();
		process(*sfi, outName);
	}

	cout << endl << "LPC and LSP processing finished!";
}
Example #7
0
void
loadOptions()
{
  helpopt = cmd_options.getBoolOption("help");
  usageopt = cmd_options.getBoolOption("usage");
  verboseopt  = cmd_options.getBoolOption("verbose");
  pluginName = cmd_options.getStringOption("classifier");
}
Example #8
0
void
loadOptions()
{
    helpopt = cmd_options.getBoolOption("help");
    usageopt = cmd_options.getBoolOption("usage");
    verboseopt = cmd_options.getBoolOption("verbose");
    toy_with = cmd_options.getStringOption("toy_with");
}
Example #9
0
void
initOptions()
{
  cmd_options.addBoolOption("help", "h", false);
  cmd_options.addBoolOption("usage", "u", false);
  cmd_options.addBoolOption("verbose", "v", false);
  cmd_options.addStringOption("classifier", "c", EMPTYSTRING);
}
Example #10
0
void
loadOptions()
{
  helpopt = cmd_options.getBoolOption("help");
  usageopt = cmd_options.getBoolOption("usage");
  gain = cmd_options.getRealOption("gain");
  port = cmd_options.getNaturalOption("port");
}
Example #11
0
void
initOptions()
{
  cmd_options.addBoolOption("help", "h", false);
  cmd_options.addBoolOption("usage", "u", false);
  cmd_options.addRealOption("gain", "g", 1.0);
  cmd_options.addNaturalOption("port", "p", 0);
}
Example #12
0
void
initOptions()
{
    cmd_options.addBoolOption("help", "h", false);
    cmd_options.addBoolOption("usage", "u", false);
    cmd_options.addBoolOption("verbose", "v", false);
    cmd_options.addStringOption("toy_with", "t", EMPTYSTRING);
}
Example #13
0
int
main(int argc, const char **argv)
{
  string progName = argv[0];
  if (argc == 1)
    printUsage(progName);

  // handling of command-line options
  initOptions();
  cmd_options.readOptions(argc, argv);
  loadOptions();

  vector<string> soundfiles = cmd_options.getRemaining();

  string fname0 = EMPTYSTRING;
  string fname1 = EMPTYSTRING;
  string fname2 = EMPTYSTRING;
  string fname3 = EMPTYSTRING;
  string fname4 = EMPTYSTRING;
  string fname5 = EMPTYSTRING;

  if (soundfiles.size() > 0)
    fname0 = soundfiles[0];
  if (soundfiles.size() > 1)
    fname1 = soundfiles[1];
  if (soundfiles.size() > 2)
    fname2 = soundfiles[2];
  if (soundfiles.size() > 3)
    fname3 = soundfiles[3];
  if (soundfiles.size() > 4)
    fname4 = soundfiles[4];
  if (soundfiles.size() > 5)
    fname5 = soundfiles[5];

  cout << "Marsyas toy_with name = " << toy_with << endl;
  cout << "fname0 = " << fname0 << endl;
  cout << "fname1 = " << fname1 << endl;


  if (toy_with == "null")
    toy_with_null(fname0);
  else if (toy_with == "harmonics")
    toy_with_harmonicStrength(fname0);
  else if (toy_with == "spectral_single")
    toy_with_spectral_single(fname0);
  else if (toy_with == "csv_input")
    toy_with_csv_input(fname0);
  else if (toy_with == "arff_in_out")
    toy_with_arff_in_out(fname0, fname1);
  else if (toy_with == "mel")
    toy_with_mel(fname0);
  else
  {
    cout << "Unsupported toy_with " << endl;
    printHelp(progName);
  }

}
void 
initOptions()
{
	cmd_options.addBoolOption("help", "h", false);
	cmd_options.addBoolOption("usage", "u", false);
	cmd_options.addBoolOption("verbose", "v", false);
	cmd_options.addStringOption("filename", "f", EMPTYSTRING);
	cmd_options.addStringOption("plugin", "p", EMPTYSTRING);
}
void 
initOptions()
{
  cmd_options.addBoolOption("help", "h", false);
  cmd_options.addBoolOption("usage", "u", false);
  cmd_options.addStringOption("filename", "f", EMPTYSTRING);
  cmd_options.addRealOption("gain", "g", 1.0);
  cmd_options.addNaturalOption("port", "p", 0);
}
Example #16
0
void 
loadOptions()
{
	helpopt = cmd_options.getBoolOption("help");
	usageopt = cmd_options.getBoolOption("usage");
	collectionName = cmd_options.getStringOption("collectionName");
	labelopt = cmd_options.getStringOption("label");
	marsyas_datadir_opt = cmd_options.getBoolOption("marsyasdatadir");
}
void 
loadOptions()
{
	helpopt = cmd_options.getBoolOption("help");
	usageopt = cmd_options.getBoolOption("usage");
	verboseopt = cmd_options.getBoolOption("verbose");
	pluginName = cmd_options.getStringOption("plugin");
	fileName   = cmd_options.getStringOption("filename");
}
void 
loadOptions()
{
  helpopt = cmd_options.getBoolOption("help");
  usageopt = cmd_options.getBoolOption("usage");
  gain = cmd_options.getRealOption("gain");
  fileName   = cmd_options.getStringOption("filename");
  port       = cmd_options.getNaturalOption("port");
}
Example #19
0
void 
initOptions()
{
	cmd_options.addBoolOption("help", "h", false);
	cmd_options.addBoolOption("usage", "u", false);
	cmd_options.addStringOption("label", "l", EMPTYSTRING);
	cmd_options.addStringOption("collectionName", "c", "music.mf");
	cmd_options.addBoolOption("marsyasdatadir", "md", false);
}
    int
main(int argc, const char **argv)
{
    MRSDIAG("record.cpp - main");

    string progName = argv[0];  
    if (argc == 1)
        printUsage(progName);


    // read command-line options
    initOptions();
    cmd_options.readOptions(argc, argv);
    loadOptions();


    if (helpopt) 
        printHelp(progName);

    if (usageopt)
        printUsage(progName);

    int i;
    i =0;

    vector<string> soundfiles = cmd_options.getRemaining();
    vector<string>::iterator sfi;


    /* 
       cout << "Recording to year" << yearopt << endl;
       string id1;
       string id2;
       string id3;
       string id4;
       id1 = soundfiles[0];
       id2 = soundfiles[1];
       id3 = soundfiles[2];
       id4 = soundfiles[3];

       xrecord_orcas(lengthopt, yearopt, id1, id2, id3, id4);
     */ 

    for (sfi = soundfiles.begin(); sfi != soundfiles.end(); ++sfi) 
    {	
        cout << "Recording " << lengthopt << " seconds to file " << *sfi << endl;
        record(lengthopt,gopt,  *sfi);
    }





    exit(0);
}
Example #21
0
int main( int argc, const char *argv[] )
{
    CommandLineOptions opt;
    opt.define<bool>("usage", 'u', "", "Print usage.");
    opt.define<bool>("help", 'h', "", "Print usage and options.");
    opt.define<bool>("realtime", 'r', "", "Use real-time thread priority.");
    opt.define<int>("count", 'N', "<number>", "Perform <number> amount of ticks.");
    opt.define<mrs_real>("samplerate", 's', "<number>", "Override sampling rate.");
    opt.define<mrs_natural>("block", 'b', "<samples>", "Block size in samples.");
    opt.define<mrs_string>("controls", 'c', "definitions",
                           "A series of control definitions of form \"name=value:name=value:...\"");
    opt.define<int>("OSC-receive", "<port>", "UDP port on which to receive OSC control messages.");
    opt.define<mrs_string>("OSC-send", "<subscriptions>",
                           "Subscriptions for OSC control change notifications, of form: "
                           "\"host:port:control,control,...;host...\".");

    if (!opt.readOptions(argc, argv))
      return 1;

    if (opt.value<bool>("usage"))
    {
      print_usage();
      return 0;
    }

    if (opt.value<bool>("help"))
    {
      print_help(opt);
      return 0;
    }

    const vector<string> & arguments = opt.getRemaining();
    if (arguments.size() < 1)
    {
        print_usage();
        return 0;
    }

    string system_filename = arguments[0];

    MarSystem *system = load_network(system_filename);
    if (!system) {
        cerr << "Could not load network definition file: "
             << system_filename << endl;
        return 1;
    }

    int error = apply_control_options(system, opt);
    if (error)
      return error;

    return run(system, opt);
}
Example #22
0
//****************************************************************************
bool MD5UtilCore::findCollision (const CommandLineOptions& options, std::string& output) {

	bool solutionFound = false;
	unsigned int threadCount = 1;
	std::thread* threads = nullptr;
	std::string* threadOutputs = nullptr;

	if (options.getThreadCount () > 1) {

		threadCount = options.getThreadCount ();

	}

	// Create threads.
	threads = new std::thread[threadCount];
	threadOutputs = new std::string[threadCount];
	for (unsigned int i = 0; i < threadCount; i++) {

		threads[i] = std::thread (&MD5UtilCore::checkCollisionRange, std::ref (options), std::ref (solutionFound), std::ref (threadOutputs[i]), i);

	}

	// Wait for threads.
	for (unsigned int j = 0; j < threadCount; j++) {

		threads[j].join ();

	}

	// Get solution.
	if (solutionFound) {

		for (unsigned int k = 0; k < threadCount; k++) {

			if (threadOutputs[k].length () != 0) {

				output = threadOutputs[k];
				break;

			}

		}

	}

	// Reclaim memory.
	delete[]threadOutputs;
	delete[] threads;

	return solutionFound;

}
Example #23
0
int
main(int argc, const char **argv)
{
  MRSDIAG("kea.cpp - main");

  cout << "Kea - Machine Learning in Marsyas ala Weka" << endl;

  string progName = argv[0];
  if (argc == 1)
    return printUsage(progName);

  // handling of command-line options
  initOptions();
  cmd_options_.readOptions(argc, argv);
  loadOptions();

  vector<string> soundfiles = cmd_options_.getRemaining();
  if (helpopt_)
    return printHelp(progName);

  if (usageopt_)
    return printUsage(progName);

  cout << "Mode = " << mode_ << endl;

  if (mode_ == "train_evaluate")
    train_evaluate();
  else if (mode_ == "distance_matrix_MIREX")
	  distance_matrix_MIREX();
  else if (mode_ == "distance_matrix")
	  distance_matrix();
  else if (mode_ == "pca")
	  pca();
  else if (mode_ == "tags")
	  tags();
  else if (mode_ == "train_predict")
	  train_predict("default");
  else if (mode_ == "train_predict_timeline")
	  train_predict("timeline");
  else if (mode_ == "predict")
	  predict("default");
  else if (mode_ == "predict_timeline")
	  predict("timeline");
  else if (mode_ == "train_classifier")
	  train_classifier();
  else 
	  cerr << "Unsupported mode: " << mode_ << endl;
  
  

  return 0;
}
int
main(int argc, const char **argv)
{
	MRSDIAG("sfplay.cpp - main");

	string progName = argv[0];  
	progName = progName.erase(0,3);

	initOptions();
	cmd_options.readOptions(argc, argv);
	loadOptions();

	vector<string> soundfiles = cmd_options.getRemaining();
	vector<string>::iterator sfi;

	if (argc == 1)
		printUsage(progName);

	if (helpopt) 
		printHelp(progName);

	if (usageopt)
		printUsage(progName);

	int i = 0;
	Collection l;
	string sfName;

	for (sfi = soundfiles.begin(); sfi != soundfiles.end(); ++sfi) 
	{
		sfName = *sfi;
		i++;
	}

	string extractorStr = extractorName;
	TimeLine tline;

	if (tlineName == EMPTYSTRING)
	{
		tline.load(tlineName);
		cout << tline;
	}

	if (extractorStr.substr(0,2) == "SV") 
	{
		textract_trainAccumulator(sfName, offset, duration, start, length, gain,i, pluginName, wekafname, memSize, extractorName.substr(2, extractorName.length()), tline);
	}

	exit(0);
}
void
initOptions()
{
    cmd_options.addBoolOption("help", "h", false);
    cmd_options.addBoolOption("usage", "u", false);
    cmd_options.addBoolOption("verbose", "v", false);
    cmd_options.addRealOption("start", "sa", 0.0f);
    cmd_options.addStringOption("output", "o", EMPTYSTRING);
    cmd_options.addRealOption("length", "ln", -1.0f);
    cmd_options.addRealOption("gain", "g", 1.0);
    cmd_options.addStringOption("plugin", "pl", EMPTYSTRING);
    cmd_options.addRealOption("repetitions", "rp", 1.0);
    cmd_options.addNaturalOption("windowsize", "ws", 2048);
}
int main(int argc, const char **argv)
{

    initOptions();
    cmd_options.readOptions(argc, argv);
    loadOptions();

    // default options
    if (mappingopt == EMPTYSTRING)
        mappingopt = "BoomChick";

    if (deviceopt == EMPTYSTRING)
        deviceopt = "Keyboard";


    if (verbose_opt) 
        newMidiInfo();
    else if (mappingopt == "BoomChick")
        midiBoomChickAnnotate(bufferSizeopt, inputSizeopt,backgroundopt);
    else if (mappingopt == "TempoBrowse")
    {
        tempo_test("mp3libtempo.txt", 100, 0);
        // midiBrowse();
    }
    else if (mappingopt == "KarplusStrong")
    {
        PluckLive(deviceopt, 0,100,1.0,0.5);
    }


    else 
        cout << "Unrecognized mapping: " << mappingopt << endl;


}
Example #27
0
int
main(int argc, const char **argv)
{
  MRSDIAG("sendUDP.cpp - main");

  string progName = argv[0];


  if (argc == 1)
    printUsage(progName);

  initOptions();
  cmd_options.readOptions(argc, argv);
  loadOptions();

  vector<string> soundfiles = cmd_options.getRemaining();
  vector<string>::iterator sfi;



  if (helpopt)
    printHelp(progName);

  if (usageopt)
    printUsage(progName);

  int i;


  i = 0;
  Collection l;

  for (sfi = soundfiles.begin(); sfi != soundfiles.end(); ++sfi)
  {
    string fname = *sfi;
    string ext = fname.substr(fname.rfind(".", fname.length()), fname.length());
    if (ext == ".mf")
      readCollection(l,fname);
    else
      l.add(fname);
    i++;
  }

  // check for hostname and port...
  sfplay(l, offset, duration, start, length, gain, repetitions );
  exit(1);
}
void 
initOptions()
{
    cmd_options.addBoolOption("help", "h", false);
    cmd_options.addBoolOption("usage", "u", false);
    cmd_options.addBoolOption("verbose", "v", false);
    cmd_options.addNaturalOption("outputSize", "o", 128);
    cmd_options.addNaturalOption("inputSize", "i", 64);
    cmd_options.addStringOption("background", "b", EMPTYSTRING);
    cmd_options.addStringOption("mapping", "m", EMPTYSTRING);
    cmd_options.addStringOption("device", "d", EMPTYSTRING);
    cmd_options.addNaturalOption("port", "p", 0); 
}
void 
loadOptions()
{
    helpopt = cmd_options.getBoolOption("help");
    usageopt = cmd_options.getBoolOption("usage");
    bufferSizeopt = cmd_options.getNaturalOption("outputSize");
    inputSizeopt = cmd_options.getNaturalOption("inputSize");
    backgroundopt = cmd_options.getStringOption("background");
    verbose_opt = cmd_options.getBoolOption("verbose");
    mappingopt = cmd_options.getStringOption("mapping");
    deviceopt = cmd_options.getStringOption("device");
    portopt = cmd_options.getNaturalOption("port"); 
}
Example #30
0
void
initOptions()
{
  cmd_options.addBoolOption("help", "h", false);
  cmd_options.addBoolOption("usage", "u", false);
  cmd_options.addBoolOption("verbose", "v", false);
  cmd_options.addRealOption("start", "s", 0.0f);
  cmd_options.addRealOption("length", "l", 1000.0f);
  cmd_options.addRealOption("gain", "g", 1.0);
  cmd_options.addNaturalOption("port", "p", 0);
  cmd_options.addStringOption("host", "h", EMPTYSTRING);
  cmd_options.addRealOption("repetitions", "r", 1.0);
}