Esempio n. 1
0
 def test_getMorphParameters(self):
     filterFunc = None
     includeUnlabeledRegions = False
     duration_morph.getMorphParameters(self.fromTGFN,
                                       self.toTGFN,
                                       self.tierName,
                                       filterFunc,
                                       includeUnlabeledRegions)
Esempio n. 2
0
    def test_textgridManipulateDuration(self):
        filterFunc = None
        includeUnlabeledRegions = False
        durationParams = duration_morph.getMorphParameters(
            self.fromTGFN, self.toTGFN, self.tierName, filterFunc,
            includeUnlabeledRegions)

        duration_morph.outputMorphTextgrids(
            self.fromTGFN, durationParams, [
                1,
            ], join(self.root, "outputName.TextGrid"))
Esempio n. 3
0
 def test_textgridManipulateDuration(self):
     filterFunc = None
     includeUnlabeledRegions = False
     durationParams = duration_morph.getMorphParameters(self.fromTGFN,
                                                        self.toTGFN,
                                                        self.tierName,
                                                        filterFunc,
                                                        includeUnlabeledRegions)
     
     duration_morph.outputMorphTextgrids(self.fromTGFN,
                                         durationParams,
                                         [1, ],
                                         join(self.root,
                                              "outputName.TextGrid"))
Esempio n. 4
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
Esempio n. 5
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
tierName = "PhonAlign"

fromTGFN = join(root, fromName + ".TextGrid")
toTGFN = join(root, toName + ".TextGrid")

outputPath = join(root, "duration_morph")
outputName = "%s_%s_dur_morph" % (fromName, toName)
outputTG = join(outputPath, "%s.TextGrid" % outputName)
outputImageFN = join(outputPath, "%s.png" % outputName)
filterFunc = None
includeUnlabeledRegions = False

# Morph the duration from one file to another
durationParams = duration_morph.getMorphParameters(fromTGFN,
                                                   toTGFN,
                                                   tierName,
                                                   filterFunc,
                                                   includeUnlabeledRegions)
duration_morph.changeDuration(fromWavFN,
                              durationParams,
                              stepList,
                              outputName,
                              outputMinPitch=minPitch,
                              outputMaxPitch=maxPitch,
                              praatEXE=praatEXE)

# Increase duration of all segments by 20 percent
twentyPercentMore = lambda x: (x * 1.20)
outputName = "%s_20_percent_more" % fromName
outputTG = join(outputPath, "%s.TextGrid" % outputName)
outputImageFN = join(outputPath, "%s.png" % outputName)
tierName = "PhonAlign"

fromTGFN = join(root, fromName + ".TextGrid")
toTGFN = join(root, toName + ".TextGrid")

outputPath = join(root, "duration_morph")
utils.makeDir(outputPath)
outputName = "%s_%s_dur_morph" % (fromName, toName)
outputTG = join(outputPath, "%s.TextGrid" % outputName)
outputImageFN = join(outputPath, "%s.png" % outputName)
filterFunc = None
includeUnlabeledRegions = False

# Morph the duration from one file to another
durationParams = duration_morph.getMorphParameters(fromTGFN, toTGFN, tierName,
                                                   filterFunc,
                                                   includeUnlabeledRegions)
morphedTG = duration_morph.textgridMorphDuration(fromTGFN, toTGFN)
morphedTG.save(outputTG)
duration_morph.changeDuration(fromWavFN,
                              durationParams,
                              stepList,
                              outputName,
                              outputMinPitch=minPitch,
                              outputMaxPitch=maxPitch,
                              praatEXE=praatEXE)

# Increase duration of all segments by 20 percent
twentyPercentMore = lambda x: (x * 1.20)
outputName = "%s_20_percent_more" % fromName
outputTG = join(outputPath, "%s.TextGrid" % outputName)
Esempio n. 8
0
 def test_getMorphParameters(self):
     filterFunc = None
     includeUnlabeledRegions = False
     duration_morph.getMorphParameters(self.fromTGFN, self.toTGFN,
                                       self.tierName, filterFunc,
                                       includeUnlabeledRegions)