Skip to content

Conversation

@lxy2304
Copy link
Collaborator

@lxy2304 lxy2304 commented Feb 19, 2025

This update introduces improvements to several functions related to acoustic track analysis and measurement encoding.

Code changes:

  • analyze_track_script: Now supports user-specified annotation types(phone,syllable,word,utterance) for analysis.
  • _save_measurement_tracks: Save word/syllable labels for the track to the influxdb
  • _save_measurement: Save word/syllable labels for the track to the influxdb
  • encode_acoustics_statistic: Modified to support aggregation over annotations beyond phones (word, syllable).
  • get_acoustics_statistic: Query logic updated to align with the encode function changes.
  • relativize_acoustic_measure: Relativization can be performed over annotations beyond phones (follows from the encode statistic function changes)
  • Other minor updates/fixes

Docs changes:

  • Expanded instructions for analyze_script and analyze_track_script.
  • Added documentation for get_acoustic_statistic and encode_acoustics_statistic.

@lxy2304 lxy2304 requested a review from msonderegger February 19, 2025 03:41
Making sure related functions have consistent signatures.

Example input section for a Praat script using Format 1::

form Variables
Copy link
Member

@msonderegger msonderegger Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be good to have a simple script here that actually does something linguistically reasonable, and say what it does. Or, give a link to such a script.

I'm not clear as a reader what the script should do.

maybe a really simple example could be, get the average f0/pitch?

with CorpusContext(config) as c:
c.encode_type_subset('phone', ['S', 'Z', 'SH', 'ZH'], 'sibilant')
c.analyze_script(subset='sibilant', annotation_type="phone", script_path='path/to/script/sibilant.praat')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is good.

I'd add explanation here in words, saying what this code block does:

  • defines a subset of phones called "sibilants"
  • uses a praat script that takes as input a filename and begin/end time, and outputs measures we'd like to take for sibilants
  • the analyze_script call then applies this script to every phone of type "sibilant" in the corpus.

c.config.praat_path = '/path/to/your/praat/executable'
props = [('H1_H2', float), ('H1_A1',float), ('H1_A2',float), ('H1_A3',float)]
c.analyze_track_script('voice_quality', props, script_path, annotation_type='phone')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also good, but could you put the voice quality script somewhere?

then, say what this code is going to do, as I suggest for the sibilant call to analyze_script above.

it'll help to have the examples be really concrete -- so, the readeer can actually go look at the Praat scripts if needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually do have this example in the tutorial I wrote with voice quality measures (including the Praat script). I can add a link here to the tutorial.

- Print results to the Praat Info window in the following format:
- The first line begins with time, followed by space-separated column names.
- Subsequent lines contain timestamps and measurements for each property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be good to have the example output here be consistent with the example in the code block below.

so either

  • change "Example output" to be H1_H2, H1_A1, H1_A2, H1_A3
    or
  • change the analyze_track_script call to be a formant measurement script.


# Alternatively, call the get function directly; it will encode the statistic if not already available
results = c.get_acoustic_statistic('formants', 'mean', by_annotation='phone', by_speaker=True)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add verbal explanation after this code block (or put in comments) explaining what this code did.

Copy link
Member

@msonderegger msonderegger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great -- tons of work here. I added some suggestions on the new documentation.

@msonderegger msonderegger merged commit f1b1511 into main Feb 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants