Skip to content

Automation

Santiago Barreda edited this page Feb 20, 2023 · 1 revision

FastTrack can be automated to run unsupervised via a Praat script that loads a wav file, sets FastTrack global settings, and calls the trackAutoselect procedure.

An example script is:

# what sound file do we want to analyse?
# (e.g. we want to analyse part of a file called 'my.wav')
Open long sound file... my.wav

# what part of the sound file do we want to analyze?
# (e.g. extract from 2s to 4s)
Extract part... 2.0 4.0 0
Rename... sample

# at what time in the sample do we want the measurement?
# (e.g. we want the formant values at the 1s instant in the 2s sample)
time = 1.0

# Load procedures necessary for unsupervised execution
# Check this file for information about parameters and outputs
include utils/trackAutoselectProcedure.praat

# Ensure all global settings have values
@getSettings
time_step = 0.002
enable_F1_frequency_heuristic = 1
maximum_F1_frequency_value = 1200
enable_F1_bandwidth_heuristic = 0
enable_F2_bandwidth_heuristic = 0
enable_F3_bandwidth_heuristic = 0
enable_F4_frequency_heuristic = 1
minimum_F4_frequency_value = 2900
enable_rhotic_heuristic = 1
enable_F3F4_proximity_heuristic = 1
output_bandwidth = 1
output_predictions = 1
output_pitch = 1
output_intensity = 1
output_harmonicity = 1
output_normalized_time = 1

# procedure parameters
dir$ = "."
lowestAnalysisFrequency = 5000
highestAnalysisFrequency = 7000
steps = 20
coefficients = 5
formants = 3
method$ = "burg"
image = 0
current_view = 0
max_plot = 4000
# Leave a formant object named after the sound in the Objects list:
out_formant = 2
out_table = 0
out_all = 0

# run FastTrack
@trackAutoselect: selected(), dir$, lowestAnalysisFrequency, highestAnalysisFrequency, steps, coefficients, formants, method$, image, selected(), current_view, max_plot, out_formant, out_table, out_all

# output results from formant object
f1 = Get value at time: 1, time, "hertz", "Linear"
f2 = Get value at time: 2, time, "hertz", "Linear"
print 'time' 'newline$'
print 'f1' 'newline$'
print 'f2' 'newline$'

# tidy up
Remove
select Sound sample
Remove
select LongSound soundfile
Remove

As the praat include procedure assumes paths are relative to the main script, the script must be saved in the functions directory (i.e. Fast Track/functions/).

Page contributed by: Robert Fromont