examples/compute_features.py
def main():
    """Main function to parse the arguments and call the main process."""
    parser = argparse.ArgumentParser(
        description="Extracts a set of features from a given dataset "
        "or audio file and saves them into the 'features' folder of "
        "the dataset or the specified single file.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("in_path",
                        action="store",
                        help="Input dataset dir or audio file")
    parser.add_argument("-j",
                        action="store",
                        dest="n_jobs",
                        type=int,
                        help="Number of jobs (only for collection mode)",
                        default=4)
    parser.add_argument("-o",
                        action="store",
                        dest="out_file",
                        type=str,
                        help="Output file (only for single file mode)",
                        default="out.json")
    parser.add_argument("-d",
                        action="store",
                        dest="ds_name",
                        default="*",
                        help="The prefix of the dataset to use "
                        "(e.g. Isophonics, SALAMI)")
    parser.add_argument("-fs",
                        action="store_true",
                        dest="framesync",
                        help="Use frame-synchronous features",
                        default=False)
    args = parser.parse_args()
    start_time = time.time()

    # Setup the logger
    logging.basicConfig(format='%(asctime)s: %(levelname)s: %(message)s',
        level=logging.INFO)

    # Run the main process
    process(args.in_path, out_file=args.out_file, n_jobs=args.n_jobs, framesync=args.framesync)

    # Done!
    logging.info("Done! Took %.2f seconds." % (time.time() - start_time))
def main():
    """Main function to parse the arguments and call the main process."""
    parser = argparse.ArgumentParser(
        description="Extracts a set of features from a given dataset "
        "or audio file and saves them into the 'features' folder of "
        "the dataset or the specified single file.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("in_path",
                        action="store",
                        help="Input dataset dir or audio file")
    parser.add_argument("-j",
                        action="store",
                        dest="n_jobs",
                        type=int,
                        help="Number of jobs (only for collection mode)",
                        default=4)
    parser.add_argument("-o",
                        action="store",
                        dest="out_file",
                        type=str,
                        help="Output file (only for single file mode)",
                        default="out.json")
    parser.add_argument("-d",
                        action="store",
                        dest="ds_name",
                        default="*",
                        help="The prefix of the dataset to use "
                        "(e.g. Isophonics, SALAMI)")
    parser.add_argument("-fs",
                        action="store_true",
                        dest="framesync",
                        help="Use frame-synchronous features",
                        default=False)
    args = parser.parse_args()
    start_time = time.time()

    # Setup the logger
    logging.basicConfig(format='%(asctime)s: %(levelname)s: %(message)s',
        level=logging.INFO)

    # Run the main process
    process(args.in_path, out_file=args.out_file, n_jobs=args.n_jobs, framesync=args.framesync)

    # Done!
    logging.info("Done! Took %.2f seconds." % (time.time() - start_time))
def main ( ) : parser = argparse . ArgumentParser ( description = "Extracts a set of features from a given dataset " "or audio file and saves them into the 'features' folder of " "the dataset or the specified single file." , formatter_class = argparse . ArgumentDefaultsHelpFormatter ) parser . add_argument ( "in_path" , action = "store" , help = "Input dataset dir or audio file" ) parser . add_argument ( "-j" , action = "store" , dest = "n_jobs" , type = int , help = "Number of jobs (only for collection mode)" , default = 4 ) parser . add_argument ( "-o" , action = "store" , dest = "out_file" , type = str , help = "Output file (only for single file mode)" , default = "out.json" ) parser . add_argument ( "-d" , action = "store" , dest = "ds_name" , default = "*" , help = "The prefix of the dataset to use " "(e.g. Isophonics, SALAMI)" ) parser . add_argument ( "-fs" , action = "store_true" , dest = "framesync" , help = "Use frame-synchronous features" , default = False ) args = parser . parse_args ( ) start_time = time . time ( ) # Setup the logger logging . basicConfig ( format = '%(asctime)s: %(levelname)s: %(message)s' , level = logging . INFO ) # Run the main process process ( args . in_path , out_file = args . out_file , n_jobs = args . n_jobs , framesync = args . framesync ) # Done! logging . info ( "Done! Took %.2f seconds." % ( time . time ( ) - start_time ) )
Main function to parse the arguments and call the main process.
Main function to parse the arguments and call the main process .