如何从 praatscript 打开 praat
how to open praat from a praatscript
我想允许 praatscript 打开 praat 对象行。这将允许我打开 praat,然后自动允许脚本将对象加载到对象 window.
例如脚本
run_something.praat 1.wav 1.TextGrid 0.1 0.2
可以打开 praat 然后在音频文件“1.wav”中打开编辑器到 0.1 和 0.2 <这对我来说很容易做到
我无法事先打开 praat 来插入我需要的东西。
现在我的脚本如下所示:
form Info
text Sound
text Textgrid
real Start
real End
endform
if sound$ != "" and textgrid$ != ""
Read from file: sound$
Read Strings from raw text file: textgrid$
@read_lab()
selectObject: 1, 3
View & Edit
editor = 3
editor: editor
Select: start , end
Zoom to selection
endeditor
endif
当然会告诉我View 和Edit 不工作,因为GUI 没有打开。我不能使用环境,因为它必须在 windows 和 linux
上工作
您可以使用 --open
选项启动 Praat 以...打开您想要的文件。这将以 GUI 模式启动 Praat,并打开指定的文件(and/or 脚本):
praat --open sound.wav annotation.TextGrid script.praat
但是如果你想以编程方式向 Praat 实例发出命令(= 不点击任何东西),你可能必须使用 sendpraat,它应该可以在 Praat 所在的所有平台上使用运行s.
请注意,该页面中的编译说明至少对于 Linux 来说有点过时:我能够在我的机器上使用
进行编译
gcc -std=gnu99 -o sendpraat -DSTAND_ALONE -DUNIX \
`pkg-config --cflags gtk+-2.0 glib-2.0` \
sendpraat.c \
`pkg-config --libs gtk+-2.0 glib-2.0`
随着 sendpraat 的可用,您必须启动一个 Praat 的 GUI 实例,但是您喜欢,然后,在一个单独的语句中,发送您的脚本的执行:
sendpraat 0 praat \
'runScript: "path/to/your/script", "1.wav", "1.TextGrid", 0.1, 0.2'
Instructions for using sendpraat 可在 Praat 手册中找到。第一个参数是以秒为单位的超时(=die if action is not completed by then),然后是程序的名称,然后是顺序为 运行 的命令列表。
据我所知,没有直接的方法来 运行 一个脚本,一步就可以打开 Praat 的 GUI 版本 and Praat 的那个实例执行一个命令。但我可能错了。
对于那些正在为 sendpraat 苦苦挣扎的人:
尝试:
sendpraat praat 'execute "pathtoyourscript"'
我想允许 praatscript 打开 praat 对象行。这将允许我打开 praat,然后自动允许脚本将对象加载到对象 window.
例如脚本
run_something.praat 1.wav 1.TextGrid 0.1 0.2
可以打开 praat 然后在音频文件“1.wav”中打开编辑器到 0.1 和 0.2 <这对我来说很容易做到
我无法事先打开 praat 来插入我需要的东西。
现在我的脚本如下所示:
form Info
text Sound
text Textgrid
real Start
real End
endform
if sound$ != "" and textgrid$ != ""
Read from file: sound$
Read Strings from raw text file: textgrid$
@read_lab()
selectObject: 1, 3
View & Edit
editor = 3
editor: editor
Select: start , end
Zoom to selection
endeditor
endif
当然会告诉我View 和Edit 不工作,因为GUI 没有打开。我不能使用环境,因为它必须在 windows 和 linux
上工作您可以使用 --open
选项启动 Praat 以...打开您想要的文件。这将以 GUI 模式启动 Praat,并打开指定的文件(and/or 脚本):
praat --open sound.wav annotation.TextGrid script.praat
但是如果你想以编程方式向 Praat 实例发出命令(= 不点击任何东西),你可能必须使用 sendpraat,它应该可以在 Praat 所在的所有平台上使用运行s.
请注意,该页面中的编译说明至少对于 Linux 来说有点过时:我能够在我的机器上使用
进行编译gcc -std=gnu99 -o sendpraat -DSTAND_ALONE -DUNIX \
`pkg-config --cflags gtk+-2.0 glib-2.0` \
sendpraat.c \
`pkg-config --libs gtk+-2.0 glib-2.0`
随着 sendpraat 的可用,您必须启动一个 Praat 的 GUI 实例,但是您喜欢,然后,在一个单独的语句中,发送您的脚本的执行:
sendpraat 0 praat \
'runScript: "path/to/your/script", "1.wav", "1.TextGrid", 0.1, 0.2'
Instructions for using sendpraat 可在 Praat 手册中找到。第一个参数是以秒为单位的超时(=die if action is not completed by then),然后是程序的名称,然后是顺序为 运行 的命令列表。
据我所知,没有直接的方法来 运行 一个脚本,一步就可以打开 Praat 的 GUI 版本 and Praat 的那个实例执行一个命令。但我可能错了。
对于那些正在为 sendpraat 苦苦挣扎的人:
尝试:
sendpraat praat 'execute "pathtoyourscript"'