utils.py 文件源码

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

项目:basis_speech 作者: CPUFronz 项目源码 文件源码
def create_bfcr(filename):
    """Creates a BFCR instance for a given file.

    This helper function loads a label file and its corrosponding mgc file and
    creates a bfcr file from them. The paths of both files are determined
    automatically.

    :params filename: filename from which the BFCR instaces are created
    :returns: an instance of the BFCR class
    """
    filename = os.path.splitext(os.path.basename(filename))[0]

    label_file = LABEL_DIR + filename + '.lab'
    mgc_file = MGC_DIR + filename + '.mgc'

    mgc_matrix = np.fromfile(mgc_file, dtype=np.float32).reshape(-1, MGCORD+1)
    bfcr = BFCR(label_file)
    bfcr.encode_feature(mgc_matrix, 'mgc', NUM_BASES)
    return bfcr
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号