Difference between revisions of "Guide to lab computing"

From Phonlab
Jump to navigationJump to search
Line 9: Line 9:
 
#!/usr/bin/env python
 
#!/usr/bin/env python
   
# Measure formants. Read input textgrids, call ifcformant on associated audio file,
+
# Measure formants. Read & input textgrids, call ifcformant on associated audio file,
 
# and output measurements to a .meas file.
 
# and output measurements to a .meas file.
   
Line 22: Line 22:
 
# arguments.
 
# arguments.
 
try:
 
try:
if not (sys.argv[1] == 'male' or
+
if not (sys.argv[1] == 'male&' &
 
sys.argv[1] == 'female' or
 
sys.argv[1] == 'female' or
 
sys.argv[1] == 'child'): raise
 
sys.argv[1] == 'child'): raise

Revision as of 11:34, 8 October 2013

All Lab workstations automatically mount shared disk space as the guest user. This shared space is often referred to as the PDrive since it is mounted as drive letter P: on Windows.

Sample scripts

  • meas_formants -- a python script for reading a Praat textgrid and performing formant analysis on vowel tokens


#!/usr/bin/env python

# Measure formants. Read & input textgrids, call ifcformant on associated audio file,
# and output measurements to a .meas file.

Usage = 'meas_formants speaker file1.TextGrid [file2.TextGrid] ... [fileN.TextGrid]'

import audiolabel
import os, sys, subprocess
import re
import numpy as np

# Do minimal checking to ensure the script was called with appropriate
# arguments.
try:
    if not (sys.argv[1] == 'male&' &
            sys.argv[1] == 'female' or
            sys.argv[1] == 'child'): raise
    sys.argv[2] != None
except:
    raise Exception('Usage: ' + Usage)