SOX和多种音频文件的音调变化 [英] Sox and pitch change of multiple audio files
问题描述
我想在我有充分的音乐文件夹来改变音调,用袜,每一个MP3的。我在bash写了这个:
I want to change pitch, using sox, of every mp3 in every music folder I have. I wrote this in bash:
function pitch_mp3 {
for mp3 in /home/mp3s/*/*.mp3
do
cd "$(dirname "$mp3")"
output=$(basename "$mp3" .mp3)PITCHED.mp3
sox -S "$mp3" -C 192 "$output" pitch 50
done
}
它增加了球场上,例如01song.mp3和输出文件01songPITCHED.mp3。
但是,什么情况是,萨班斯法案做的工作第一次,但随后经过文件夹循环再次增加,并已投MP3-S间距,所以它们的文件名竟然是01songPITCHEDPITCHED.mp3。我停了下来,当我注意到了,所以我不知道这是否会增加间距第三次等等。
It adds the pitch to for example 01song.mp3 and the output file is 01songPITCHED.mp3. But what happens is that sox do the job first time, but then goes again cycling through the folders and add pitch to already pitched mp3-s, so they file name turned out to be 01songPITCHEDPITCHED.mp3. I stopped it when I noticed, so I don't know if it is going to add pitch for the third time etc..
为什么,以及如何解决这一问题?
Why and how to fix this?
推荐答案
如果您只是想跳过与 PITCHED.mp3
结束我会用一个case语句的任何文件
If you just want to skip any file ending with PITCHED.mp3
I would use a case statement
case "$mp3" in
*PITCHED.mp3)
echo skipping "$mp3"
;;
*)
#repitch as before
;;
esac
这篇关于SOX和多种音频文件的音调变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!