# HG changeset patch # User Dan Stowell # Date 1354195071 0 # Node ID 383cc866a2211d6f0db8a90748100d4135816e3d # Parent f30f1a3f433f3d92e6e317133826ed4767a12624 respect verbsity option more politely diff -r f30f1a3f433f -r 383cc866a221 smacpy.py --- a/smacpy.py Thu Nov 29 13:12:57 2012 +0000 +++ b/smacpy.py Thu Nov 29 13:17:51 2012 +0000 @@ -110,7 +110,7 @@ if verbose: print("Reading %s" % wavpath) if not os.path.isfile(wavpath): raise ValueError("path %s not found" % path) sf = Sndfile(wavpath, "r") - if sf.channels != 1: print(" Sound file has multiple channels (%i) - channels will be mixed to mono." % sf.channels) + if (sf.channels != 1) and verbose: print(" Sound file has multiple channels (%i) - channels will be mixed to mono." % sf.channels) if sf.samplerate != fs: raise ValueError("wanted sample rate %g - got %g." % (fs, sf.samplerate)) window = np.hamming(framelen) features = [] @@ -182,7 +182,8 @@ ncorrect = 0 for wavpath,label in wavsfound['testpath'].items(): result = model.classify(os.path.join(args['testpath'], wavpath)) - print(" inferred: %s" % result) + if verbose: + print(" inferred: %s" % result) if result == label: ncorrect += 1 print("Got %i correct out of %i (trained on %i classes)" % (ncorrect, len(wavsfound['testpath']), len(model.gmms)))