Changeset 70762c5 for python/lib
- Timestamp:
- Sep 14, 2017, 1:17:54 PM (7 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- 8a3acad
- Parents:
- b24c909
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/cmd.py
rb24c909 r70762c5 119 119 # quiet subcommand 120 120 subparser = subparsers.add_parser('quiet', 121 help=' ')121 help='extract timestamps of quiet and loud regions') 122 122 parser_add_input(subparser) 123 123 parser_add_hop_size(subparser) … … 210 210 return "%f\t" % (1000. * n_frames / float(samplerate)) 211 211 212 def samples2samples(n_frames, samplerate):212 def samples2samples(n_frames, _samplerate): 213 213 return "%d\t" % n_frames 214 214 … … 272 272 def __call__(self, block): 273 273 return self.onset(block) 274 def repr_res(self, res, frames_read, samplerate):274 def repr_res(self, res, _frames_read, samplerate): 275 275 if res[0] != 0: 276 276 outstr = self.time2string(self.onset.get_last(), samplerate) … … 303 303 def __call__(self, block): 304 304 return self.tempo(block) 305 def repr_res(self, res, frames_read, samplerate):305 def repr_res(self, res, _frames_read, samplerate): 306 306 if res[0] != 0: 307 307 outstr = self.time2string(self.tempo.get_last(), samplerate) … … 312 312 super(process_tempo, self).__init__(args) 313 313 self.beat_locations = [] 314 def repr_res(self, res, frames_read, samplerate):314 def repr_res(self, res, _frames_read, samplerate): 315 315 if res[0] != 0: 316 316 self.beat_locations.append(self.tempo.get_last_s()) … … 401 401 valid_opts = ['hop_size', 'silence'] 402 402 self.parse_options(args, valid_opts) 403 self.issilence = None404 403 self.wassilence = 1 405 404 … … 410 409 def __call__(self, block): 411 410 if aubio.silence_detection(block, self.silence) == 1: 412 if self.wassilence == 1: 413 self.issilence = 1 414 else: 415 self.issilence = 2 416 self.wassilence = 1 411 if self.wassilence != 1: 412 self.wassilence = 1 413 return 2 # newly found silence 414 return 1 # silence again 417 415 else: 418 if self.wassilence == 0: 419 self.issilence = 0 420 else: 421 self.issilence = -1 422 self.wassilence = 0 416 if self.wassilence != 0: 417 self.wassilence = 0 418 return -1 # newly found noise 419 return 0 # noise again 423 420 424 421 def repr_res(self, res, frames_read, samplerate): 425 422 fmt_out = None 426 if self.issilence== -1:423 if res == -1: 427 424 fmt_out = "NOISY: " 428 if self.issilence== 2:425 if res == 2: 429 426 fmt_out = "QUIET: " 430 427 if fmt_out is not None:
Note: See TracChangeset
for help on using the changeset viewer.