Changeset 5e491b3b for python/aubiocut


Ignore:
Timestamp:
Aug 28, 2005, 7:58:31 PM (19 years ago)
Author:
Paul Brossier <piem@altern.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:
3c86eb1
Parents:
4cc9fe5
Message:

massive changes from cam

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubiocut

    r4cc9fe5 r5e491b3b  
    66
    77import sys
    8 from aubio.aubioclass import *
     8from aubio.tasks import *
    99
    1010usage = "usage: %s [options] -i soundfile" % sys.argv[0]
     
    8989silence    = float(options.silence)
    9090mintol     = float(options.mintol)*step
     91mode       = options.mode
    9192# default take back system delay
    9293if options.delay: delay = float(options.delay)
     
    9899elif options.silencecut:
    99100        onsets = getsilences(filename,hopsize=hopsize,silence=silence)
    100 elif options.plot:
     101elif options.plot: storefunc=True
     102else:              storefunc=False
     103
     104lonsets, lofunc = [], []
     105for i in range(len(mode)):
    101106        onsets, ofunc = getonsets(filename,threshold,silence,
    102                 mode=options.mode,localmin=options.localmin,
     107                mode=mode[i],localmin=options.localmin,
    103108                derivate=options.derivate,
    104109                bufsize=bufsize,hopsize=hopsize,storefunc=True)
    105 else:
    106         onsets = getonsets(filename,threshold,silence,
    107                 mode=options.mode,localmin=options.localmin,
    108                 derivate=options.derivate,
    109                 bufsize=bufsize,hopsize=hopsize)
    110110
    111 # take back system delay
    112 if delay != 0:
    113         for i in range(len(onsets)):
    114                 onsets[i] -= delay*step
     111        # take back system delay
     112        if delay != 0:
     113                for i in range(len(onsets)):
     114                        onsets[i] -= delay*step
    115115
    116 # prune doubled
    117 if mintol > 0:
    118         last = -2*mintol
    119         newonsets = []
    120         for new in onsets:
    121                 if (new - last > mintol):
    122                         newonsets.append(new)
    123                 last = new
    124         onsets = newonsets
     116        # prune doubled
     117        if mintol > 0:
     118                last = -2*mintol
     119                newonsets = []
     120                for new in onsets:
     121                        if (new - last > mintol):
     122                                newonsets.append(new)
     123                        last = new
     124                onsets = newonsets
     125
     126        lonsets.append(onsets)
     127        lofunc.append(ofunc)
    125128
    126129# print times in second
    127130if options.verbose:
    128         for i in onsets: print "%f" % (i/step)
     131        maxonset = 0
     132        for j in range(len(mode)):
     133                for i in range(len(lonsets[j])):
     134                        print lonsets[j][i]/step
    129135
    130136if options.plot:
    131137        from aubio.gnuplot import plot_onsets
    132         plot_onsets(filename, onsets, ofunc,
     138        plot_onsets(filename, lonsets, lofunc,
    133139                samplerate=samplerate, hopsize=hopsize, outplot=options.outplot)
    134140
Note: See TracChangeset for help on using the changeset viewer.