feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 48b847b was
ba11e53,
checked in by Paul Brossier <piem@altern.org>, 19 years ago
|
beat should be fixed, add comments about
beat should be fixed, add comments about
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | from aubio.aubioclass import * |
---|
2 | from params import taskparams |
---|
3 | |
---|
4 | class task(taskparams): |
---|
5 | """ default template class to apply tasks on a stream """ |
---|
6 | def __init__(self,input,output=None,params=None): |
---|
7 | """ open the input file and initialize default argument |
---|
8 | parameters should be set *before* calling this method. |
---|
9 | """ |
---|
10 | import time |
---|
11 | self.tic = time.time() |
---|
12 | if params == None: self.params = taskparams() |
---|
13 | else: self.params = params |
---|
14 | self.frameread = 0 |
---|
15 | self.readsize = self.params.hopsize |
---|
16 | self.input = input |
---|
17 | self.filei = sndfile(self.input) |
---|
18 | self.srate = self.filei.samplerate() |
---|
19 | self.channels = self.filei.channels() |
---|
20 | self.params.step = float(self.params.hopsize)/float(self.srate) |
---|
21 | self.myvec = fvec(self.params.hopsize,self.channels) |
---|
22 | self.output = output |
---|
23 | |
---|
24 | def __call__(self): |
---|
25 | self.readsize = self.filei.read(self.params.hopsize,self.myvec) |
---|
26 | self.frameread += 1 |
---|
27 | |
---|
28 | def compute_all(self): |
---|
29 | """ Compute data """ |
---|
30 | mylist = [] |
---|
31 | while(self.readsize==self.params.hopsize): |
---|
32 | tmp = self() |
---|
33 | if tmp: |
---|
34 | mylist.append(tmp) |
---|
35 | if self.params.verbose: |
---|
36 | self.fprint(tmp) |
---|
37 | return mylist |
---|
38 | |
---|
39 | def fprint(self,foo): |
---|
40 | print foo |
---|
41 | |
---|
42 | def eval(self,results): |
---|
43 | """ Eval data """ |
---|
44 | pass |
---|
45 | |
---|
46 | def plot(self): |
---|
47 | """ Plot data """ |
---|
48 | pass |
---|
49 | |
---|
50 | def time(self): |
---|
51 | import time |
---|
52 | #print "CPU time is now %f seconds," % time.clock(), |
---|
53 | #print "task execution took %f seconds" % (time.time() - self.tic) |
---|
54 | return time.time() - self.tic |
---|
Note: See
TracBrowser
for help on using the repository browser.