Changeset 5ab3c4e for python/lib


Ignore:
Timestamp:
Mar 23, 2017, 3:09:28 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
Children:
bd72039
Parents:
6288806
Message:

python/lib/aubio/cmd.py: add a flush function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/aubio/cmd.py

    r6288806 r5ab3c4e  
    195195            optstr = ' '.join(['running', name, 'with options', repr(self.options), '\n'])
    196196            sys.stderr.write(optstr)
     197    def flush(self, n_frames, samplerate):
     198        pass
    197199
    198200class process_onset(default_process):
     
    266268            fmt_out += self.time2string(frames_read, samplerate)
    267269            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')
    268273
    269274class process_mfcc(default_process):
     
    351356                # exit loop at end of file
    352357                if read < a_source.hop_size: break
    353             # special case for notes
    354             if args.command == 'notes':
    355                 eof = processor.time2string(frames_read, a_source.samplerate)
    356                 sys.stdout.write(eof + '\n')
    357                 sys.stdout.flush()
     358            # flush the processor if needed
     359            processor.flush(frames_read, a_source.samplerate)
    358360            if args.verbose > 1:
    359361                fmt_string = "read {:.2f}s"
Note: See TracChangeset for help on using the changeset viewer.