def main():

    args = parser.parse_args()
    htk_save_path = mkdir(args.htk_save_path)
    path = Path(data_path=args.data_path,
                config_path=args.config_path)

    # HTK settings
    save_config(audio_file_type='nist',
                feature_type=args.feature_type,
                channels=args.channels,
                config_save_path='./config',
                sampling_rate=16000,
                window=args.window,
                slide=args.slide,
                energy=bool(args.energy),
                delta=bool(args.delta),
                deltadelta=bool(args.deltadelta))
    # NOTE: 123-dim features are extracted by default

    for data_type in ['train', 'dev', 'test']:

        wav_paths = path.wav(data_type=data_type)
        save_path = mkdir_join(htk_save_path, data_type)

        with open('./config/wav2htk_' + data_type + '.scp', 'w') as f:
            for wav_path in wav_paths:
                speaker = wav_path.split('/')[-2]
                utt_index = basename(wav_path).split('.')[0]
                save_path_tmp = mkdir_join(
                    save_path, speaker, utt_index + '.htk')
                f.write(wav_path + '  ' + save_path_tmp + '\n')
"""Test for input data (TIMIT corpus)."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import sys
import unittest

sys.path.append('../../')
from timit.path import Path
from timit.input_data import read_audio
from utils.measure_time_func import measure_time

path = Path(data_path='/n/sd8/inaguma/corpus/timit/data',
            config_path='../config',
            htk_save_path='/n/sd8/inaguma/corpus/timit/htk')

htk_paths = {
    'train': path.htk(data_type='train'),
    'dev': path.htk(data_type='dev'),
    'test': path.htk(data_type='test')
}

wav_paths = {
    'train': path.wav(data_type='train'),
    'dev': path.wav(data_type='dev'),
    'test': path.wav(data_type='test')
}

CONFIG = {
Beispiel #3
0
parser.add_argument('--save_format', type=str, choices=['numpy', 'htk', 'wav'])

parser.add_argument('--feature_type', type=str, choices=['fbank', 'mfcc'])
parser.add_argument('--channels', type=int,
                    help='the number of frequency channels')
parser.add_argument('--window', type=float,
                    help='window width to extract features')
parser.add_argument('--slide', type=float, help='extract features per slide')
parser.add_argument('--energy', type=int, help='if 1, add the energy feature')
parser.add_argument('--delta', type=int, help='if 1, add the energy feature')
parser.add_argument('--deltadelta', type=int,
                    help='if 1, double delta features are also extracted')

args = parser.parse_args()
path = Path(data_path=args.data_path,
            config_path=args.config_path,
            htk_save_path=args.htk_save_path)

CONFIG = {
    'feature_type': args.feature_type,
    'channels': args.channels,
    'sampling_rate': 16000,
    'window': args.window,
    'slide': args.slide,
    'energy': bool(args.energy),
    'delta': bool(args.delta),
    'deltadelta': bool(args.deltadelta)
}

if args.save_format == 'htk':
    assert args.tool == 'htk'
Beispiel #4
0
"""Test for phone-level transcript (TIMIT corpus)."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import sys
import unittest

sys.path.append('../../')
from timit.path import Path
from timit.transcript_phone import read_phone
from utils.measure_time_func import measure_time
from utils.util import mkdir_join

path = Path(data_path='/n/sd8/inaguma/corpus/timit/data',
            config_path='../config')

label_paths = {
    'train': path.phone(data_type='train'),
    'dev': path.phone(data_type='dev'),
    'test': path.phone(data_type='test')
}


class TestLabelPhone(unittest.TestCase):
    def test(self):

        self.check()

    @measure_time
    def check(self):