shithub: aubio

ref: fed94339e2b61f175b12cb8e350ec8f4565a3489
dir: /python/aubioplot-notes/

View raw version
#!/usr/bin/python

def parse_args (sysargs):
        from getopt import gnu_getopt
        shortopts ='i:o:'
        longopts =('input=','output=')
        args,tmp = gnu_getopt(sysargs,shortopts,longopts)
        args.sort()
        filein,fileout= None,None
        for i in range(len(args)):  # a bad way
                if args[i][0] == '-i' or args[i][0] == '--input':
                        filein =  args[i][1]
                if args[i][0] == '-o' or args[i][0] == '--output':
                        fileout =  args[i][1]
        assert filein != None, 'precise filein'
        return filein,fileout

def main (sysargs) :
    from aubio.txtfile import read_datafile
    from aubio.gnuplot import plotnote,plotnote_do 
    from numarray import array
    filein,fileout = parse_args(sysargs)
    #print 'checking', fileerr, 'against', fileorg
    """ load midi and raw data """
    d = plotnote(array(read_datafile(filein)),title=filein)
    plotnote_do(d,fileout=fileout)

if __name__ == "__main__":
    import sys 
    main(sys.argv[1:])