Perl代写 | Extract Formant Contours

本次Perl代写要求对包含大量语音样本的声音文本文件进行处理。这些声音文本文件包含了许多特定的单次或者词组,需要使用perl编程对这些文本文件进行提取和转换。

You have a large number of sound files containing samples of connected speech. Certain words in those sound contain vowels whose F1 and F2 contours are of interest to you. Your goal is to extract those formant contours.

1   Input

Input files come in pairs, e.g.,

Lawson.TextGrid Lawson.Formant McPhail.TextGrid McPhail.Formant etc. etc.

Praat’s Formants are already familiar from a previous homework. They indicate  formants and bandwidths for a succession of time points. The TextGrid files give labels to certain time intervals:

intervals [9]:

xmin = 0.8654615334990617

xmax = 1.2514593964179261

text = “” intervals [10]:

xmin = 1.2514593964179261

xmax = 1.3339871674130606

text = “I_m” intervals [11]:

xmin = 1.3339871674130606

xmax = 1.4831292517006802

text = “” intervals [12]:

xmin = 1.4831292517006802

xmax = 1.5892474823514997

text = “” intervals [13]:

xmin = 1.5892474823514997

xmax  = 1.7286691181169496

text = “mind” intervals [14]:

xmin = 1.7286691181169496

xmax = 1.8521847992429745

text = “”

.

Each interval is specified by

  • its starting and ending times xmin and xmax, which are in seconds, and use the same time scale as the Formant, and
  • its label text, which is a text string enclosed in double

Some intervals are unlabelled, i.e., text is an empty string. Unlabelled intervals should be disre- garded. Other intervals are labelled with a word or phrase. The goal of the assignment is to print only those formant values from the Formant whose times are within one of the labelled intervals.

The script is invoked by typing

perl getFormants Lawson McPhail …

i.e., there are files Lawson.TextGrid, Lawson.Formant, etc. Input files for testing the program are on Sakai in the Resources folder. (Actually, you will only find Lawson and McPhail there, since that’s all you need to test it, but the program should be able to deal with files that have other names.)

 

2   Output

All output goes to STDOUT. Each output line has the following format (fields separated by whites- pace):

  1. <filename>: The name of the file that this particular F1 and F2 came
  2. <label>: The label of the interval that this particular F1 and F2 came
  3. <start time>: The time point at which the interval began. This is so that if the file Lawson.TextGrid contains two or more intervals labelled “googly”, they are distinguished in the output. (Truncate this to 3 decimal places, i.e., to the milliseconds place.)
  4. <timestamp>: The time point in filename that this particular F1 and F2 came from. (Like- )
  5. <F1>: The F1 at this time. (Truncate to nearest )
  6. <F2>: The F2 at this time. (Truncate to nearest )

Each interval in filename.TextGrid should yield one line of output for each time point in that interval. E.g.:

McPhail I_m 1.251 1.311 611 1607

McPhail I_m 1.251 1.316 606 1604

McPhail I_m 1.251 1.321 598 1598

McPhail I_m 1.251 1.326 587 1588

McPhail I_m 1.251 1.331 569 1571

McPhail mind 1.589 1.591 699 1251

McPhail mind 1.589 1.596 722 1283

McPhail mind 1.589 1.601 735 1317

McPhail mind 1.589 1.606 739 1356

McPhail mind 1.589 1.611 740 1393

Points to bear in mind:

  1. You can assume that the TextGrid and Formant files are legitimate, un-messed- with Praat output, and contain only plain ASCII
  2. However, you can’t assume that the labels will be single words, will lack apostrophes and hyphens,
  3. You can format the lines however you like as far as the whitespace
  4. Subroutines can help to clear up the logical structure and speed debugging. However, you shouldn’t put them in just for the sake of having subroutines in your code!
  5. Ask yourself: Do I really need to slurp?
  6. If you can’t solve the whole problem, solve as much as you
  7. Remember to check before uploading it to Sakai to make sure that the final version actually runs and produces output!
  8. WorkProperly >> (That’s Optimality Theory for “It’s more important to work properly than to be elegant.”)

 


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论