【问题标题】:Pitch modification in praatpraat中的音高修改
【发布时间】:2013-12-14 19:29:53
【问题描述】:

我想在 wav 文件的两个不同部分修改音高。为此,我从 wav 文件的相应 textgrid 文件中获得了开始时间和结束时间的信息。是否可以在两个部分修改音高。

【问题讨论】:

    标签: praat


    【解决方案1】:

    您可以使用Manipulation 对象对原始声音的音高进行任何更改。

    # Original sound made of three consecutive notes
    snd[1] = Create Sound as pure tone: "A", 1, 0, 0.3, 44100, 220, 0.2, 0.01, 0.01
    snd[2] = Create Sound as pure tone: "B", 1, 0, 0.3, 44100, 247, 0.2, 0.01, 0.01
    snd[3] = Create Sound as pure tone: "C", 1, 0, 0.3, 44100, 277, 0.2, 0.01, 0.01
    
    selectObject(snd[1], snd[2], snd[3])
    sound = Concatenate
    Rename: "original"
    
    removeObject(snd[1], snd[2], snd[3])
    
    selectObject(sound)
    Play
    
    # We will invert the pitch, so that the notes play in the opposite direction
    manipulation = To Manipulation: 0.01, 200, 300
    pitchtier = Extract pitch tier
    
    # We copy it because we want to modify it, not create one from scratch
    # and we want to be able to read the values of the original from somewhere
    original = Copy: "old"
    points = Get number of points
    
    # This for loop looks at the values of the original pitch tier and writes them
    # onto the new pitch tier
    for p to points
      selectObject(original)
      f = Get value at index: points - p + 1
      t = Get time from index: p
    # If you uncomment the if block, the changes will only affect the first and last
    # quarter of the sound
    #  if t < 0.25 or t > 0.75
        selectObject(pitchtier)
        Remove point: p
        Add point: t, f
    #  endif
    endfor
    
    # We replace the pitch tier
    selectObject(pitchtier, manipulation)
    Replace pitch tier
    
    # Resynthesize
    selectObject(manipulation)
    new_sound = Get resynthesis (overlap-add)
    
    # And clean up
    removeObject(original, pitchtier, manipulation)
    selectObject(new_sound)
    Rename: "modified"
    Play 
    

    您可以通过在不同时间添加具有不同音高值(以赫兹为单位)的点来更改音高等级,当您进行重新合成时,Praat 将修改原始值,使其与您指定的值匹配。

    在您的情况下,您可以使用TextGrid 中的时间值来了解何时需要添加修改后的PitchTier 点,而无需考虑其余部分。你也可以像这样操纵持续时间。

    在示例中,脚本将原始音高层中每个点的值更改为倒序的点值,以便第一个点具有最后一个点的值。 for 中的 if 块是将这些更改限制在音高层子集的一种方式,但是如何执行此操作将取决于您尝试进行的更改类型。

    【讨论】:

    • 是的,我正在这样做。我这样做的方式如下:在wav文件中有3个部分----1----2---3---我想修改1和3而不修改2。对于每个部分说1,我正在提取pitchtier并对其进行修改并用新的pitchtier替换以前的pitchtier。同样,我也在为第 3 部分做这件事。但我的问题是我可以同时修改这两个部分。
    • 我不明白。这三个部分是分开的声音吗?或者它们是单个对象的不同部分(例如开头、中间和结尾)? “同时”是什么意思?
    • 不,这三个部分属于同一个wav文件。是的!它们是单个对象的不同部分。所以,做音高修改。每次我必须提取单独的pitchtier并继续用原始的替换它们。这是一种稳健的做法吗?
    • 您不需要为每个部分提取一次音高层。这样做可能更可取,具体取决于您要进行的更改,但您可以提取一次,对您有兴趣更改的部分进行更改,然后使用 Manipulation 对象一次性应用所有更改。我编辑了我的答案以举一个例子,但确切的过程将取决于你在做什么。
    • 同样的技术也可以用于强度修改!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-22
    • 2019-03-01
    • 1970-01-01
    • 2012-06-14
    • 1970-01-01
    • 1970-01-01
    • 2013-09-12
    相关资源
    最近更新 更多