Changes in / [5d16185:18a378e]


Ignore:
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_specdesc.py

    r5d16185 r18a378e  
    2222pv = pvoc(win_s, hop_s)
    2323
    24 methods = ['default', 'energy', 'hfc', 'complex', 'phase', 'specdiff', 'kl',
    25         'mkl', 'specflux', 'centroid', 'slope', 'rolloff', 'spread', 'skewness',
    26         'kurtosis', 'decrease',]
     24methods = ['default', 'energy', 'hfc', 'complex', 'phase', 'specdiff', 'kl', 'mkl',
     25    'specflux', 'centroid', 'spread', 'skewness', 'kurtosis', 'slope', 'decrease',
     26    'rolloff', ]
    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
    5655    fig = plt.figure()
    5756    plt.rc('lines',linewidth='.8')
    5857    wave = plt.axes([0.1, 0.75, 0.8, 0.19])
    59     get_waveform_plot(filename, samplerate, block_size = hop_s, ax = wave )
     58    get_waveform_plot(filename, samplerate, ax = wave )
    6059    wave.yaxis.set_visible(False)
    6160    wave.xaxis.set_visible(False)
     
    7574                horizontalalignment='right', verticalalignment='bottom',
    7675                )
    77     set_xlabels_sample2time(ax, all_desc_times[-1], samplerate)
     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)
    7882    #plt.ylabel('spectral descriptor value')
    7983    ax.xaxis.set_visible(True)
  • python/demos/demo_waveform_plot.py

    r5d16185 r18a378e  
    55from numpy import zeros, hstack
    66
    7 def get_waveform_plot(filename, samplerate = 0, block_size = 4096, ax = None):
     7def get_waveform_plot(filename, samplerate = 0, ax = None):
    88    import matplotlib.pyplot as plt
    99    if not ax:
    1010        fig = plt.figure()
    1111        ax = fig.add_subplot(111)
    12     hop_s = block_size
     12    hop_s = 4096 # block size
    1313
    1414    allsamples_max = zeros(0,)
    15     downsample = 2**4  # to plot n samples / hop_s
     15    downsample = 2**3  # to plot n samples / hop_s
    1616
    1717    a = source(filename, samplerate, hop_s)            # source file
     
    2626        total_frames += read
    2727        if read < hop_s: break
     28    print samples.reshape(hop_s/downsample, downsample).shape
     29
    2830    allsamples_max = (allsamples_max > 0) * allsamples_max
    2931    allsamples_max_times = [ ( float (t) / downsample ) * hop_s for t in range(len(allsamples_max)) ]
     
    3335    ax.axis(xmin = allsamples_max_times[0], xmax = allsamples_max_times[-1])
    3436
    35     set_xlabels_sample2time(ax, allsamples_max_times[-1], samplerate)
    36     return ax
    37 
    38 def set_xlabels_sample2time(ax, latest_sample, samplerate):
    39     ax.axis(xmin = 0, xmax = latest_sample)
    40     if latest_sample / float(samplerate) > 60:
     37    if allsamples_max_times[-1] / float(samplerate) > 60:
    4138        ax.set_xlabel('time (mm:ss)')
    4239        ax.set_xticklabels([ "%02d:%02d" % (t/float(samplerate)/60, (t/float(samplerate))%60) for t in ax.get_xticks()[:-1]], rotation = 50)
     
    4441        ax.set_xlabel('time (ss.mm)')
    4542        ax.set_xticklabels([ "%02d.%02d" % (t/float(samplerate), 100*((t/float(samplerate))%1) ) for t in ax.get_xticks()[:-1]], rotation = 50)
    46 
    47 
    4843if __name__ == '__main__':
    4944    import matplotlib.pyplot as plt
  • tests/src/io/test-sink.c

    r5d16185 r18a378e  
    3434  } while ( read == hop_size );
    3535
    36   PRINT_MSG("wrote %d frames at %dHz from %s written to %s\n",
    37       n_frames, samplerate, source_path, sink_path);
     36  PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
     37      n_frames, source_path, sink_path, samplerate);
    3838
    3939beach:
Note: See TracChangeset for help on using the changeset viewer.