Mercurial > hg > sonic-annotator
comparison runner/main.cpp @ 240:7c4f7cd065a0
Various tweaks to help text
author | Chris Cannam |
---|---|
date | Tue, 01 Mar 2016 16:02:53 +0000 |
parents | 9a10c3ffff47 |
children | 4307b34f86c0 |
comparison
equal
deleted
inserted
replaced
238:0c87c4fca256 | 240:7c4f7cd065a0 |
---|---|
135 ++i; | 135 ++i; |
136 } | 136 } |
137 return ws; | 137 return ws; |
138 } | 138 } |
139 | 139 |
140 static QString wrapCol(QString s) { | |
141 return wrap(s, 56, 22); | |
142 } | |
143 | |
140 static bool | 144 static bool |
141 isVersionNewerThan(QString a, QString b) // from VersionTester in svapp | 145 isVersionNewerThan(QString a, QString b) // from VersionTester in svapp |
142 { | 146 { |
143 QRegExp re("[._-]"); | 147 QRegExp re("[._-]"); |
144 QStringList alist = a.split(re, QString::SkipEmptyParts); | 148 QStringList alist = a.split(re, QString::SkipEmptyParts); |
184 void printUsage(QString myname) | 188 void printUsage(QString myname) |
185 { | 189 { |
186 cerr << endl; | 190 cerr << endl; |
187 cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; | 191 cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; |
188 cerr << "A utility for batch feature extraction from audio files." << endl; | 192 cerr << "A utility for batch feature extraction from audio files." << endl; |
189 cerr << "Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London." << endl; | 193 cerr << "Mark Levy, Chris Sutton, and Chris Cannam, Queen Mary, University of London." << endl; |
190 cerr << "Copyright 2007-2015 Queen Mary, University of London." << endl; | 194 cerr << "Copyright 2007-2015 Queen Mary, University of London." << endl; |
191 cerr << endl; | 195 cerr << endl; |
192 cerr << "This program is free software. You may redistribute copies of it under the" << endl; | 196 cerr << "This program is free software. You may redistribute copies of it under the" << endl; |
193 cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl; | 197 cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl; |
194 cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl; | 198 cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl; |
197 cerr << " " << myname | 201 cerr << " " << myname |
198 << " [-mrnf] -t transform.ttl [..] -w <writer> [..] <audio> [..]" << endl; | 202 << " [-mrnf] -t transform.ttl [..] -w <writer> [..] <audio> [..]" << endl; |
199 cerr << " " << myname | 203 cerr << " " << myname |
200 << " [-mrnf] -T translist.txt [..] -w <writer> [..] <audio> [..]" << endl; | 204 << " [-mrnf] -T translist.txt [..] -w <writer> [..] <audio> [..]" << endl; |
201 cerr << " " << myname | 205 cerr << " " << myname |
202 << " [-mrnf] -d <plugin> [..] -w <writer> [..] <audio> [...]" << endl; | 206 << " [-mrnf] -d <id> [..] -w <writer> [..] <audio> [...]" << endl; |
203 cerr << " " << myname | 207 cerr << " " << myname |
204 << " -s <transform>" << endl; | 208 << " -s <transform>" << endl; |
205 cerr << " " << myname | 209 cerr << " " << myname |
206 << " [-lhv]" << endl; | 210 << " [-lhv]" << endl; |
207 cerr << endl; | 211 cerr << endl; |
208 cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; | 212 cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; |
209 cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL;" << endl; | 213 cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL;" << endl; |
210 cerr << "and <plugin> is a plugin output identified as vamp:libname:plugin:output." << endl; | 214 cerr << "and <id> is a transform id of the form vamp:libname:plugin:output." << endl; |
211 cerr << endl; | 215 cerr << endl; |
212 } | 216 } |
213 | 217 |
214 void printOptionHelp(std::string writer, FeatureWriter::Parameter &p) | 218 void printOptionHelp(std::string writer, FeatureWriter::Parameter &p) |
215 { | 219 { |
216 cerr << " --" << writer << "-" << p.name << " "; | 220 cerr << " --" << writer << "-" << p.name << " "; |
217 int spaceage = 16 - int(writer.length()) - int(p.name.length()); | 221 int spaceage = 16 - int(writer.length()) - int(p.name.length()); |
218 if (p.hasArg) { cerr << "<X> "; spaceage -= 4; } | 222 if (p.hasArg) { cerr << "<X> "; spaceage -= 4; } |
219 for (int k = 0; k < spaceage; ++k) cerr << " "; | 223 for (int k = 0; k < spaceage; ++k) cerr << " "; |
220 QString s(p.description.c_str()); | 224 QString s(p.description.c_str()); |
221 s = wrap(s, 56, 22); | 225 s = wrapCol(s); |
222 cerr << s << endl; | 226 cerr << s << endl; |
223 } | 227 } |
224 | 228 |
225 void printHelp(QString myname, QString w) | 229 void printHelp(QString myname, QString w) |
226 { | 230 { |
259 i != writers.end(); ) { | 263 i != writers.end(); ) { |
260 writerText += i->c_str(); | 264 writerText += i->c_str(); |
261 if (++i != writers.end()) writerText += ", "; | 265 if (++i != writers.end()) writerText += ", "; |
262 else writerText += "."; | 266 else writerText += "."; |
263 } | 267 } |
264 writerText = wrap(writerText, 56, 22); | 268 writerText = wrapCol(writerText); |
265 | 269 |
266 if (writer == "" || writers.find(writer) == writers.end()) { | 270 if (writer == "" || writers.find(writer) == writers.end()) { |
267 | 271 |
268 cerr << "Transformation options:" << endl; | 272 cerr << "Transformation options:" << endl; |
269 cerr << endl; | 273 cerr << endl; |
270 cerr << " -t, --transform <T> Apply transform described in transform file <T> to" << endl; | 274 cerr << " -t, --transform <T> " |
271 cerr << " all input audio files. You may supply this option" << endl; | 275 << wrapCol("Apply transform described in transform file <T> to" |
272 cerr << " multiple times. You must supply this option or -T at" << endl; | 276 " all input audio files. You may supply this option" |
273 cerr << " least once for any work to be done. Transform format" << endl; | 277 " multiple times. You must supply this option, -T, or -d" |
274 cerr << " may be SV transform XML or Vamp transform RDF/Turtle." << endl; | 278 " at least once for any work to be done. Transform format" |
275 cerr << " See accompanying documentation for transform examples." << endl; | 279 " may be SV transform XML or Vamp transform RDF/Turtle." |
276 cerr << endl; | 280 " A skeleton transform file for" |
277 cerr << " -T, --transforms <T> Apply all transforms described in transform files" << endl; | 281 " a given transform id can be generated using the" |
278 cerr << " whose names are listed in text file <T>. You may supply" << endl; | 282 " -s option (see below). See accompanying" |
279 cerr << " this option multiple times." << endl; | 283 " documentation for transform examples.") |
280 cerr << endl; | 284 << endl << endl; |
281 cerr << " -d, --default <I> Apply the default transform for transform id <I>. This" << endl; | 285 cerr << " -T, --transforms <T> " |
282 cerr << " is equivalent to generating a skeleton transform for this" << endl; | 286 << wrapCol("Apply all transforms described in transform files" |
283 cerr << " id (using the -s option, below) and then applying that," << endl; | 287 " whose names are listed in text file <T>. You may supply" |
284 cerr << " unmodified, with the -t option in the normal way. Note" << endl; | 288 " this option multiple times.") |
285 cerr << " that results may vary, as the implementation's default" << endl; | 289 << endl << endl; |
286 cerr << " processing parameters are not guaranteed. Do not use" << endl; | 290 cerr << " -d, --default <I> " |
287 cerr << " this in production systems. You may supply this option" << endl; | 291 << wrapCol("Apply the default transform for transform id <I>. This" |
288 cerr << " multiple times, and mix it with -t and -T." << endl; | 292 " is equivalent to generating a skeleton transform for the" |
289 cerr << endl; | 293 " id (using the -s option, below) and then applying that," |
290 cerr << " -w, --writer <W> Write output using writer type <W>." << endl; | 294 " unmodified, with the -t option in the normal way. Note" |
291 cerr << " " << writerText << endl; | 295 " that results may vary, as default" |
292 cerr << " You may supply this option multiple times. You must" << endl; | 296 " processing parameters may change between releases of " |
293 cerr << " supply this option at least once for any work to be done." << endl; | 297 + myname + " as well as of individual plugins. Do not use" |
294 cerr << endl; | 298 " this in production systems. You may supply this option" |
295 cerr << " -S, --summary <S> In addition to the result features, write summary feature" << endl; | 299 " multiple times, and mix it with -t and -T.") |
296 cerr << " of summary type <S>." << endl; | 300 << endl << endl; |
297 cerr << " Supported summary types are min, max, mean, median, mode," << endl; | 301 cerr << " -w, --writer <W> Write output using writer type <W>.\n" |
298 cerr << " sum, variance, sd, count." << endl; | 302 << " " << writerText << endl |
299 cerr << " You may supply this option multiple times." << endl; | 303 << " " |
300 cerr << endl; | 304 << wrapCol("You may supply this option multiple times. You must" |
301 cerr << " --summary-only Write only summary features; do not write the regular" << endl; | 305 " supply this option at least once for any work to be done.") |
302 cerr << " result features." << endl; | 306 << endl << endl; |
303 cerr << endl; | 307 cerr << " -S, --summary <S> " |
304 cerr << " --segments <A>,<B>[,...]" << endl; | 308 << wrapCol("In addition to the result features, write summary feature" |
305 cerr << " Summarise in segments, with segment boundaries" << endl; | 309 " of summary type <S>.") << endl |
306 cerr << " at A, B, ... seconds." << endl; | 310 << " " |
307 cerr << endl; | 311 << wrapCol("Supported summary types are min, max, mean, median, mode," |
308 cerr << " --segments-from <F>" << endl; | 312 " sum, variance, sd, count.") << endl |
309 cerr << " Summarise in segments, with segment boundaries" << endl; | 313 << " You may supply this option multiple times." |
310 cerr << " at times read from the text file <F>. (one time per" << endl; | 314 << endl << endl; |
311 cerr << " line, in seconds)." << endl; | 315 cerr << " --summary-only " |
312 cerr << endl; | 316 << wrapCol("Write only summary features; do not write the regular" |
313 cerr << " -m, --multiplex If multiple input audio files are given, use mono" << endl; | 317 " result features.") |
314 cerr << " mixdowns of all files as the input channels for a single" << endl; | 318 << endl << endl; |
315 cerr << " invocation of each transform, instead of running the" << endl; | 319 cerr << " --segments <A>,<B>[,...]\n " |
316 cerr << " transform against all files separately. The first file" << endl; | 320 << wrapCol("Summarise in segments, with segment boundaries" |
317 cerr << " will be used for output reference name and sample rate." << endl; | 321 " at A, B, ... seconds.") |
318 cerr << endl; | 322 << endl << endl; |
319 cerr << " -r, --recursive If any of the <audio> arguments is found to be a local" << endl; | 323 cerr << " --segments-from <F>\n " |
320 cerr << " directory, search the tree starting at that directory" << endl; | 324 << wrapCol("Summarise in segments, with segment boundaries" |
321 cerr << " for all supported audio files and take all of those as" << endl; | 325 " at times read from the text file <F>. (one time per" |
322 cerr << " input instead." << endl; | 326 " line, in seconds).") |
323 cerr << endl; | 327 << endl << endl; |
324 cerr << " -n, --normalise Normalise input audio files to signal absolute max = 1.f." << endl; | 328 cerr << " -m, --multiplex " |
325 cerr << endl; | 329 << wrapCol("If multiple input audio files are given, use mono" |
326 cerr << " -f, --force Continue with subsequent files following an error." << endl; | 330 " mixdowns of the files as the input channels for a single" |
327 cerr << endl; | 331 " invocation of each transform, instead of running the" |
328 cerr << "Housekeeping options:" << endl; | 332 " transform against all files separately. The first file" |
329 cerr << endl; | 333 " will be used for output reference name and sample rate.") |
334 << endl << endl; | |
335 cerr << " -r, --recursive " | |
336 << wrapCol("If any of the <audio> arguments is found to be a local" | |
337 " directory, search the tree starting at that directory" | |
338 " for all supported audio files and take all of those as" | |
339 " input in place of it.") | |
340 << endl << endl; | |
341 cerr << " -n, --normalise " | |
342 << wrapCol("Normalise each input audio file to signal abs max = 1.f.") | |
343 << endl << endl; | |
344 cerr << " -f, --force " | |
345 << wrapCol("Continue with subsequent files following an error.") | |
346 << endl << endl; | |
347 cerr << "Housekeeping options:" | |
348 << endl << endl; | |
330 cerr << " -l, --list List available transform ids to standard output." << endl; | 349 cerr << " -l, --list List available transform ids to standard output." << endl; |
331 cerr << " --list-writers List supported writer types to standard output." << endl; | 350 cerr << " --list-writers List supported writer types to standard output." << endl; |
332 cerr << " --list-formats List supported input audio formats to standard output." << endl; | 351 cerr << " --list-formats List supported input audio formats to standard output." << endl; |
333 cerr << endl; | 352 cerr << endl; |
334 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl; | 353 cerr << " -s, --skeleton <I> " |
335 cerr << " and write it to standard output." << endl; | 354 << wrapCol("Generate a skeleton RDF transform file for transform id" |
336 cerr << endl; | 355 " <I>, with default parameters for that transform, and write it" |
356 " to standard output.") | |
357 << endl << endl; | |
337 cerr << " -v, --version Show the version number and exit." << endl; | 358 cerr << " -v, --version Show the version number and exit." << endl; |
338 cerr << endl; | 359 cerr << endl; |
339 cerr << " --minversion <V> Exit with successful return code if the version of" << endl; | 360 cerr << " --minversion <V> " |
340 cerr << " " << myname << " is at least <V>, failure otherwise." << endl; | 361 << wrapCol("Exit with successful return code if the version of " |
341 cerr << " For scripts that depend on certain option support." << endl; | 362 + myname + " is at least <V>, failure otherwise." |
342 cerr << endl; | 363 " For scripts that depend on certain option support.") |
364 << endl << endl; | |
343 cerr << " -h, --help Show help." << endl; | 365 cerr << " -h, --help Show help." << endl; |
344 cerr << " -h, --help <W> Show help for writer type W." << endl; | 366 cerr << " -h, --help <W> Show help for writer type W." << endl; |
345 cerr << " " << writerText << endl; | 367 cerr << " " << writerText << endl; |
346 | 368 |
347 cerr << endl; | 369 cerr << endl |
348 cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl; | 370 << wrap("If no -w (or --writer) options are supplied, one of the" |
349 cerr << "(or long equivalent) must be given instead." << endl; | 371 " housekeeping options (-l -s -v -h or long equivalent) must" |
372 " be given instead.", 78, 0) | |
373 << endl; | |
350 | 374 |
351 } else { | 375 } else { |
352 | 376 |
353 FeatureWriter *w = FeatureWriterFactory::createWriter(writer); | 377 FeatureWriter *w = FeatureWriterFactory::createWriter(writer); |
354 if (!w) { | 378 if (!w) { |