Ignore:
Timestamp:
May 16, 2016, 3:16:00 AM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

python/demos: python3 and double precision compatibility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_specdesc.py

    r416ddd1 r4120fbc  
    22
    33import sys
     4import numpy as np
    45from aubio import fvec, source, pvoc, specdesc
    5 from numpy import hstack
    66
    77win_s = 512                 # fft size
    8 hop_s = win_s / 4           # hop size
     8hop_s = win_s // 4          # hop size
    99
    1010if len(sys.argv) < 2:
    11     print "Usage: %s <filename> [samplerate]" % sys.argv[0]
     11    print("Usage: %s <filename> [samplerate]" % sys.argv[0])
    1212    sys.exit(1)
    1313
     
    3131for method in methods:
    3232    cands = []
    33     all_descs[method] = fvec(0)
     33    all_descs[method] = np.array([])
    3434    o[method] = specdesc(method, win_s)
    3535
     
    4040    samples, read = s()
    4141    fftgrain = pv(samples)
    42     #print "%f" % ( total_frames / float(samplerate) ),
     42    #outstr = "%f" % ( total_frames / float(samplerate) )
    4343    for method in methods:
    4444        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)
    4848    total_frames += read
    4949    if read < hop_s: break
    5050
    5151if 1:
    52     print "done computing, now plotting"
     52    print("done computing, now plotting")
    5353    import matplotlib.pyplot as plt
    5454    from demo_waveform_plot import get_waveform_plot
Note: See TracChangeset for help on using the changeset viewer.