Changeset 6288806 for python


Ignore:
Timestamp:
Mar 23, 2017, 3:03:29 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:
5ab3c4e
Parents:
53fbd58
Message:

python/lib/aubio/cmd.py: simplify repr_res

File:
1 edited

Legend:

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

    r53fbd58 r6288806  
    215215    def __call__(self, block):
    216216        return self.onset(block)
    217     def repr_res(self, res, frames_read, a_source):
     217    def repr_res(self, res, frames_read, samplerate):
    218218        if res[0] != 0:
    219             outstr = self.time2string(self.onset.get_last(), a_source.samplerate)
     219            outstr = self.time2string(self.onset.get_last(), samplerate)
    220220            sys.stdout.write(outstr + '\n')
    221221
     
    232232    def __call__(self, block):
    233233        return self.pitch(block)
    234     def repr_res(self, res, frames_read, a_source):
    235         fmt_out = self.time2string(frames_read, a_source.samplerate)
     234    def repr_res(self, res, frames_read, samplerate):
     235        fmt_out = self.time2string(frames_read, samplerate)
    236236        sys.stdout.write(fmt_out + "%.6f\n" % res[0])
    237237
     
    244244    def __call__(self, block):
    245245        return self.tempo(block)
    246     def repr_res(self, res, frames_read, a_source):
     246    def repr_res(self, res, frames_read, samplerate):
    247247        if res[0] != 0:
    248             outstr = self.time2string(self.tempo.get_last(), a_source.samplerate)
     248            outstr = self.time2string(self.tempo.get_last(), samplerate)
    249249            sys.stdout.write(outstr + '\n')
    250250
     
    257257    def __call__(self, block):
    258258        return self.notes(block)
    259     def repr_res(self, res, frames_read, a_source):
     259    def repr_res(self, res, frames_read, samplerate):
    260260        if res[2] != 0: # note off
    261             fmt_out = self.time2string(frames_read, a_source.samplerate)
     261            fmt_out = self.time2string(frames_read, samplerate)
    262262            sys.stdout.write(fmt_out + '\n')
    263263        if res[0] != 0: # note on
    264264            lastmidi = res[0]
    265265            fmt_out = "%f\t" % lastmidi
    266             fmt_out += self.time2string(frames_read, a_source.samplerate)
     266            fmt_out += self.time2string(frames_read, samplerate)
    267267            sys.stdout.write(fmt_out) # + '\t')
    268268
     
    284284        fftgrain = self.pv(block)
    285285        return self.mfcc(fftgrain)
    286     def repr_res(self, res, frames_read, a_source):
    287         fmt_out = self.time2string(frames_read, a_source.samplerate)
     286    def repr_res(self, res, frames_read, samplerate):
     287        fmt_out = self.time2string(frames_read, samplerate)
    288288        fmt_out += ' '.join(["% 9.7f" % f for f in res.tolist()])
    289289        sys.stdout.write(fmt_out + '\n')
     
    309309        fftgrain = self.pv(block)
    310310        return self.filterbank(fftgrain)
    311     def repr_res(self, res, frames_read, a_source):
    312         fmt_out = self.time2string(frames_read, a_source.samplerate)
     311    def repr_res(self, res, frames_read, samplerate):
     312        fmt_out = self.time2string(frames_read, samplerate)
    313313        fmt_out += ' '.join(["% 9.7f" % f for f in res.tolist()])
    314314        sys.stdout.write(fmt_out + '\n')
     
    346346                # print results for this block
    347347                if args.verbose > 0:
    348                     processor.repr_res(res, frames_read, a_source)
     348                    processor.repr_res(res, frames_read, a_source.samplerate)
    349349                # increment total number of frames read
    350350                frames_read += read
Note: See TracChangeset for help on using the changeset viewer.