Skip to content

Instantly share code, notes, and snippets.

@donghee
Last active December 25, 2024 12:18
Show Gist options
  • Save donghee/7da2c3f99ad7fb29e358923e9273ef6e to your computer and use it in GitHub Desktop.
Save donghee/7da2c3f99ad7fb29e358923e9273ef6e to your computer and use it in GitHub Desktop.
Prefare CSTR VCTK Corpus for SadTalker
#!/bin/bash
# 변환할 디렉토리 설정 (기본값은 현재 디렉토리)
DIR="${1:-.}"
rm -rf ./wav24_silence_trimmed
mkdir -p ./wav24_silence_trimmed
# *_mic1 FLAC 파일을 찾아 24kHz WAV로 변환
find "$DIR" -type f -name "*_mic1.flac" | while read -r file; do
# 출력 파일명 설정 (확장자 변경)
output="${file%_mic1.flac}.wav"
output=$(echo $output | sed 's/wav48_silence_trimmed/wav24_silence_trimmed/g')
echo "WAV 파일로 변환 중: $file -> $output"
# sox를 사용하여 변환 (48kHz에서 24kHz로 다운샘플링)
mkdir -p $(dirname "$output")
sox "$file" -r 24000 "$output"
done
echo "모든 변환이 완료되었습니다."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment