# move_all_bound_zerocross_from_shell.psc # Moves all boundaries in _IntervalTiers_ to the # nearest zero crossing # # Select a TextGrid + a Sound | Praat | Open and run this script # # 09.11.2005 John Tøndering (move_all_bound_zerocross.psc) # 21.06.2006 JT: Run from shell textgrid = selected ("TextGrid") sound = selected ("Sound") select textgrid numberOfTiers = Get number of tiers point_tiers = 0 for t to numberOfTiers int_tier = Is interval tier... t if int_tier = 0 point_tiers += 1 else select textgrid numberOfIntervals = Get number of intervals... t for i to numberOfIntervals end_grid = Get end point... t i select sound zero_cros = Get nearest zero crossing... end_grid select textgrid if i < numberOfIntervals if end_grid <> zero_cros if zero_cros > end_grid lab$ = Get label of interval... t i+1 Set interval text... t i+1 Insert boundary... t zero_cros Remove boundary at time... t end_grid Set interval text... t i+1 'lab$' else Insert boundary... t zero_cros Remove boundary at time... t end_grid endif endif endif endeditor endfor endif endfor if point_tiers > 0 clearinfo printline Please note: This script can't handle Point tiers ('point_tiers' in your TextGrid) endif