Mercurial > hg > smacpy
changeset 12:383cc866a221
respect verbsity option more politely
author | Dan Stowell <danstowell@users.sourceforge.net> |
---|---|
date | Thu, 29 Nov 2012 13:17:51 +0000 |
parents | f30f1a3f433f |
children | 4a29489a577b |
files | smacpy.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)))