# HG changeset patch # User Emmanouil Theofanis Chourdakis # Date 1538310109 -3600 # Node ID ebf92ed7d680428d4fbfa5a235eefebb0f5e0fd0 # Parent 275d04483bf7b47b281934dc35f9151605c3af57 Added -fd (--full-duration) argument. diff -r 275d04483bf7 -r ebf92ed7d680 python/simscene.py --- a/python/simscene.py Sun Sep 30 12:43:14 2018 +0100 +++ b/python/simscene.py Sun Sep 30 13:21:49 2018 +0100 @@ -353,6 +353,11 @@ annot_format = kwargs['annot_format'] else: annot_format = 'sed_eval' + + if 'full_duration' in kwargs: + full_duration = True + else: + full_duration = False # Stores the starting and ending times of every track for visualization # purposes @@ -608,6 +613,11 @@ # If 0, then start next sample after this one (set it to the duration of the sample) if mean_time_between_instances == 0: mean_time_between_instances = len(wav)/float(SR) + + # If we are using -fd (full_duration) for each event then mean_time_between_instances denotes time AFTER + # the end of the previous event. + if full_duration and mean_time_between_instances > 0: + mean_time_between_instances += len(wav)/float(SR) # Store the successive starting and ending times of the events (given e.g. the model) # in the following lists. @@ -900,7 +910,14 @@ choices=['generate', 'abstract', 'replicate'] ) time_mode = 'generate' - + + argparser.add_argument( + '-fd', '--full-duration', + action='store_true', + help="If enabled, times specified in the recipe refer to after the previous file finishes." + ) + full_duration = False + argparser.add_argument( '-R', '--ebr-mode', type=str, @@ -993,6 +1010,8 @@ if args.output_path: output_path = args.output_path logging.debug("Saving to `{}'".format(output_path)) + if args.full_duration: + full_duration = True if args.scene_duration: if not (args.score_backgrounds or args.score_events): print("You must provide one of -e or -b") @@ -1046,7 +1065,8 @@ figure_verbosity=figure_verbosity, end_cut=end_cut, image_format=image_format, - append_to_filename=append_to_filename) + append_to_filename=append_to_filename, + full_duration=full_duration) else: for n in range(generate_n): if tag: @@ -1065,4 +1085,5 @@ figure_verbosity=min(figure_verbosity, 1), end_cut=end_cut, image_format=image_format, - append_to_filename=append_to_filename) + append_to_filename=append_to_filename, + full_duration=full_duration)