createsoundclip.praat

来自「编辑视频文件」· PRAAT 代码 · 共 53 行

PRAAT
53
字号
## script that takes a filename, a selection begin time and a selection end time as arguments and creates a clip based on the time informationform Segment info	text Filename ""	positive Start 1	positive End 10endform# create a new file name by inserting "_begintime_endtime" just before the file extension# printline 'filename$'len = length( filename$)# printline 'len'dot = rindex (filename$, ".")# printline 'dot'slash = rindex (filename$, "/")if slash == 0	slash = rindex (filename$, "\")endifstem$ = mid$ (filename$ , slash+1, dot - slash - 1 )# printline 'stem$'s = start / 1000en = end / 1000prefix$ = left$(filename$, dot - 1)suffix$ = right$(filename$, len - dot + 1)# printline 'prefix$'# printline 'suffix$'nextfilename$ = "'prefix$'" + "_" + "'start'" + "_" + "'end'" + "'suffix$'"nextstem$ = "'stem$'" + "_" + "'start'" + "_" + "'end'"# printline 'nextfilename$'# printline 'nextstem$'# extract the selectionOpen long sound file... 'filename$'## next 3 lines extract the selection as mono file...#select LongSound 'stem$'#Extract part... s en no#Write to WAV file... 'nextfilename$'# extract the selection, stereo, but depends on the LongSound View (limits the duration of the selection)Vieweditor LongSound 'stem$'	Select... 's' 'en'	Zoom to selection	Write sound selection to WAV file... 'nextfilename$'endeditorselect LongSound 'stem$'Remove## add the new file to the object lisRead from file... 'nextfilename$'Editeditor Sound 'nextstem$'endeditor

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?