在 osx 上使用 xld 在命令行中拆分提示音频文件

splitting cued audio files in command line with xld on osx

我正在编写用于批处理音频文件的脚本,使用 xld。我想找到未拆分的专辑,拆分它们并使用适当的标签将它们转换为 flac。

find . -name "*.ape" -exec sh -c 'exec xld  "" -f flac' _ {} \;

此命令行正在将音频转换为 flac,但我必须在 xld 中添加“-c filename.cue”选项以使其拆分文件。

find . -name "*.ape" -exec sh -c 'exec echo | sed 's/.ape/.cue/'' _ {} ;

此命令行向我显示了 .cue 文件的路径

find . -name "*.ape" -exec sh -c 'exec xld "" -f flac -c | sed 's/.ape/.cue/'' _ {} ;

这个命令行不起作用,xld 说他没有找到 de cue 文件。我认为这只是一个语法问题。

感谢您的帮助

我不像往常那样在电脑前测试这个,但在 bash 中,您可以像这样替换变量的尾部:

thing="fred.ape"
echo ${thing/%.ape/.cue}
fred.cue

它被称为 “参数 substitution/expansion” 并通过示例进行解释 here

因此,基于此,您需要执行 bash 类似这样的操作:

find . -name "*.ape" -exec bash -c "xld  "" -f flac -c "${1/%.ape/.cue}"' _ {} \;

就我个人而言,我会像这样与 GNU Parallel 并行执行它们:

parallel xld {} -f flac -c {.}.cue ::: *.ape

您可以使用 homebrew 安装它:

brew install parallel