shithub: aubio

ref: 714d05eaeac1b18e412051cfba429fd240e0f2e4
dir: /python.old/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 numpy 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:])