Skip to content

Instantly share code, notes, and snippets.

@SimZhou
Created January 20, 2023 03:46
Show Gist options
  • Save SimZhou/7eef2c79ca19e0f005864eddfeed686b to your computer and use it in GitHub Desktop.
Save SimZhou/7eef2c79ca19e0f005864eddfeed686b to your computer and use it in GitHub Desktop.
Bash script to convert all wav.ark from a wav.scp file into .wav
#!/bin/bash
speed=100
if [ $# != 2 ];then
echo "[ERROR] Usage: $0 wav.scp(archived) outdir" && exit 1
fi
wavscp=$1
outdir=$2
mkdir -p $outdir
i=0
while read line; do
utt=$(echo $line | cut -d " " -f 1)
ark_path=$(echo $line | cut -d " " -f 2)
wav-copy $ark_path ${outdir}/${utt}.wav &
i=$(($i+1));flag=$(($i%$speed));if [ $flag = 0 ]; then wait; fi
done < $wavscp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment