pyeeg.io.AlignedSpeech

class pyeeg.io.AlignedSpeech(onset, srate, path_audio=None, doing_copy=False)

Generic class to describe features corresponding to a speech segment aligned with EEG data. The alignment itself is encoded simply by storing the value of onset of the speech segment with respect to the EEG data as it occurred during the actual experiment.

onset_list
Type:

list

srate
Type:

float

duration
Type:

float | list

indices
Type:

list

feats
Type:

pd.DataFrame

Parameters:
  • onset (float) – Value of onset of speech segment in the experiment relative to EEG recording

  • srate (float) – Sampling rate at which EEG and speech features will be aligned

  • path_audio (str) – Path to audio corresponding to speech segment to be aligned

  • doing_copy (bool) – TODO Deprecated parameters to be removed?

Methods

AlignedSpeech.add_feature(feat, name)

Add some signal as an aligned speech feature for current story part (i.e. add feature as a new column of the pandas DataFrame).

AlignedSpeech.add_word_level_features(word_feats)

Add an existing WordLevelFeatures instance to this AlignedSpeech instance, but not simply as an object here, but actually add the aligned features.

AlignedSpeech.create_word_level_features(...)

Create a new word level feature object attached to this instance.

AlignedSpeech.get_envelope([cutoff, method])

Extract envelope from sound associated with this instance and add to it as a feature.

AlignedSpeech.samples_from_onset(...)

Load the corresponding indices of samples as found in EEG for the given speech segment.