History

add yinfft method, make it default for pd plugin add yinfft method, make it default for pd plugin

Paul Brossier committed 20 years ago

Commit 650e39b1 parent 4994ebb10 files · +258 −12Browse files

Showing the changes to python (3 of 10 files). Show all

Unified · Split

3 files
  1. python/aubio/task/pitch.py +10 −4
  2. python/aubio/task/utils.py +2 −0
  3. python/aubiopitch +1 −2
python/aubio/task/pitch.py+10−4
@@ -7,13 +7,19 @@ class taskpitch(task): · 6 unmodified lines
77 def __init__(self,input,params=None):
88 task.__init__(self,input,params=params)
99 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.
1016 self.pitchdet = pitchdetection(mode=get_pitch_mode(self.params.pitchmode),
1117 bufsize=self.params.bufsize,
1218 hopsize=self.params.hopsize,
1319 channels=self.channels,
1420 samplerate=self.srate,
1521 omode=self.params.omode,
16− yinthresh=self.params.yinthresh)
22+ yinthresh=yinthresh)
1723
1824 def __call__(self):
1925 from aubio.median import short_find
@@ -67,7 +73,7 @@ class taskpitch(task): · 47 unmodified lines
6773 time,pitch =[],[]
6874 while(tasksil.readsize==tasksil.params.hopsize):
6975 tasksil()
70− time.append(tasksil.params.step*tasksil.frameread)
76+ time.append(tasksil.params.step*(tasksil.frameread))
7177 if not tasksil.issilence:
7278 pitch.append(self.truth)
7379 else:
@@ -155,7 +161,7 @@ class taskpitch(task): · 81 unmodified lines
155161 title=self.params.pitchmode))
156162
157163
158− def plotplot(self,wplot,oplots,outplot=None,multiplot = 1, midi = 1):
164+ def plotplot(self,wplot,oplots,outplot=None,multiplot = 0, midi = 1):
159165 from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
160166 import re
161167 import Gnuplot
@@ -197,7 +203,7 @@ class taskpitch(task): · 35 unmodified lines
197203 g('set yrange [100:%f]' % self.params.pitchmax)
198204 else:
199205 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)))
201207 g('set key right top')
202208 g('set noclip one')
203209 g('set format x ""')
python/aubio/task/utils.py+2−0
@@ -33,6 +33,8 @@ def get_pitch_mode(nvalue): · 32 unmodified lines
3333 return aubio_pitch_fcomb
3434 elif nvalue == 'schmitt':
3535 return aubio_pitch_schmitt
36+ elif nvalue == 'yinfft':
37+ return aubio_pitch_yinfft
3638 else:
3739 import sys
3840 print "error: unknown pitch detection function selected"
python/aubiopitch+1−2
@@ -89,7 +89,7 @@ params.samplerate = float(sndfile(filename).samplerate()) · 88 unmodified lines
8989 params.hopsize = int(options.hopsize)
9090 params.bufsize = int(options.bufsize)
9191 params.step = params.samplerate/float(params.hopsize)
92−params.threshold = float(options.threshold)
92+params.yinthresh = float(options.threshold)
9393 params.silence = float(options.silence)
9494 params.verbose = options.verbose
9595 #mintol = float(options.mintol)*step
@@ -100,7 +100,6 @@ else: delay = 2./params.step · 4 unmodified lines
100100 if options.note:
101101 exit("not implemented yet")
102102
103−
104103 wplot,oplots = [],[]
105104 modes = options.mode.split(',')
106105 for i in range(len(modes)):

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t