def test_point_process_io(self): '''Tests for reading/writing point processes''' fn = "bobby.PointProcess" inputFN = join(self.dataRoot, fn) outputFN = join(self.outputRoot, fn) pp = dataio.open1DPointObject(inputFN) pp.save(outputFN) self.assertTrue(areTheSame(inputFN, outputFN, dataio.open1DPointObject))
def test_point_process_io(self): '''Tests for reading/writing point processes''' fn = "bobby.PointProcess" inputFN = join(self.dataRoot, fn) outputFN = join(self.outputRoot, fn) pp = dataio.open1DPointObject(inputFN) pp.save(outputFN) self.assertTrue(areTheSame(inputFN, outputFN, dataio.open1DPointObject))
def getPulses(praatEXE, inputWavFN, outputPointTierFN, minPitch, maxPitch, scriptFN=None): if scriptFN is None: scriptFN = join(utils.scriptsPath, "get_pulses.praat") argList = [inputWavFN, outputPointTierFN, minPitch, maxPitch] utils.runPraatScript(praatEXE, scriptFN, argList) # Load the output pointObj = dataio.open1DPointObject(outputPointTierFN) return pointObj
def getPulses(praatEXE, inputWavFN, outputPointTierFN, minPitch, maxPitch, scriptFN=None): ''' Gets the pitch/glottal pulses for an audio file. http://www.fon.hum.uva.nl/praat/manual/Sound___Pitch__To_PointProcess__peaks____.html ''' if scriptFN is None: scriptFN = join(utils.scriptsPath, "get_pulses.praat") argList = [inputWavFN, outputPointTierFN, minPitch, maxPitch] utils.runPraatScript(praatEXE, scriptFN, argList) # Load the output pointObj = dataio.open1DPointObject(outputPointTierFN) return pointObj
def getPulses(praatEXE, inputWavFN, outputPointTierFN, minPitch, maxPitch, scriptFN=None): ''' Gets the pitch/glottal pulses for an audio file. http://www.fon.hum.uva.nl/praat/manual/Sound___Pitch__To_PointProcess__peaks____.html ''' if scriptFN is None: scriptFN = join(utils.scriptsPath, "get_pulses.praat") argList = [inputWavFN, outputPointTierFN, minPitch, maxPitch] utils.runPraatScript(praatEXE, scriptFN, argList) # Load the output pointObj = dataio.open1DPointObject(outputPointTierFN) return pointObj
''' Praatio example for extracting points in a PointProcess for the vowels specified in a textgrid ''' import os from os.path import join from praatio import tgio from praatio import dataio path = join(".", "files") outputPath = join(path, "point_process_output") if not os.path.exists(outputPath): os.mkdir(outputPath) tg = tgio.openTextgrid(join(path, "bobby_phones.TextGrid")) pp = dataio.open1DPointObject(join(path, "bobby.PointProcess")) newPoints = [] tier = tg.tierDict["phone"] for start, stop, label in tier.entryList: if label.lower()[0] not in ["a", "e", "i", "o", "u"]: continue newPoints.extend([pp.getPointsInInterval(start, stop), ]) outputPP = dataio.PointObject1D(newPoints, dataio.POINT, pp.minTime, pp.maxTime) outputPP.save(join(outputPath, "bobby_vowels.PointProcess"))