parser.add_argument('-t', "--time", type=int, default=1, help="timing calculation n-fold (default=%(default)s)") parser.add_argument('-p', "--plot", action='store_true', help="plot results (needs installed matplotlib and scipy packages)") args = parser.parse_args() if not os.path.exists(args.input): parser.error("Input file '%s' not found"%args.input) # Read audio data if Sndfile is not None: sf = Sndfile(args.input) fs = sf.samplerate samples = sf.nframes else: sf = PySndfile(args.input) fs = sf.samplerate() samples = sf.frames() s = sf.read_frames(samples) if s.ndim > 1: s = np.mean(s, axis=1) scales = {'log':LogScale, 'lin':LinScale, 'mel':MelScale, 'oct':OctScale} try: scale = scales[args.scale] except KeyError: parser.error('scale unknown') scl = scale(args.fmin, args.fmax, args.bins) times = []