1

I am currently trying to extract the delta + delta-delta using add-deltas binary file provided by kaldi. But for some reason i am not able to extract it.

I usually extract power spectrum using the make_spectrum.sh script. I modified it a bit to also include deltas, but the output doesn't to be any different to the one received without the delta part..

What am i doing wrong?

$cmd JOB=1:$nj $logdir/spect_${name}.JOB.log \
    compute-spectrogram-feats --frame-length=25 --frame-shift=10 --verbose=2 \
     scp,p:$logdir/wav_spect_${name}.JOB.scp ark:- \| \
    copy-feats --compress=$compress $write_num_frames_opt ark:- \
      ark,scp:$specto_dir/raw_spectogram_$name.JOB.ark,$specto_dir/raw_spectogram_$name.JOB.scp \| \
      add-deltas ark:- ark,scp:$specto_dir/raw_spectogram_$name.JOB.ark,$specto_dir/raw_spectogram_$name.JOB.scp \
Loser
  • 67
  • 8

1 Answers1

2

The output of every command in a pipe is passed to the next command. There is no way to write the output to a file and pass it to the next command in the same time. You are trying to write data in compress-feats and in the same time you are trying to pass it to the add-deltas.

You can not write both raw and delta feats with a single command. Either you write deltas without writing raw passing stdout of compute-feats to add-deltas:

$cmd JOB=1:$nj $logdir/spect_${name}.JOB.log \
    compute-spectrogram-feats --frame-length=25 --frame-shift=10 --verbose=2 \
      scp,p:$logdir/wav_spect_${name}.JOB.scp ark:- \| 
    add-deltas ark:- ark,scp:$specto_dir/delta_spectogram_$name.JOB.ark,$specto_dir/delta_spectogram_$name.JOB.scp

Or run two jobs:

$cmd JOB=1:$nj $logdir/spect_${name}.JOB.log \
    compute-spectrogram-feats --frame-length=25 --frame-shift=10 --verbose=2 \
     scp,p:$logdir/wav_spect_${name}.JOB.scp ark:- \| \
    copy-feats --compress=$compress $write_num_frames_opt ark:- \
      ark,scp:$specto_dir/raw_spectogram_$name.JOB.ark,$specto_dir/raw_spectogram_$name.JOB.scp

$cmd JOB=1:$nj $logdir/spect_${name}_deltas.JOB.log \
      add-deltas scp:$specto_dir/raw_spectogram_$name.JOB.scp ark,scp:$specto_dir/delta_spectogram_$name.JOB.ark,$specto_dir/delta_spectogram_$name.JOB.scp \

It is possible to do tricks with named pipes to combine those two in a single command, but I would not recommend that. It is more straightforward to simply run the single job above

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • Thanks for the help. That indeed solved my problem.. I do have a side question regarding how the information is stored.. Which ones are the deltas and which are the delta deltas? – Loser Feb 09 '17 at 13:02
  • 2
    first are spectrum, middle is delta, last are delta-deltas – Nikolay Shmyrev Feb 09 '17 at 13:13
  • Spectrums are stored in the raw_spectogram_$name.JOB. The deltas are are in the delta_spectogram_$name.JOB. So i am not sure i understand what you mean by first, middle and last?.. Spectrum and delta are in seperate files.. – Loser Feb 09 '17 at 13:54
  • Deltas files also include spectrum on index 0-255 (or whatever fft dim do you have). Add-deltas add deltas to the spectrum, not replace it writes deltas. – Nikolay Shmyrev Feb 09 '17 at 14:30
  • It don't seem that adding the function add-deltas changed anything. I just tried diffing both files (delta_spectogram_$name.JOB and raw_spectogram_$name.JOB) and both seem to have the same input according to this diff: http://pastebin.com/U45S8B7i – Loser Feb 09 '17 at 16:45