Changeset 4120fbc for python/demos/demo_specdesc.py
- Timestamp:
- May 16, 2016, 3:16:00 AM (9 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- dc654f8
- Parents:
- 416ddd1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_specdesc.py
r416ddd1 r4120fbc 2 2 3 3 import sys 4 import numpy as np 4 5 from aubio import fvec, source, pvoc, specdesc 5 from numpy import hstack6 6 7 7 win_s = 512 # fft size 8 hop_s = win_s / 4# hop size8 hop_s = win_s // 4 # hop size 9 9 10 10 if len(sys.argv) < 2: 11 print "Usage: %s <filename> [samplerate]" % sys.argv[0]11 print("Usage: %s <filename> [samplerate]" % sys.argv[0]) 12 12 sys.exit(1) 13 13 … … 31 31 for method in methods: 32 32 cands = [] 33 all_descs[method] = fvec(0)33 all_descs[method] = np.array([]) 34 34 o[method] = specdesc(method, win_s) 35 35 … … 40 40 samples, read = s() 41 41 fftgrain = pv(samples) 42 # print "%f" % ( total_frames / float(samplerate) ),42 #outstr = "%f" % ( total_frames / float(samplerate) ) 43 43 for method in methods: 44 44 specdesc_val = o[method](fftgrain)[0] 45 all_descs[method] = hstack ( [all_descs[method], specdesc_val])46 # print "%f" % specdesc_val,47 #print 45 all_descs[method] = np.append(all_descs[method], specdesc_val) 46 #outstr += " %f" % specdesc_val 47 #print(outstr) 48 48 total_frames += read 49 49 if read < hop_s: break 50 50 51 51 if 1: 52 print "done computing, now plotting"52 print("done computing, now plotting") 53 53 import matplotlib.pyplot as plt 54 54 from demo_waveform_plot import get_waveform_plot
Note: See TracChangeset
for help on using the changeset viewer.