コード例 #1
0
ファイル: serve.py プロジェクト: saisus/gentle
def to_wav(infile, outfile):
    return subprocess.call([get_binary('ffmpeg'),
                     '-loglevel', 'panic',
                     '-i', infile,
                     '-ac', '1', '-ar', '8000',
                     '-acodec', 'pcm_s16le',
                     outfile])
コード例 #2
0
ファイル: standard_kaldi.py プロジェクト: leo23/gentle
'''Glue code for communicating with standard_kaldi C++ process'''
import json
import logging
import os
import subprocess
import wave

from gentle import ffmpeg, prons
from gentle.paths import get_binary
from gentle.rpc import RPCProtocol

EXECUTABLE_PATH = get_binary("ext/standard_kaldi")

class Kaldi(object):
    '''Kaldi spawns a standard_kaldi subprocess and provides a
    Python wrapper for communicating with it.'''
    def __init__(
            self,
            nnet_dir='data/nnet_a_gpu_online',
            hclg_path='data/graph/HCLG.fst',
            proto_langdir='PROTO_LANGDIR'):
        self.proto_langdir = proto_langdir
        devnull = open(os.devnull, 'w')
        cmd = [EXECUTABLE_PATH, nnet_dir, hclg_path, proto_langdir]
        self._subprocess = subprocess.Popen(
            cmd,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=devnull)

        self._transitions = None
コード例 #3
0
'''Glue code for communicating with standard_kaldi C++ process'''
import json
import logging
import os
import subprocess
import tempfile
import wave

from gentle import ffmpeg, prons
from gentle.paths import get_binary
from gentle.rpc import RPCProtocol

EXECUTABLE_PATH = get_binary("ext/standard_kaldi")

class Kaldi(object):
    '''Kaldi spawns a standard_kaldi subprocess and provides a
    Python wrapper for communicating with it.'''
    def __init__(
            self,
            nnet_dir='data/nnet_a_gpu_online',
            hclg_path='data/graph/HCLG.fst',
            proto_langdir='PROTO_LANGDIR'):
        self.proto_langdir = proto_langdir
        devnull = open(os.devnull, 'w')
        cmd = [EXECUTABLE_PATH, nnet_dir, hclg_path, proto_langdir]
        self._subprocess = subprocess.Popen(
            cmd,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=devnull)
コード例 #4
0
ファイル: serve.py プロジェクト: soumith/gentle
def to_wav(infile, outfile):
    return subprocess.call([
        get_binary('ffmpeg'), '-loglevel', 'panic', '-i', infile, '-ac', '1',
        '-ar', '8000', '-acodec', 'pcm_s16le', outfile
    ])