Showing the changes to python/aubio (2 of 10 files). Show all
Unified · Split
| @@ -7,13 +7,19 @@ class taskpitch(task): · 6 unmodified lines | ||
| 7 | 7 | def __init__(self,input,params=None): |
| 8 | 8 | task.__init__(self,input,params=params) |
| 9 | 9 | self.shortlist = [0. for i in range(self.params.pitchsmooth)] |
| 10 | + if self.params.pitchmode == 'yinfft': | |
| 11 | + yinthresh = self.params.yinfftthresh | |
| 12 | + elif self.params.pitchmode == 'yin': | |
| 13 | + yinthresh = self.params.yinthresh | |
| 14 | + else: | |
| 15 | + yinthresh = 0. | |
| 10 | 16 | self.pitchdet = pitchdetection(mode=get_pitch_mode(self.params.pitchmode), |
| 11 | 17 | bufsize=self.params.bufsize, |
| 12 | 18 | hopsize=self.params.hopsize, |
| 13 | 19 | channels=self.channels, |
| 14 | 20 | samplerate=self.srate, |
| 15 | 21 | omode=self.params.omode, |
| 16 | − yinthresh=self.params.yinthresh) | |
| 22 | + yinthresh=yinthresh) | |
| 17 | 23 | |
| 18 | 24 | def __call__(self): |
| 19 | 25 | from aubio.median import short_find |
| @@ -67,7 +73,7 @@ class taskpitch(task): · 47 unmodified lines | ||
| 67 | 73 | time,pitch =[],[] |
| 68 | 74 | while(tasksil.readsize==tasksil.params.hopsize): |
| 69 | 75 | tasksil() |
| 70 | − time.append(tasksil.params.step*tasksil.frameread) | |
| 76 | + time.append(tasksil.params.step*(tasksil.frameread)) | |
| 71 | 77 | if not tasksil.issilence: |
| 72 | 78 | pitch.append(self.truth) |
| 73 | 79 | else: |
| @@ -155,7 +161,7 @@ class taskpitch(task): · 81 unmodified lines | ||
| 155 | 161 | title=self.params.pitchmode)) |
| 156 | 162 | |
| 157 | 163 | |
| 158 | − def plotplot(self,wplot,oplots,outplot=None,multiplot = 1, midi = 1): | |
| 164 | + def plotplot(self,wplot,oplots,outplot=None,multiplot = 0, midi = 1): | |
| 159 | 165 | from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot |
| 160 | 166 | import re |
| 161 | 167 | import Gnuplot |
| @@ -197,7 +203,7 @@ class taskpitch(task): · 35 unmodified lines | ||
| 197 | 203 | g('set yrange [100:%f]' % self.params.pitchmax) |
| 198 | 204 | else: |
| 199 | 205 | g.ylabel('pitch (midi)') |
| 200 | − g('set yrange [%f:%f]' % (40, aubio_freqtomidi(self.params.pitchmax))) | |
| 206 | + g('set yrange [%f:%f]' % (aubio_freqtomidi(self.params.pitchmin), aubio_freqtomidi(self.params.pitchmax))) | |
| 201 | 207 | g('set key right top') |
| 202 | 208 | g('set noclip one') |
| 203 | 209 | g('set format x ""') |
| @@ -33,6 +33,8 @@ def get_pitch_mode(nvalue): · 32 unmodified lines | ||
| 33 | 33 | return aubio_pitch_fcomb |
| 34 | 34 | elif nvalue == 'schmitt': |
| 35 | 35 | return aubio_pitch_schmitt |
| 36 | + elif nvalue == 'yinfft': | |
| 37 | + return aubio_pitch_yinfft | |
| 36 | 38 | else: |
| 37 | 39 | import sys |
| 38 | 40 | print "error: unknown pitch detection function selected" |