You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -231,38 +231,167 @@ a `window_max` of 30 means that it will look up to 30 milliseconds after the end
231
231
Encoding other measures using a Praat script
232
232
============================================
233
233
234
-
Other acoustic measures can be encoded by passing a Praat script to :code:`analyze_script`.
234
+
You can encode additional acoustic measures by passing a Praat script to either
235
+
:code:`analyze_script` or :code:`analyze_track_script`. It is essential to follow the exact input and output format for
236
+
your Praat script to ensure compatibility with the system.
235
237
236
-
The requirements for the Praat script are:
238
+
- :code:`analyze_script`: Designed for single-point measurements. This function works for user-specific
239
+
measurements that occur at exactly one point in time for any target annotation type
240
+
(or a defined subset of that type) in the hierarchy, such as a predefined set of vowels within all phones.
237
241
238
-
* exactly one input: the full path to the sound file containing (only) the phone. (Any other parameters can be set manually
239
-
within your script, and an existing script may need some other modifications in order to work on this type of input)
240
-
* print the resulting acoustic measurements (or other properties) to the Praat Info window in the following format:
242
+
- :code:`analyze_track_script`: Use this for continuous measurements or when measurements are required
243
+
at multiple time points per annotation. This function allows you to configure your Praat script to
244
+
output results for multiple time points.
241
245
242
-
* The first line should be a space-separated list of column names. These are the names of the properties that will be
243
-
saved into the database.
244
-
* The second line should be a space-separated list containing one measurement for each property.
245
-
* (It is okay if there is some blank space before/after these two lines.)
246
+
analyze_script
247
+
--------------
246
248
247
-
An example of the Praat output::
249
+
There are two input formats available for designing your Praat script:
250
+
251
+
Format 1:
252
+
~~~~~~~~~
253
+
This is sufficient for most use cases and should be your default choice unless runtime efficiency is critical.
254
+
In this format, the system generates temporary sound files, each containing one instance of your chosen annotation type.
255
+
256
+
**Input Requirements:**
257
+
258
+
- One required input: the full path to the sound file. This input will be automatically filled by the system. You can define additional attributes as needed.
259
+
260
+
Example input section for a Praat script using Format 1::
261
+
262
+
form Variables
263
+
sentence filename
264
+
# add more arguments here
265
+
endform
266
+
267
+
Read from file... 'filename$'
268
+
269
+
Format 2 (for optimized analysis):
270
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
271
+
This format is more efficient as it reuses the same discourse sound file for all annotations in the same discourse, avoiding the creation of extra files.
272
+
273
+
**Input Requirements:**
274
+
275
+
- Five required inputs:
276
+
- Full path to the **long** sound file
277
+
- `begin` time
278
+
- `end` time
279
+
- `channel`
280
+
- `padding`
281
+
282
+
Do not assign values to these five fields; the system will populate them during processing. You may include additional
283
+
attributes beyond these five, but ensure that values are passed as an array via the API.
284
+
285
+
Example Praat script for Format 2::
286
+
287
+
form Variables
288
+
sentence filename
289
+
real begin
290
+
real end
291
+
integer channel
292
+
real padding
293
+
# add more arguments here
294
+
endform
295
+
296
+
Open long sound file... 'filename$'
297
+
298
+
seg_begin = begin - padding
299
+
if seg_begin < 0
300
+
seg_begin = 0
301
+
endif
302
+
303
+
seg_end = end + padding
304
+
if seg_end > duration
305
+
seg_end = duration
306
+
endif
307
+
308
+
Extract part... seg_begin seg_end 1
309
+
channel = channel + 1
310
+
Extract one channel... channel
311
+
312
+
**Key Notes:**
313
+
314
+
- Always use :code:`Open long sound file` to ensure compatibility with the system.
315
+
- The `padding` field allows flexibility by extending the actual start and end times of the segment (default is 0.1s).
316
+
- Channel indexing starts at 0 in the system, so increment by 1 for use in Praat (Praat uses 1-based indexing).
317
+
318
+
**Output Requirements:**
319
+
320
+
- Print results to the Praat Info window in this format:
321
+
- The first line contains space-separated column names (property names to be saved in the database).
322
+
- The second line contains space-separated measurements for each property.
323
+
324
+
An example of the Praat output::
248
325
249
326
peak slope cog spread
250
327
5540.7376 24.3507 6744.0670 1562.1936
251
328
252
-
Output format if you are only taking one measure::
329
+
Output format if you are only taking one measure::
253
330
254
331
cog
255
332
6013.9
256
333
257
-
To run :code:`analyze_script`, do the following:
334
+
To run :code:`analyze_script`, follow these steps:
335
+
336
+
1. (Optional) Encode a subset for the annotation type you want to analyze.
337
+
2. Call :code:`analyze_script` with the annotation type, the subset name and the path to your script.
Copy file name to clipboardExpand all lines: docs/source/developer_influxdb_implementation.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,16 +42,16 @@ along with the ``time`` in seconds will always give a unique acoustic time point
42
42
43
43
44
44
In addition to these tags, there are several queryable fields which are always present in addition to the measurement fields.
45
-
First, the ``phone``for the time point is saved to allow for efficient aggregation across phones. Second, the ``utterance_id``
46
-
for the time point is also saved. The ``utterance_id`` is used for general querying, where each utterance's track for the
45
+
First, the ``phone``, ``word``, ``syllable``(if syllable encoding has been performed for the corpus) for the time point are saved to allow for efficient aggregation across annotations.
46
+
Second, the ``utterance_id``for the time point is also saved. The ``utterance_id`` is used for general querying, where each utterance's track for the
47
47
requested acoustic property is queried once and then cached for any further results to use without needing to query the
48
48
InfluxDB again. For instance, a query on phone formant tracks might return 2000 phones. Without the ``utterance_id``, there
49
49
would be 2000 look ups for formant tracks (each InfluxDB query would take about 0.15 seconds), but using the utterance-based caching,
50
50
the number of hits to the InfluxDB database would be a fraction (though the queries themselves would take a little bit longer).
51
51
52
52
.. note::
53
53
54
-
For performance reasons internal to InfluxDB, ``phone`` and ``utterance_id`` are ``fields`` rather than ``tags``, because
54
+
For performance reasons internal to InfluxDB, ``phone``, ``syllable``, ``word``, and ``utterance_id`` are ``fields`` rather than ``tags``, because
55
55
the cross of them with ``speaker``, ``discourse``, and ``channel`` would lead to an extremely large cross of possible tag
56
56
combinations. This mix of tags and fields has been found to be the most performant.
0 commit comments