timitphonemerec.py
def main():
  """ Further process and simplify standardized TIMIT. """

  description = main.__doc__
  formatter_class = argparse.ArgumentDefaultsHelpFormatter
  parser = argparse.ArgumentParser(description=description, formatter_class=formatter_class)
  parser.add_argument('--data_dir', type=str, default=DEFAULT_DATA_DIR,
                      help='''The standardized-TIMIT data directory.''')
  args = parser.parse_args()

  if not os.path.exists(args.data_dir):
    raise ValueError('%s does not exist. Did you run timit.py?' % args.data_dir)

  for name in ['train', 'val', 'test']:

    print('Processing and saving the %s set..' % name)

    pattern = os.path.join(args.data_dir, name, '*', '*.wav')
    prefixes = [path[:-4] for path in sorted(glob.glob(pattern))]
    audio_label_pairs = [_audio_and_labels(prefix) for prefix in prefixes]
    mfcc_label_pairs = [_mfcc_and_labels(*pair) for pair in audio_label_pairs]

    audio_seqs, label_seqs = zip(*audio_label_pairs)
    np.save(os.path.join(args.data_dir, name + '_audio.npy'), audio_seqs)
    np.save(os.path.join(args.data_dir, name + '_labels.npy'), label_seqs)

    mfcc_seqs, mfcc_label_seqs = zip(*mfcc_label_pairs)
    np.save(os.path.join(args.data_dir, name + '_mfcc.npy'), mfcc_seqs)
    np.save(os.path.join(args.data_dir, name + '_mfcc_labels.npy'), mfcc_label_seqs)
 Further process and simplify standardized TIMIT. 
Further process and simplify standardized TIMIT.
Further process and simplify standardized TIMIT .
def main():
  description = main.__doc__
  formatter_class = argparse.ArgumentDefaultsHelpFormatter
  parser = argparse.ArgumentParser(description=description, formatter_class=formatter_class)
  parser.add_argument('--data_dir', type=str, default=DEFAULT_DATA_DIR,
                      help='''The standardized-TIMIT data directory.''')
  args = parser.parse_args()
  if not os.path.exists(args.data_dir):
    raise ValueError('%s does not exist. Did you run timit.py?' % args.data_dir)
  for name in ['train', 'val', 'test']:
    print('Processing and saving the %s set..' % name)
    pattern = os.path.join(args.data_dir, name, '*', '*.wav')
    prefixes = [path[:-4] for path in sorted(glob.glob(pattern))]
    audio_label_pairs = [_audio_and_labels(prefix) for prefix in prefixes]
    mfcc_label_pairs = [_mfcc_and_labels(*pair) for pair in audio_label_pairs]
    audio_seqs, label_seqs = zip(*audio_label_pairs)
    np.save(os.path.join(args.data_dir, name + '_audio.npy'), audio_seqs)
    np.save(os.path.join(args.data_dir, name + '_labels.npy'), label_seqs)
    mfcc_seqs, mfcc_label_seqs = zip(*mfcc_label_pairs)
    np.save(os.path.join(args.data_dir, name + '_mfcc.npy'), mfcc_seqs)
    np.save(os.path.join(args.data_dir, name + '_mfcc_labels.npy'), mfcc_label_seqs)
def main ( ) : description = main . __doc__ formatter_class = argparse . ArgumentDefaultsHelpFormatter parser = argparse . ArgumentParser ( description = description , formatter_class = formatter_class ) parser . add_argument ( '--data_dir' , type = str , default = DEFAULT_DATA_DIR , help = '''The standardized-TIMIT data directory.''' ) args = parser . parse_args ( ) if not os . path . exists ( args . data_dir ) : raise ValueError ( '%s does not exist. Did you run timit.py?' % args . data_dir ) for name in [ 'train' , 'val' , 'test' ] : print ( 'Processing and saving the %s set..' % name ) pattern = os . path . join ( args . data_dir , name , '*' , '*.wav' ) prefixes = [ path [ : - 4 ] for path in sorted ( glob . glob ( pattern ) ) ] audio_label_pairs = [ _audio_and_labels ( prefix ) for prefix in prefixes ] mfcc_label_pairs = [ _mfcc_and_labels ( * pair ) for pair in audio_label_pairs ] audio_seqs , label_seqs = zip ( * audio_label_pairs ) np . save ( os . path . join ( args . data_dir , name + '_audio.npy' ) , audio_seqs ) np . save ( os . path . join ( args . data_dir , name + '_labels.npy' ) , label_seqs ) mfcc_seqs , mfcc_label_seqs = zip ( * mfcc_label_pairs ) np . save ( os . path . join ( args . data_dir , name + '_mfcc.npy' ) , mfcc_seqs ) np . save ( os . path . join ( args . data_dir , name + '_mfcc_labels.npy' ) , mfcc_label_seqs )
Further process and simplify standardized TIMIT.
Further process and simplify standardized TIMIT .
""" Further process and simplify standardized TIMIT. """