Praat对于undefined的取值

2023-11-22 13:48
文章标签 取值 undefined praat

本文主要是介绍Praat对于undefined的取值,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在提取基频值的时候有一些值是没有定义的,输出窗口显示undefinded,如果单纯把这个当成一个字符串是行不通的,比如pitchvalue="--undefined--",这是不可能的。字符串不可能等于数值,实现的方式是直接用pitchvalue=undefined,在这里的undefined相当于一个预定义常量。

例:声音文件和标注文件有一些偏差,比如标注文件都要比声音文件提前0.1-0.5秒,在实现的时候是通过声音的Pitch文件找到Pitch值不为undefined的第一个值,然后再将这个时长偏差减小0.3,作为起始的清音段,这样通过针对TextGrid的Shift操作就可以了。代码如下:

path$="\old\"
savePath$="\new\"
Create Strings as file list... fileList 'path$'*.wav
fileNumber=Get number of strings
for iFile from 1 to fileNumberselect Strings fileListfileName$=Get string... 'iFile'simpleName$=fileName$-".wav"wavFileName$=simpleName$+".wav"textGridName$=simpleName$+".TextGrid"Read from file... 'path$''textGridName$'labsil$=Get label of interval... 1 1if labsil$<>"sil"pause The first interval lab is NOT sil.elsetimeEnd=Get end point... 1 1endifRead from file... 'path$''wavFileName$'To Pitch... 0 60 600numberOfFrames=Get number of framesiFrame=0repeatiFrame=iFrame+1pitchValue=Get value in frame... 'iFrame' Hertzuntil pitchValue<>undefinedtime2=Get time from frame number... 'iFrame'if time2>timeEndselect TextGrid 'simpleName$'temp=time2-timeEnd-0.03Shift times by... tempendifselect TextGrid 'simpleName$'Save as text file... 'savePath$''textGridName$'select Sound 'simpleName$'Save as WAV file... 'savePath$''fileName$'select TextGrid 'simpleName$'plus Sound 'simpleName$'plus Pitch 'simpleName$'Remove
endfor
select Strings fileList
Removeexit over!

这篇关于Praat对于undefined的取值的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/410576

相关文章

vue 父组件调用子组件的方法报错,“TypeError: Cannot read property ‘subDialogRef‘ of undefined“

vue 父组件调用子组件的方法报错,“TypeError: Cannot read property ‘subDialogRef’ of undefined” 最近用vue做的一个界面,引入了一个子组件,在父组件中调用子组件的方法时,报错提示: [Vue warn]: Error in v-on handler: “TypeError: Cannot read property ‘methods

Java中Map取值转String Null值处理

Map<String, Object> 直接取值转String String value = (String)map.get("key") 当map.get(“key”)为Null值时会报错。 使用String类的valueOf静态方法可以解决这个问题 String value = String.valueOf(map.get("key"))

运行PHP程序时提示“Notice: Undefined index”的解决办法

最近在调试网站程序的时候,不知道怎么经常出现“Notice:Undefined index”的提示,程序又可以正常运行,就是看到这个提示感觉有点不爽,把模板搞乱了,经查其实这个不是错误,是警告。如果服务器不能改,那每个变量使用前应当先定义。怎么样解决呢?很多网友的说法不一致,程序不一样你也根本没办法照着解决,要是自己慢慢研究的话一大堆代码得半天试,在这里提供一个最简单有效经本人测试有效的办法给大家

uniapp微信小程序开发踩坑日记:Pinia持久化报错Cannot read property ‘localStorage‘ of undefined

插件默认使用 localStorage 实现持久化,小程序端不兼容,需要替换持久化 API import { defineStore } from 'pinia'   export const useCommonStore = defineStore('pack-store', {state: (): State => ({wwInfo: {},globalData: {},timerLoc

前段百科---JS中形如(function(window, undefined) {})(window)写法的理解

在Web开发过程中,往往会看到有人这样编写JS脚本: (function(window, undefined) {//do something})(window);可能有人会问: 卧槽,这是什么鬼? OK,且听我慢慢道来: 首先,(function(window, undefined) {})(window)可以简化看成这样()();而()()就是一个匿名函数自执行的写法.

struts 页面取值问题

Struts2中的OGNL表达式语言是对Xwork的OGNL的封装。我们要理解一下几点:  1 . Struts2 中将 ActionContext 作为 OGNL 的上下文环境( ActionContext 内部含有一个 Map 对象)   2 . Struts2 中的 OGNL 表达式语言的根对象是一个 ValueStack , ValueStack 中的每一

JavaScript学习(二):原始数据类型-字符串、数字、布尔值、null、undefined

数据类型 --- 能够表示并操作值的类型,编程语言的最基本特性就是能够支持多种数据类型。 JavaScript的数据类型分为两种: 原始类型 (primitive type)  对象类型(object type) 原始数据类型包括:  数字   字符串  布尔值   , 特殊的原始值:null  undefined,不是数字、字符串和布尔值,代表了各自特殊类型

js判断是否为null 空 undefined

A、判断变量是否为'' null undefined: if (null == modelType || 'undefined' == typeof(modelType) || '' == modelType) {return;} B、null undefined变量转换'': StringUtil.nullToString = function (str) {if (str ===

Cannot read property 'render' of undefined

Cannot read property 'render' of undefined 報錯, 本地和debug環境訪問正常 進行了以下排查 先查看了其他業務 訪問正常 排除全局性錯誤 推斷應該是引入組件的問題 斷點查看各個步驟下scope 發現了某個組件缺少模塊導出   參考 https://stackoverflow.com/questions/51021348/cannot-set-pr

localStorage存值取值以及存取JSON,以及基于html5 localStorage的购物车

localStorage.setItem("key","value");//存储变量名为key,值为value的变量       localStorage.key = "value"//存储变量名为key,值为value的变量       localStorage.getItem("key");//获取存储的变量key的值www.it165.net       localStorage.key