source: python/aubio/task/silence.py @ 6107f4c

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 6107f4c was 13c3fba, checked in by Paul Brossier <piem@altern.org>, 19 years ago

splitting up tasks in many files
splitting up tasks in many files

  • Property mode set to 100644
File size: 715 bytes
Line 
1from aubio.task.task import task
2from aubio.aubioclass import *
3
4class tasksilence(task):
5        wassilence = 1
6        issilence  = 1
7        def __call__(self):
8                task.__call__(self)
9                if (aubio_silence_detection(self.myvec(),self.params.silence)==1):
10                        if self.wassilence == 1: self.issilence = 1
11                        else: self.issilence = 2
12                        self.wassilence = 1
13                else: 
14                        if self.wassilence <= 0: self.issilence = 0
15                        else: self.issilence = -1 
16                        self.wassilence = 0
17                if self.issilence == -1:
18                        return max(self.frameread-self.params.delay,0.), -1
19                elif self.issilence == 2:
20                        return max(self.frameread+self.params.delay,0.), 2 
21
22        def fprint(self,foo):
23                print self.params.step*foo[0],
24                if foo[1] == 2: print "OFF"
25                else: print "ON"
26
27
28
Note: See TracBrowser for help on using the repository browser.