view simscene.py @ 4:94eb0280ad4a

added more (all?) options
author Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk>
date Fri, 29 Sep 2017 20:39:54 +0100
parents bfd2651f928c
children 42f189846ba8
line wrap: on
line source
#!/bin/python
# -*- coding: utf-8 -*-
# For licensing please see: LICENSE
# Copyright (c) Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk>
import argparse


def run_demo():
    print("TODO: Implement run_demo()")
    
def simscene(input_path,
             output_path,
             scene_duration,
             score_events,
             score_backgrounds,
             **kwargs):
    print("TODO: Implement simscene()")
             
def not_implemented():
    print("TODO: not implemented")
    
if __name__=="__main__":
    """
    Main function, parses options and calls the simscene generation function
    or a demo. The options given are almost identical to Lagrange et al's 
    simscene.
    """
    argparser = argparse.ArgumentParser(
            description="SimScene.py audio scene generator",
    )
    argparser.add_argument(
        'input_path',
        type=str,
        help="Path of a directory containing wave files for sound backgrounds (in the `background' sub-directory) or events (in `event')"
    )
    argparser.add_argument(
        '-T', '--scene-duration',
        type=float,
        help="Duration of scene in seconds",
    )
    argparser.add_argument(
        '-e', '--score-events',
        type=str,
        help="Score events file as a comma-separated text file (.csv, .txt), JSON (.json), or Excel (.xls) file"
    )
    argparser.add_argument(
        '-b', '--score-backgrounds',
        type=str,
        help="Score backgrounds file as a comma-separated text file (.csv, .txt), JSON (.json), or Excel (.xls) file"
    )
    argparser.add_argument(
        '-t', '--time-mode',
        type=str,
        help="Mode of spacing between events. `generate': values must be set for each track in the score files. `abstract': values are computed from an abstract representation of an existing acoustic scene. `replicate': values are replicated from an existing acousting scene.",
        choices=['generate', 'abstract', 'replicate']
    )
    argparser.add_argument(
        '-R', '--ebr-mode',
        type=str,
        help="Mode for Event to Background power level ratio. `generate': values must be set for each track in the score files. `abstract': values are computed from an abstract representation of an existing acoustic scene. `replicate': values are replicated from an existing acousting scene.",
        choices=['generate', 'abstract', 'replicate']
    )
    argparser.add_argument(
        '--annotation-file',
        type=float,
        help="If -R or -m are selected, this provides the source for sourcing the times or EBRs from ANNOTATION_FILE. ANNOTATION_FILE must be comma-separated text file (.csv, .txt), JSON (.json), or Excel (.xls)."
    )
    argparser.add_argument(
        '--audio-file',
        type=float,
        help="If -R or -m are selected, this provides the source for sourcing the times or EBRs from AUDIO_FILE. AUDIO_FILE must be a 44100Hz .wav file."
    )
    argparser.add_argument(
        '-f', '--figure', action='count',
        help="Increase figure verbosity. (Default) 0 - Don't save or display figures, 1 - Save pictures but do not display them, 2 - Save and display figures"
    )
    argparser.add_argument(
        '-C', '--channel',
        type=int,
        help="number of audio channels contained in file. (Default) 0 - 1 channel (mono), 1 - As many channels as sound classes (events+textures), 2 - Same as 1, each channel is saved in a separate .wav file."
    )
    argparser.add_argument(
        '-m', '--min-space',
        type=float,
        help="Minimum space allowed between successive events (seconds). If -1, then allow overlapping between events."
    )
    argparser.add_argument(
        '-c', '--end-cut',
        action='store_true',
        help="If the last sample ends after the scene ends then: if enabled, cut the sample to duration, else remove the sample."
    )
    args = argparser.parse_args()
    not_implemented()