Changeset 6ff6d18 for python


Ignore:
Timestamp:
Mar 22, 2013, 5:56:15 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:
5d16185
Parents:
e5afd47
Message:

python/demos/demo_{mel-energy,mfcc,specdesc}.py: use set_xlabels_sample2time

Location:
python/demos
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_mel-energy.py

    re5afd47 r6ff6d18  
    44from aubio import fvec, source, pvoc, filterbank
    55from numpy import vstack, zeros
    6 from demo_waveform_plot import set_xlabels_sample2time
    76
    87win_s = 512                 # fft size
     
    4645    import matplotlib.pyplot as plt
    4746    from demo_waveform_plot import get_waveform_plot
     47    from demo_waveform_plot import set_xlabels_sample2time
    4848    fig = plt.figure()
    4949    plt.rc('lines',linewidth='.8')
  • python/demos/demo_mfcc.py

    re5afd47 r6ff6d18  
    44from aubio import source, pvoc, mfcc
    55from numpy import array, vstack, zeros
    6 from demo_waveform_plot import set_xlabels_sample2time
    76
    87win_s = 512                 # fft size
     
    4241from numpy import arange
    4342from demo_waveform_plot import get_waveform_plot
     43from demo_waveform_plot import set_xlabels_sample2time
    4444import matplotlib.pyplot as plt
    4545
  • python/demos/demo_specdesc.py

    re5afd47 r6ff6d18  
    2222pv = pvoc(win_s, hop_s)
    2323
    24 methods = ['default', 'energy', 'hfc', 'complex', 'phase', 'specdiff', 'kl', 'mkl',
    25     'specflux', 'centroid', 'spread', 'skewness', 'kurtosis', 'slope', 'decrease',
    26     'rolloff', ]
     24methods = ['default', 'energy', 'hfc', 'complex', 'phase', 'specdiff', 'kl',
     25        'mkl', 'specflux', 'centroid', 'slope', 'rolloff', 'spread', 'skewness',
     26        'kurtosis', 'decrease',]
    2727
    2828all_descs = {}
     
    4040    samples, read = s()
    4141    fftgrain = pv(samples)
    42     print "%f" % ( total_frames / float(samplerate) ),
     42    #print "%f" % ( total_frames / float(samplerate) ),
    4343    for method in methods:
    4444        specdesc_val = o[method](fftgrain)[0]
    4545        all_descs[method] = hstack ( [all_descs[method], specdesc_val] )
    46         print "%f" % specdesc_val,
    47     print
     46        #print "%f" % specdesc_val,
     47    #print
    4848    total_frames += read
    4949    if read < hop_s: break
     
    5353    import matplotlib.pyplot as plt
    5454    from demo_waveform_plot import get_waveform_plot
     55    from demo_waveform_plot import set_xlabels_sample2time
    5556    fig = plt.figure()
    5657    plt.rc('lines',linewidth='.8')
    5758    wave = plt.axes([0.1, 0.75, 0.8, 0.19])
    58     get_waveform_plot(filename, samplerate, ax = wave )
     59    get_waveform_plot(filename, samplerate, block_size = hop_s, ax = wave )
    5960    wave.yaxis.set_visible(False)
    6061    wave.xaxis.set_visible(False)
     
    7475                horizontalalignment='right', verticalalignment='bottom',
    7576                )
    76     if all_desc_times[-1] / float(samplerate) > 60:
    77         plt.xlabel('time (mm:ss)')
    78         ax.set_xticklabels([ "%02d:%02d" % (t/float(samplerate)/60, (t/float(samplerate))%60) for t in ax.get_xticks()[:-1]], rotation = 50)
    79     else:
    80         plt.xlabel('time (ss.mm)')
    81         ax.set_xticklabels([ "%02d.%02d" % (t/float(samplerate), 100*((t/float(samplerate))%1) ) for t in ax.get_xticks()[:-1]], rotation = 50)
     77    set_xlabels_sample2time(ax, all_desc_times[-1], samplerate)
    8278    #plt.ylabel('spectral descriptor value')
    8379    ax.xaxis.set_visible(True)
Note: See TracChangeset for help on using the changeset viewer.