• 沒有找到結果。

HCopy

在文檔中 The HTK Book (頁 197-200)

14.3 HCopy

14.3.1 Function

This program will copy one or more data files to a designated output file, optionally converting the data into a parameterised form. While the source files can be in any supported format, the output format is always HTK. By default, the whole of the source file is copied to the target but options exist to only copy a specified segment. Hence, this program is used to convert data files in other formats to the HTK format, to concatenate or segment data files, and to parameterise the result.

If any option is set which leads to the extraction of a segment of the source file rather than all of it, then segments will be extracted from all source files and concatenated to the target.

Labels will be copied/concatenated if any of the options indicating labels are specified (-i -l -x -G -I -L -P -X). In this case, each source data file must have an associated label file, and a target label file is created. The name of the target label file is the root name of the target data file with the extension .lab, unless the -X option is used. This new label file will contain the appropriately copied/truncated/concatenated labels to correspond with the target data file; all start and end boundaries are recalculated if necessary.

When used in conjunction with HSLab, HCopy provides a facility for tasks such as cropping silence surrounding recorded utterances. Since input files may be coerced, HCopy can also be used to convert the parameter kind of a file, for example from WAVEFORM to MFCC, depending on the configuration options. Not all possible conversions can actually be performed; see Table14.1 for a list of valid conversions. Conversions must be specified via a configuration file as described in chapter 5. Note also that the parameterisation qualifier N cannot be used when saving files to disk, and is meant only for on-the-fly parameterisation.

14.3.2 Use

HCopy is invoked by typing the command line

HCopy [options] sa1 [ + sa2 + ... ] ta [ sb1 [ + sb2 + ... ] tb ... ]

This causes the contents of the one or more source files sa1, sa2, . . . to be concatenated and the result copied to the given target file ta. To avoid the overhead of reinvoking the tool when processing large databases, multiple sources and targets may be specified, for example

HCopy srcA.wav + srcB.wav tgtAB.wav srcC.wav tgtD.wav

will create two new files tgtAB.wav and tgtD.wav. HCopy takes file arguments from a script specified using the -S option exactly as from the command line, except that any newlines are ignored.

The allowable options to HCopy are as follows where all times and durations are given in 100 ns units and are written as floating-point numbers.

-a i Use level i of associated label files with the -n and -x options. Note that this is not the same as using the TRANSLEVEL configuration variable since the -a option still allows all levels to be copied through to the output files.

-e f End copying from the source file at time f. The default is the end of the file. If f is negative or zero, it is interpreted as a time relative to the end of the file, while a positive value indicates an absolute time from the start of the file.

-i mlf Output label files to master file mlf.

-l s Output label files to the directory s. The default is to output to the current directory.

-m t Set a margin of duration t around the segments defined by the -n and -x options.

-n i [j] Extract the speech segment corresponding to the i’th label in the source file. If j is specified, then the segment corresponding to the sequence of labels i to j is extracted. Labels are numbered from their position in the label file. A negative index can be used to count from the end of the label list. Thus, -n 1 -1 would specify the segment starting at the first label and ending at the last.

-s f Start copying from the source file at time f. The default is 0.0, ie the beginning of the file.

14.3 HCopy 192

-t n Set the line width to n chars when formatting trace output.

-x s [n] Extract the speech segment corresponding to the first occurrence of label s in the source file. If n is specified, then the n’th occurrence is extracted. If multiple files are being con-catenated, segments are extracted from each file in turn, and the label must exist for each concatenated file.

-F fmt Set the source data format to fmt.

-G fmt Set the label file format to fmt.

-I mlf This loads the master label file mlf. This option may be repeated to load several MLFs.

-L dir Search directory dir for label files (default is to search current directory).

-O fmt Set the target data format to fmt.

-P fmt Set the target label format to fmt.

-X ext Set label file extension to ext (default is lab).

HCopy also supports the standard options -A, -C, -D, -S, -T, and -V as described in section4.4.

Note that the parameter kind conversion mechanisms described in chapter 5will be applied to all source files. In particular, if an automatic conversion is requested via the configuration file, then HCopy will copy or concatenate the converted source files, not the actual contents. Similarly, automatic byte swapping may occur depending on the source format and the configuration variable BYTEORDER. Because the sampling rate may change during conversions, the options that specify a position within a file i.e. -s and -e use absolute times rather than sample index numbers. All times in HTK are given in units of 100ns and are written as floating-point numbers. To save writing long strings of zeros, standard exponential notation may be used, for example -s 1E6 indicates a start time of 0.1 seconds from the beginning of the file.

Outputs L

W P D

A C M I

V L E I E S

E P P R F L C

F R S E M B S U R

O L E T E F A P S E

R P F R F C N E E T

Inputs M C C A C C K C R E

WAVEFORM

LPC

LPREFC

LPCEPSTRA

IREFC

MFCC

FBANK

MELSPEC

USER

DISCRETE

Table. 14.1 Valid Parameter Conversions

Note that truncations are performed after any desired coding, which may result in a loss of time resolution if the target file format has a lower sampling rate. Also, because of windowing effects, truncation, coding, and concatenation operations are not necessarily interchangeable. If in doubt, perform all truncation/concatenation in the waveform domain and then perform parameterisation as a last, separate invocation of HCopy.

14.3 HCopy 193

14.3.3 Trace Output

HCopy supports the following trace options where each trace flag is given using an octal base 00001 basic progress reporting.

00002 source and target file formats and parameter kinds.

00004 segment boundaries computed from label files.

00010 display memory usage after processing each file.

Trace flags are set using the -T option or the TRACE configuration variable.

在文檔中 The HTK Book (頁 197-200)