我试图用静音替代某些声音选择,但是在进入基本部分之前,“能够从间隔获取标签”命令在我能够检查是否获得正确的输出之前失败了。 / p>
Error Message I've Got on Praat
我以为我播放的玩具音频存在一些问题,所以每次我总是陷入序列中的第三个间隔时,我就切换到了另一个,但很奇怪。屏幕截图可在此处获取:
The Third Interval was Strangely not Available
我现在使用的代码非常简单,如下所示: 我如何处理标记为“声音”的间隔可能存在问题,但它与我在这里得到的错误无关。
soundname$ = chooseReadFile$: "Open a sound file"
sound = Read from file: soundname$
gridname$ = chooseReadFile$: "Select the corresponding TextGrid file."
grid = Read from file: gridname$
tier = 1
soundEnd = Get total duration
numOfIntervals = Get number of intervals: tier
writeInfoLine: "Number of Intervals:", numOfIntervals
appendInfoLine: "**** Starting to Replace Selected Sounds... ****"
for interval from 1 to numOfIntervals
appendInfoLine: "Interval#", interval
label$ = Get label of interval: tier, interval
appendInfoLine: "Interval#", interval, ": ", label$
if label$ == "sounding"
startTime = Get starting point: tier, interval
endTime = Get end point: tier, interval
newSilence = Create Sound from formula: "new_silence", 1, startTime, endTime, 44100, ~ 0
before = Extract part: 0, startTime, "rectangular", 1, "no"
after = Extract part: endTime, soundEnd, "rectangular", 1, "no"
selectObject: before, newSilence, after
new = Concatenate
Write to WAV file... "new".wav
removeObject: before, newSilence, after
endif
endfor
appendInfoLine: "Finish!"
我怀疑是由于编辑的缘故,TextGrid发生了一些变化-但是,由于我只用相同长度的静音取代了声音,因此以后不应对声音或TextGrid产生影响。但是,由于我从来没有机会输出一些可播放的音频结果,因此我上面的推论无法得到可靠的事实的证实。
非常感谢您的关注和提前帮助!