我试图在Colab中用穹窿更改音频文件的praat。我找到了做这个的脚本,这是代码和计算程序的代码。我安装了praat
!sudo apt-get update -y -qqq --fix-missing && apt-get install -y -qqq praat > /dev/null
!wget -qqq http://www.praatvocaltoolkit.com/downloads/plugin_VocalToolkit.zip
!unzip -qqq /content/plugin_VocalToolkit.zip > /dev/null
with open('/content/script.praat', 'w') as f:
f.write(r"""writeInfoLine: preferencesDirectory$""")
!praat /content/script.praat
/root/.praat-dir
!mv /content/plugin_VocalToolkit/* /root/.praat-dir
!praat --version
Praat 6.0.37 (February 3 2018)如何使用linux命令行或python将此脚本应用于多个没有UI的wav文件?
发布于 2020-04-03 21:08:48
一般答案
不需要。你运行一个脚本,这完全取决于脚本如何工作,它在什么对象上工作,这些对象在哪里被获取,它们是如何获取的,等等。
因此,您必须始终关注如何应用特定的脚本,而这总是需要弄清楚该脚本如何需要它的输入,以及如何达到这个目的。
具体答案
您想要的脚本的页面上写着
此命令对每个选定的声音执行一些操作
所以第一件事是打开你想要的文件并选择它们。
让我们假设您将使用足够多的声音一次打开它们。如果您正在处理大量声音文件或内存中无法保存的文件,则必须将作业分批到较小的块中。
要做到这一点,一种方法是使用包装器脚本打开文件,选择它们并执行您想要的另一个脚本:
# Get a list of all your files
files = Create Strings as file list: "list", "/some/path/*.wav"
total_files = Get number of strings
# Open each of them
for i to total_files
selectObject: files
filename$ = Get string: i
sounds[i] = Read from file: "/some/path/" + filename$
endfor
# Clear the selection
nocheck selectObject(undefined)
# Add each sound to your selection
for i to total_files
plusObject: sounds[i]
endfor
# Run your script
runScript: path_to_script$, ...
# where the ... is the list of arguments your script expects
# In your specific case, it would be something like
runScript: preferencesDirectory$ + "/plugin_VocalToolkit/changeformants.praat",
... 500, 1500, 2500, 0, 0, 5500, "yes", "yes"
# ,-´ ,-´ ,--´ ,--´ ,-´ ^ ^ ^
# New F1, F2, F3, F4, and F5 means | | |
# Max formant | |
# Process only voiced parts |
# Retrieve intensity contour
# Do something with whatever the script gives you我的Praat相当生疏,但这至少应该让您知道该做什么(免责声明:我没有运行上述任何一个,但概念应该是好的)。
使用存储在某处的“包装器”脚本,您可以从命令行执行它:
$ praat /path/to/wrapper.praathttps://stackoverflow.com/questions/61019222
复制相似问题