Difference between revisions of "Guide to lab computing"

From Phonlab
Jump to navigationJump to search
Line 1: Line 1:
 
All Lab workstations automatically mount shared disk space as the guest user. This shared space is often referred to as the [https://corpus.linguistics.berkeley.edu/pdrive/pdrive.html PDrive] since it is mounted as drive letter P: on Windows.
 
All Lab workstations automatically mount shared disk space as the guest user. This shared space is often referred to as the [https://corpus.linguistics.berkeley.edu/pdrive/pdrive.html 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
  +
  +
  +
<nowiki>
  +
#!/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' or
  +
sys.argv[1] == 'female' or
  +
sys.argv[1] == 'child'): raise
  +
sys.argv[2] != None
  +
except:
  +
raise Exception('Usage: ' + Usage)
  +
</nowiki>

Revision as of 12:33, 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' or
            sys.argv[1] == 'female' or
            sys.argv[1] == 'child'): raise
    sys.argv[2] != None
except:
    raise Exception('Usage: ' + Usage)