Changeset d5e846c for python/demos


Ignore:
Timestamp:
Mar 6, 2013, 10:56:04 PM (12 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:
9f8e8a9
Parents:
3184468
Message:

demos/demo_beats_and_tempo.py: skip plot if not beats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_beats_and_tempo.py

    r3184468 rd5e846c  
    3232
    3333from numpy import mean, median
    34 print 'mean period:', mean(periods), 'bpm'
    35 print 'median period:', median(periods), 'bpm'
    36 
    37 from pylab import plot, show
    38 plot(beats[1:], periods)
    39 show()
     34if len(periods):
     35    print 'mean period:', "%.2f" % mean(periods), 'bpm', 'median', "%.2f" % median(periods), 'bpm'
     36    if 0:
     37        from pylab import plot, show
     38        plot(beats[1:], periods)
     39        show()
     40else:
     41    print 'mean period:', "%.2f" % 0, 'bpm', 'median', "%.2f" % 0, 'bpm'
Note: See TracChangeset for help on using the changeset viewer.