Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -194,6 +194,8 @@ class default_process(object): · 193 unmodified lines | |||
| 194 | name = type(self).__name__.split('_')[1] | 194 | name = type(self).__name__.split('_')[1] |
| 195 | optstr = ' '.join(['running', name, 'with options', repr(self.options), '\n']) | 195 | optstr = ' '.join(['running', name, 'with options', repr(self.options), '\n']) |
| 196 | sys.stderr.write(optstr) | 196 | sys.stderr.write(optstr) |
| 197 | def flush(self, n_frames, samplerate): | ||
| 198 | pass | ||
| 197 | 199 | ||
| 198 | class process_onset(default_process): | 200 | class process_onset(default_process): |
| 199 | valid_opts = ['method', 'hop_size', 'buf_size', 'samplerate'] | 201 | valid_opts = ['method', 'hop_size', 'buf_size', 'samplerate'] |
| @@ -265,6 +267,9 @@ class process_notes(default_process): · 65 unmodified lines | |||
| 265 | fmt_out = "%f\t" % lastmidi | 267 | fmt_out = "%f\t" % lastmidi |
| 266 | fmt_out += self.time2string(frames_read, samplerate) | 268 | fmt_out += self.time2string(frames_read, samplerate) |
| 267 | sys.stdout.write(fmt_out) # + '\t') | 269 | sys.stdout.write(fmt_out) # + '\t') |
| 270 | def flush(self, frames_read, samplerate): | ||
| 271 | eof = self.time2string(frames_read, samplerate) | ||
| 272 | sys.stdout.write(eof + '\n') | ||
| 268 | 273 | ||
| 269 | class process_mfcc(default_process): | 274 | class process_mfcc(default_process): |
| 270 | def __init__(self, args): | 275 | def __init__(self, args): |
| @@ -350,11 +355,8 @@ def main(): · 79 unmodified lines | |||
| 350 | frames_read += read | 355 | frames_read += read |
| 351 | # exit loop at end of file | 356 | # exit loop at end of file |
| 352 | if read < a_source.hop_size: break | 357 | if read < a_source.hop_size: break |
| 353 | # special case for notes | 358 | # flush the processor if needed |
| 354 | if args.command == 'notes': | 359 | processor.flush(frames_read, a_source.samplerate) |
| 355 | eof = processor.time2string(frames_read, a_source.samplerate) | ||
| 356 | sys.stdout.write(eof + '\n') | ||
| 357 | sys.stdout.flush() | ||
| 358 | if args.verbose > 1: | 360 | if args.verbose > 1: |
| 359 | fmt_string = "read {:.2f}s" | 361 | fmt_string = "read {:.2f}s" |
| 360 | fmt_string += " ({:d} samples in {:d} blocks of {:d})" | 362 | fmt_string += " ({:d} samples in {:d} blocks of {:d})" |