如何将 Praat 脚本应用于音频文件?

喜悦

我正在尝试在 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)

如何wav使用 linux 命令行或 python将此脚本应用于没有 UI 的多个文件?

一般答案

你没有。您运行一个脚本,这完全取决于脚本的工作方式、工作对象、获取这些对象的位置、获取方式等。

因此,您始终必须查看如何应用特定脚本,这始终需要弄清楚该脚本如何需要其输入,以及如何达到这一点。

具体答案

您想要的脚本页面说

此命令对每个选定的声音 [执行某些操作]

所以第一件事就是打开你想要的文件并选择它们。

让我们假设您将使用足够少的声音来一次性打开它们。如果您正在处理大量声音文件,或者文件太大而无法保存在内存中,则必须将作业分成更小的块。

一种方法是使用包装脚本打开您的文件,选择它们,然后执行您想要的其他脚本:

# 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.praat

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何将 aviglitch 脚本应用于文件夹中的每个文件?

Praat脚本:如何提取彼此对应的不同层的间隔?

Praat脚本:如何为每个音节提取最大音调?

如何使用脚本获取或保存 praat 中的音调列表

如何将此 html 脚本应用于 jQuery?

如何将Google Apps脚本应用于gmail屏幕上的gmail邮件

如何将脚本应用于所有模态弹出窗口

如何将 Unity 脚本应用于多个图层?

如何将谷歌脚本应用于交替行?

将gawk脚本应用于文件夹中的多个文件

将脚本应用于Angular 2上的输入

将Greasemonkey脚本应用于chrome:// Firefox扩展

如何使用循环将awk脚本应用于一个文件夹中的多个文件

如何在Praat脚本中针对声音的特定部分运行“语音报告”?

如何将此脚本应用于Google表格中的整个列?

如何编写将内容脚本应用于单页应用程序的 chrome 扩展?

praat-合并多个WAV文件

如何有选择地将脚本应用于元素?

如何将文本应用于文本区域

如何将 Google 表格中的脚本应用于除两个特定选项卡之外的所有选项卡?

将多个Codemirror脚本应用于一个iframe

将时间戳脚本应用于 Google 表格中的多个标签

如何将browserify应用于gulp文件?

如何将意图应用于整个文件

如何将.patch文件应用于项目?

将TextGrid标签读入Praat中的Strings对象

如何将音频文件添加到Shell脚本

VBA-如何仅将范围内的脚本应用于包含特定值的行

如何将音频文件共享到多个应用程序