28 using namespace kaldi;
30 "Copy wave file or archives of wave files\n" 32 "Usage: wav-copy [options] <wav-rspecifier> <wav-wspecifier>\n" 33 " or: wav-copy [options] <wav-rxfilename> <wav-wxfilename>\n" 34 "e.g. wav-copy scp:wav.scp ark:-\n" 35 " wav-copy wav.ark:123456 -\n" 36 "See also: wav-to-duration extract-segments\n";
42 if (po.NumArgs() != 2) {
47 std::string wav_in_fn = po.GetArg(1),
48 wav_out_fn = po.GetArg(2);
55 if (in_is_rspecifier != out_is_wspecifier)
56 KALDI_ERR <<
"Cannot mix archives with regular files";
58 if (in_is_rspecifier) {
64 for (; !wav_reader.Done(); wav_reader.Next()) {
65 wav_writer.Write(wav_reader.Key(), wav_reader.Value());
68 KALDI_LOG <<
"Copied " << num_done <<
" wave files";
69 return (num_done != 0 ? 0 : 1);
72 Input ki(wav_in_fn, &binary);
73 Output ko(wav_out_fn, binary,
false);
75 if (!wh.
Read(ki.Stream())) {
84 }
catch(
const std::exception &e) {
85 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
bool Read(std::istream &is)
A templated class for writing objects to an archive or script file; see The Table concept...
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
WspecifierType ClassifyWspecifier(const std::string &wspecifier, std::string *archive_wxfilename, std::string *script_wxfilename, WspecifierOptions *opts)
std::string PrintableRxfilename(const std::string &rxfilename)
PrintableRxfilename turns the rxfilename into a more human-readable form for error reporting...
std::string PrintableWxfilename(const std::string &wxfilename)
PrintableWxfilename turns the wxfilename into a more human-readable form for error reporting...
static bool Write(std::ostream &os, bool binary, const T &t)