Exemple #1
0
    def test_changeDuration(self):
        filterFunc = None
        includeUnlabeledRegions = False
        durationParams = duration_morph.getMorphParameters(
            self.fromTGFN, self.toTGFN, self.tierName, filterFunc,
            includeUnlabeledRegions)

        stepList = morph_utils.generateStepList(3)
        outputName = "mary1_dur_morph"
        # praatEXE = r"C:\Praat.exe"  # Windows
        praatEXE = "/Applications/Praat.app/Contents/MacOS/Praat"  # Mac
        try:
            duration_morph.changeDuration(self.fromWavFN,
                                          durationParams,
                                          stepList,
                                          outputName,
                                          outputMinPitch=self.minPitch,
                                          outputMaxPitch=self.maxPitch,
                                          praatEXE=praatEXE)
        except utils.FileNotFound:
            pass
Exemple #2
0
    def test_changeDuration(self):
        filterFunc = None
        includeUnlabeledRegions = False
        durationParams = duration_morph.getMorphParameters(self.fromTGFN,
                                                           self.toTGFN,
                                                           self.tierName,
                                                           filterFunc,
                                                           includeUnlabeledRegions)

        stepList = morph_utils.generateStepList(3)
        outputName = "mary1_dur_morph"
        # praatEXE = r"C:\Praat.exe"  # Windows
        praatEXE = "/Applications/Praat.app/Contents/MacOS/Praat"  # Mac
        try:
            duration_morph.changeDuration(self.fromWavFN,
                                          durationParams,
                                          stepList,
                                          outputName,
                                          outputMinPitch=self.minPitch,
                                          outputMaxPitch=self.maxPitch,
                                          praatEXE=praatEXE)
        except utils.FileNotFound:
            pass
import os
from os.path import join

from praatio import pitch_and_intensity

from promo import f0_morph
from promo.morph_utils import utils

# Define the arguments for the code
root = os.path.abspath(join('.', 'files'))
praatEXE = r"C:\Praat.exe"  # Windows path
#praatEXE = "/Applications/Praat.app/Contents/MacOS/Praat"  # Mac path

minPitch = 50
maxPitch = 350
stepList = utils.generateStepList(3)

fromName = "mary1"
toName = "mary2"
fromWavFN = fromName + ".wav"
toWavFN = toName + ".wav"

fromPitchFN = fromName + ".txt"
toPitchFN = toName + ".txt"

fromTGFN = join(root, os.path.splitext(fromWavFN)[0] + ".TextGrid")
toTGFN = join(root, os.path.splitext(toWavFN)[0] + ".TextGrid")

# Prepare the data for morphing
# 1ST load it into memory
fromPitch = pitch_and_intensity.audioToPI(root,
from praatio import dataio

from promo import f0_morph
from promo.morph_utils import utils
from promo.morph_utils import interpolation


# Define the arguments for the code

root = join('.', 'files')
praatEXE = r"C:\Praat.exe"  # Windows paths
praatEXE = "/Applications/Praat.app/Contents/MacOS/Praat"  # Mac paths

minPitch = 50
maxPitch = 350
stepList = utils.generateStepList(3)

fromName = "mary1"
fromWavFN = fromName + ".wav"
fromPitchFN = fromName + ".txt"
fromTGFN = join(root, fromName + ".TextGrid")

toName = "mary1_stylized"
toPitchFN = toName + ".PitchTier"

# Prepare the data for morphing
# 1st load it into memory
fromPitchList = pitch_and_intensity.audioToPI(root, fromWavFN, root,
                                              fromPitchFN, praatEXE, minPitch,
                                              maxPitch, forceRegenerate=False)
fromPitchList = [(time, pitch) for time, pitch, _ in fromPitchList]