audio.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:zignal 作者: ronnyandersson 项目源码 文件源码
def pretty_string_samples(self, idx_start=0, idx_end=20, precision=4, header=False):
        s = ''
        if header:
            t = '  '
            u = 'ch'
            for i in range(self.ch):
                t += '-------:'
                u += '  %2i   :' %(i+1)
            t += '\n'
            u += '\n'

            s += t  #   -------:-------:-------:
            s += u  # ch   1   :   2   :   3   :
            s += t  #   -------:-------:-------:

        s += np.array_str(self.samples[idx_start:idx_end,:],
                          max_line_width=260,   # we can print 32 channels before linewrap
                          precision=precision,
                          suppress_small=True)
        if (idx_end-idx_start) < self.nofsamples:
            s  = s[:-1] # strip the right ']' character
            s += '\n ...,\n'
            lastlines = np.array_str(self.samples[-3:,:],
                                     max_line_width=260,
                                     precision=precision,
                                     suppress_small=True)
            s += ' %s\n' %lastlines[1:] # strip first '['
        return s
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号