Example #1
0
toTGFN = join(outputPath, "angrier_rocket.TextGrid")
fromPitchRegions = f0_morph.getPitchForIntervals(fromPitchTier.pointList,
                                                 fromTGFN, tierName)
toPitchRegions = f0_morph.getPitchForIntervals(toPitchTier.pointList, toTGFN,
                                               tierName)

print(fromPitchRegions)
print(toPitchRegions)
# # ########
# # # STEP 4: Run the morph process
f0_morph.f0Morph(fromWavFN=join(inputPath, "You are crazy.wav"),
                 pitchPath=outputPath,
                 stepList=stepList,
                 outputName="CRAZY ROCKET ANGRY",
                 doPlotPitchSteps=False,
                 fromPitchData=fromPitchRegions,
                 toPitchData=toPitchRegions,
                 outputMinPitch=minPitch,
                 outputMaxPitch=maxPitch,
                 praatEXE=praatEXE,
                 keepPitchRange=False,
                 keepAveragePitch=False)
#
pitch_and_intensity.extractPitchTier(
    join(outputPath, "f0_resynthesized_wavs",
         "neutral_to_happy_with_morph_0.wav"),
    join(outputPath, "neutral_to_happy_with_morph_0.PitchTier"),
    praatEXE,
    minPitch,
    maxPitch,
    forceRegenerate=True)
Example #2
0
# 2ND remove intensity values
fromPitch = [(time, pitch) for time, pitch, _ in fromPitch]
toPitch = [(time, pitch) for time, pitch, _ in toPitch]

# 3RD select which sections to align.
# We'll use textgrids for this purpose.
tierName = "PhonAlign"
fromPitch = f0_morph.getPitchForIntervals(fromPitch, fromTGFN, tierName)
toPitch = f0_morph.getPitchForIntervals(toPitch, toTGFN, tierName)

# FINALLY: Run the morph process
f0_morph.f0Morph(fromWavFN=join(root, fromWavFN),
                 pitchPath=root,
                 stepList=stepList,
                 outputName="%s_%s_f0_morph" % (fromName, toName),
                 doPlotPitchSteps=True,
                 fromPitchData=fromPitch,
                 toPitchData=toPitch,
                 outputMinPitch=minPitch,
                 outputMaxPitch=maxPitch,
                 praatEXE=praatEXE)

####################
# The remaining examples below demonstrate the use of
# f0_morph.f0Morph() with different arguments.  It may
# be helpful for your work.  However, you can safely comment
# out or delete the code below to keep things simple.
####################

# Or for more control over the steps:
stepList = [
    0.10,
                                              maxPitch, forceRegenerate=False)
fromPitchList = [(time, pitch) for time, pitch, _ in fromPitchList]

# Load in the target pitch contour
pitchTier = dataio.open2DPointObject(join(root, toPitchFN))
toPitchList = [(time, pitch) for time, pitch in pitchTier.pointList]

# The target contour doesn't contain enough sample points, so interpolate
# over the provided samples
# (this step can be skipped if there are enough sample points--a warning
# will be issued if there are any potential problems)
toPitchList = interpolation.quadraticInterpolation(toPitchList, 4, 1000, 0)

# 3rd select which sections to align.
# We'll use textgrids for this purpose.
tierName = "PhonAlign"
fromPitch = f0_morph.getPitchForIntervals(fromPitchList, fromTGFN, tierName)
toPitch = f0_morph.getPitchForIntervals(toPitchList, fromTGFN, tierName)

# Run the morph process
f0_morph.f0Morph(fromWavFN=join(root, fromWavFN),
                 pitchPath=root,
                 stepList=stepList,
                 outputName="%s_%s_f0_morph" % (fromName, toName),
                 doPlotPitchSteps=True,
                 fromPitchData=fromPitch,
                 toPitchData=toPitch,
                 outputMinPitch=minPitch,
                 outputMaxPitch=maxPitch,
                 praatEXE=praatEXE)
                                              maxPitch, forceRegenerate=False)
fromPitchList = [(time, pitch) for time, pitch, _ in fromPitchList]

# Load in the target pitch contour
pitchTier = dataio.open2DPointObject(join(root, toPitchFN))
toPitchList = [(time, pitch) for time, pitch in pitchTier.pointList]

# The target contour doesn't contain enough sample points, so interpolate
# over the provided samples
# (this step can be skipped if there are enough sample points--a warning
# will be issued if there are any potential problems)
toPitchList = interpolation.quadraticInterpolation(toPitchList, 4, 1000, 0)

# 3rd select which sections to align.
# We'll use textgrids for this purpose.
tierName = "PhonAlign"
fromPitch = f0_morph.getPitchForIntervals(fromPitchList, fromTGFN, tierName)
toPitch = f0_morph.getPitchForIntervals(toPitchList, fromTGFN, tierName)

# Run the morph process
f0_morph.f0Morph(fromWavFN=join(root, fromWavFN),
                 pitchPath=root,
                 stepList=stepList,
                 outputName="%s_%s_f0_morph" % (fromName, toName),
                 doPlotPitchSteps=True,
                 fromPitchData=fromPitch,
                 toPitchData=toPitch,
                 outputMinPitch=minPitch,
                 outputMaxPitch=maxPitch,
                 praatEXE=praatEXE)
Example #5
0
fromPitch = [(time, pitch) for time, pitch, _ in fromPitch]
toPitch = [(time, pitch) for time, pitch, _ in toPitch]

# 3RD select which sections to align.
# We'll use textgrids for this purpose.
tierName = "PhonAlign"
fromPitch = f0_morph.getPitchForIntervals(fromPitch, fromTGFN, tierName)
toPitch = f0_morph.getPitchForIntervals(toPitch, toTGFN, tierName)

# FINALLY: Run the morph process
f0_morph.f0Morph(
    fromWavFN=join(root, fromWavFN),
    pitchPath=root,
    stepList=stepList,
    outputName="%s_%s_f0_morph" % (fromName, toName),
    doPlotPitchSteps=True,
    fromPitchData=fromPitch,
    toPitchData=toPitch,
    outputMinPitch=minPitch,
    outputMaxPitch=maxPitch,
    praatEXE=praatEXE,
)


####################
# The remaining examples below demonstrate the use of
# f0_morph.f0Morph() with different arguments.  It may
# be helpful for your work.  However, you can safely comment
# out or delete the code below to keep things simple.
####################