Changeset 4798fdf for python


Ignore:
Timestamp:
Apr 20, 2006, 2:46:42 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:
9bec8fe
Parents:
650e39b
Message:

update params and pitch
update params and pitch

Location:
python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/task/params.py

    r650e39b r4798fdf  
    2626                self.yinfftthresh = 0.85
    2727                self.pitchsmooth = 0
    28                 self.pitchmin=10.
     28                self.pitchmin=20.
    2929                self.pitchmax=20000.
     30                self.pitchdelay = -0.5
    3031                self.dcthreshold = -1.
    3132                self.omode = aubio_pitchm_freq
  • python/aubio/task/pitch.py

    r650e39b r4798fdf  
    7979                                        else:
    8080                                                pitch.append(-1.)
    81                                 return time,pitch #0,aubio_miditofreq(float(floatpit))
     81                                return time,pitch
    8282                        except ValueError:
    8383                                # FIXME very weak check
     
    121121                        if pitch[i] == "nan" or pitch[i] == -1:
    122122                                pitch[i] = -1
    123                 time = [ i*self.params.step for i in range(len(pitch)) ]
     123                time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
    124124                #print len(timet),len(pitcht)
    125125                #print len(time),len(pitch)
     
    153153
    154154        def plot(self,pitch,wplot,oplots,outplot=None):
    155                 import numarray
    156155                import Gnuplot
    157156
    158                 downtime = self.params.step*numarray.arange(len(pitch))
     157                time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
    159158                pitch = [aubio_freqtomidi(i) for i in pitch]
    160                 oplots.append(Gnuplot.Data(downtime,pitch,with='lines',
     159                oplots.append(Gnuplot.Data(time,pitch,with='lines',
    161160                        title=self.params.pitchmode))
    162161
    163162                       
    164         def plotplot(self,wplot,oplots,outplot=None,multiplot = 0, midi = 1):
     163        def plotplot(self,wplot,oplots,outplot=None,multiplot = 1, midi = 1):
    165164                from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
    166165                import re
     
    185184                # plot waveform and onsets
    186185                g('set size 1,0.3')
     186                g('set ytics 10')
    187187                g('set origin 0,0.7')
    188188                g('set xrange [0:%f]' % max(time))
     
    203203                        g('set yrange [100:%f]' % self.params.pitchmax)
    204204                else:
    205                         g.ylabel('pitch (midi)')
     205                        g.ylabel('midi')
    206206                        g('set yrange [%f:%f]' % (aubio_freqtomidi(self.params.pitchmin), aubio_freqtomidi(self.params.pitchmax)))
    207207                g('set key right top')
  • python/aubiopitch

    r650e39b r4798fdf  
    4040        parser.add_option("-D","--delay",
    4141                          action="store", dest="delay", 
    42                           help="number of seconds to take back [default=system]\
    43                           default system delay is 2*hopsize/samplerate")
    44         parser.add_option("-L","--localmin",
    45                           action="store_true", dest="localmin", default=False,
    46                           help="use local minima after peak detection")
    47         parser.add_option("-c","--cut",
    48                           action="store_true", dest="cut", default=False,
    49                           help="cut input sound file at detected labels \
    50                           best used with option -L")
     42                          help="number of seconds frames to take back [default=0]")
     43        parser.add_option("-S","--smoothing",
     44                          action="store", dest="smoothing", default=False,
     45                          help="use a median filter of N frames [default=0]")
     46        parser.add_option("-M","--maximum",
     47                          action="store", dest="pitchmax", default=False,
     48                          help="maximum pitch value to look for (Hz) [default=20000]")
     49        parser.add_option("-l","--minimum",
     50                          action="store", dest="pitchmin", default=False,
     51                          help="minimum pitch value to look for (Hz) [default=20]")
    5152        # to be implemented
    5253        parser.add_option("-n","--note",
     
    5657        parser.add_option("-p","--plot",
    5758                          action="store_true", dest="plot", default=False,
    58                           help="NOT IMPLEMENTED draw plot")
     59                          help="draw plot of the pitch track")
    5960        parser.add_option("-O","--outplot",
    6061                          action="store", dest="outplot", default=None,
    61                           help="NOT IMPLEMENTED save plot to output.{ps,png}")
     62                          help="save the plot to output.{ps,png,svg} instead of displaying it")
    6263        parser.add_option("-v","--verbose",
    6364                          action="store_true", dest="verbose", default=False,
    64                           help="make lots of noise [default]")
     65                          help="make lots of noise")
    6566        parser.add_option("-q","--quiet",
    6667                          action="store_false", dest="verbose", default=False,
     
    9394params.silence    = float(options.silence)
    9495params.verbose    = options.verbose
     96if options.smoothing: params.pitchsmooth = int(options.smoothing)
     97if options.pitchmax:  params.pitchmax    = int(options.pitchmax)
     98if options.pitchmin:  params.pitchmin    = int(options.pitchmin)
    9599#mintol     = float(options.mintol)*step
    96100# default take back system delay
    97 if options.delay: delay = float(options.delay)
    98 else:             delay = 2./params.step
     101if options.delay: params.pitchdelay = float(options.delay)
    99102
    100103if options.note:
Note: See TracChangeset for help on using the changeset viewer.