def to_wav(infile, outfile): return subprocess.call([get_binary('ffmpeg'), '-loglevel', 'panic', '-i', infile, '-ac', '1', '-ar', '8000', '-acodec', 'pcm_s16le', outfile])
'''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
'''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)
def to_wav(infile, outfile): return subprocess.call([ get_binary('ffmpeg'), '-loglevel', 'panic', '-i', infile, '-ac', '1', '-ar', '8000', '-acodec', 'pcm_s16le', outfile ])