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/aubio (2 of 10 files). Show all

Unified · Split

2 files
  1. python/aubio/task/pitch.py +10 −4
  2. python/aubio/task/utils.py +2 −0
python/aubio/task/pitch.py+10−4
@@ -7,13 +7,19 @@ class taskpitch(task): · 6 unmodified lines
7 def __init__(self,input,params=None):7 def __init__(self,input,params=None):
8 task.__init__(self,input,params=params)8 task.__init__(self,input,params=params)
9 self.shortlist = [0. for i in range(self.params.pitchsmooth)]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 self.pitchdet = pitchdetection(mode=get_pitch_mode(self.params.pitchmode),16 self.pitchdet = pitchdetection(mode=get_pitch_mode(self.params.pitchmode),
11 bufsize=self.params.bufsize,17 bufsize=self.params.bufsize,
12 hopsize=self.params.hopsize,18 hopsize=self.params.hopsize,
13 channels=self.channels,19 channels=self.channels,
14 samplerate=self.srate,20 samplerate=self.srate,
15 omode=self.params.omode,21 omode=self.params.omode,
16 yinthresh=self.params.yinthresh)22 yinthresh=yinthresh)
17 23
18 def __call__(self):24 def __call__(self):
19 from aubio.median import short_find25 from aubio.median import short_find
@@ -67,7 +73,7 @@ class taskpitch(task): · 47 unmodified lines
67 time,pitch =[],[]73 time,pitch =[],[]
68 while(tasksil.readsize==tasksil.params.hopsize):74 while(tasksil.readsize==tasksil.params.hopsize):
69 tasksil()75 tasksil()
70 time.append(tasksil.params.step*tasksil.frameread)76 time.append(tasksil.params.step*(tasksil.frameread))
71 if not tasksil.issilence:77 if not tasksil.issilence:
72 pitch.append(self.truth)78 pitch.append(self.truth)
73 else:79 else:
@@ -155,7 +161,7 @@ class taskpitch(task): · 81 unmodified lines
155 title=self.params.pitchmode))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 from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot165 from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
160 import re166 import re
161 import Gnuplot167 import Gnuplot
@@ -197,7 +203,7 @@ class taskpitch(task): · 35 unmodified lines
197 g('set yrange [100:%f]' % self.params.pitchmax) 203 g('set yrange [100:%f]' % self.params.pitchmax)
198 else: 204 else:
199 g.ylabel('pitch (midi)')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 g('set key right top')207 g('set key right top')
202 g('set noclip one') 208 g('set noclip one')
203 g('set format x ""')209 g('set format x ""')
python/aubio/task/utils.py+2−0
@@ -33,6 +33,8 @@ def get_pitch_mode(nvalue): · 32 unmodified lines
33 return aubio_pitch_fcomb33 return aubio_pitch_fcomb
34 elif nvalue == 'schmitt':34 elif nvalue == 'schmitt':
35 return aubio_pitch_schmitt35 return aubio_pitch_schmitt
36 elif nvalue == 'yinfft':
37 return aubio_pitch_yinfft
36 else:38 else:
37 import sys39 import sys
38 print "error: unknown pitch detection function selected"40 print "error: unknown pitch detection function selected"

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