This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| KALDI_LOG << "R/W using kaldi Input/Output"; | |
| std::string input_wav_path = "data/ENG_M.wav"; | |
| WaveData input_wave; | |
| WaveHolder waveholder; | |
| Input ki(input_wav_path); | |
| waveholder.Read(ki.Stream()); | |
| input_wave = waveholder.Value(); | |
| cout<<"dur: "<<input_wave.Duration()<<" fs: "<<input_wave.SampFreq()<<endl; | |
| Matrix<BaseFloat> input_wave_mat = input_wave.Data(); | |
| int n_rows = input_wave_mat.NumRows(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void ReadWaveSpecifier(){ | |
| std::string wav_rspecifier = "scp:data/wav.scp"; | |
| SequentialTableReader<WaveHolder> wav_reader(wav_rspecifier); | |
| for (; !wav_reader.Done(); wav_reader.Next()){ | |
| std::string key = wav_reader.Key(); | |
| WaveData wave_data = wav_reader.Value(); | |
| cout << "wav_spec dur: "<<wave_data.Duration()<<endl; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int ReadOpts(int argc, char* argv[]){ | |
| try { | |
| const char *usage = "test options parser"; | |
| kaldi::ParseOptions po(usage); | |
| bool use_i = false; | |
| po.Register("use-i", &use_i, "use i bool"); | |
| po.Read(argc, argv); | |
| cout<<po.NumArgs()<<endl; | |
| if (po.NumArgs() != 1) { | |
| po.PrintUsage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd kaldi/tools || exit 1; | |
| if [ -d kaldi_lm ]; then | |
| echo Not installing the kaldi_lm toolkit since it is already there. | |
| else | |
| echo Downloading and installing the kaldi_lm tools | |
| if [ ! -f kaldi_lm.tar.gz ]; then | |
| wget http://www.danielpovey.com/files/kaldi/kaldi_lm.tar.gz || exit 1; | |
| fi | |
| tar -xvzf kaldi_lm.tar.gz || exit 1; | |
| cd kaldi_lm |