# Path: abkhazia/utils/config.py
# class AbkhaziaConfig(object):
#     def default_config_file(name='abkhazia'):
#     def __init__(self, config_file=None):


import collections
import contextlib
import os
import shlex
import shutil
import subprocess
import wave
import joblib
from . import config

def flac2wav(flac, wav):
    """Convert a flac file to the wav format

    'flac' must be an existing flac file
    'wav' is the filename of the created file

    """
    try:
        subprocess.check_output(shlex.split('which sox'))
    except:
        raise OSError('sox is not installed on your system')

    command = ('sox -c 1 -b 16 {} -t wav {} rate 16k'
               .format(flac, wav))

    subprocess.call(shlex.split(command))


def sph2wav(sph, wav):
    """Convert a sph file to the wav format

    'sph' must be an existing sph file
    'wav' if the filename of the created file

    sph2pipe is required for converting sph to wav. This function look
    at it in the abkhazia configuration file.

    """
    sph2pipe = os.path.join(

# Path: abkhazia/utils/config.py
# class AbkhaziaConfig(object):
#     def default_config_file(name='abkhazia'):
#     def __init__(self, config_file=None):


# Path: abkhazia/utils/wav.py
import collections
import contextlib
import os
import shlex
import shutil
import subprocess
import wave
import joblib
from . import config


def flac2wav(flac, wav):
    """Convert a flac file to the wav format

    'flac' must be an existing flac file
    'wav' is the filename of the created file

    """
    try:
        subprocess.check_output(shlex.split('which sox'))
    except:
        raise OSError('sox is not installed on your system')

    command = ('sox -c 1 -b 16 {} -t wav {} rate 16k'
               .format(flac, wav))

    subprocess.call(shlex.split(command))


def sph2wav(sph, wav):
    """Convert a sph file to the wav format

    'sph' must be an existing sph file
    'wav' if the filename of the created file

    sph2pipe is required for converting sph to wav. This function look
    at it in the abkhazia configuration file.

    """
    sph2pipe = os.path.join(

        config.config.get('kaldi', 'kaldi-directory'),