Skip to content

Instantly share code, notes, and snippets.

@weimeng23
Last active May 4, 2023 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weimeng23/dd409f5d003c5f3aac0deea6d699d267 to your computer and use it in GitHub Desktop.
Save weimeng23/dd409f5d003c5f3aac0deea6d699d267 to your computer and use it in GitHub Desktop.
kaldi command pipeline expression in python
delta_command = "compute-mfcc-feats --config=conf/mfcc.conf scp,p:wav_test.scp ark:- | add-deltas ark:- ark:- |"
delta_feats_rspecifier = (
f'ark:{delta_command}'
)
mfcc_command = "compute-mfcc-feats --config=conf/mfcc.conf scp,p:wav_test.scp ark:- |"
mfcc_feats_rspecifier = (
f'ark:{mfcc_command}'
)
mfcc_pitch_command = "compute-kaldi-pitch-feats --config=conf/pitch.conf scp,p:wav_test.scp ark:- | process-kaldi-pitch-feats ark:- ark:- |"
mfcc_pitch_feats_rspecifier = (
"ark,s,cs:"+mfcc_pitch_command
)
paste_command = f"paste-feats --length-tolerance=2 '{mfcc_feats_rspecifier}' '{mfcc_pitch_feats_rspecifier}' ark:- |"
paste_feats_rspecifier = (
"ark:"+paste_command
)
copy_command = f"copy-feats --compress=true \"{paste_feats_rspecifier}\" ark,scp:raw_mfcc_pitch.ark,raw_mfcc_pitch.scp"
copy_feats_rspecifier = (
copy_command
)
splice_command = f"splice-feats \"{paste_feats_rspecifier}\" ark:- |"
splice_feats_rspecifier = (
"ark:"+splice_command
)
trans_command = f"{splice_command} transform-feats model/final.mat ark:- ark:- |"
trans_feats_rspecifier = (
"ark,s,cs:"+trans_command
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment