mexca.audio.extraction
Extract voice features from an audio file.
Module Contents
Classes
Base class for features. |
|
Extract voice pitch as the fundamental frequency F0 in Hz. |
|
Extract local jitter relative to the fundamental frequency. |
|
Extract local shimmer relative to the fundamental frequency. |
|
Extract the harmonicity-to-noise ratio in dB. |
|
Extract formant central frequency in Hz. |
|
Extract formant frequency bandwidth in Hz. |
|
Extract formant amplitude relative to F0 harmonic amplitude. |
|
Extract voice features from an audio file. |
Functions
|
Command line interface for extracting voice features. |
- class mexca.audio.extraction.BaseFeature[source]
Base class for features.
Can be used to create custom voice feature extraction classes.
- requires() Optional[Dict[str, type]][source]
Specify objects required for feature extraction.
This method can be overwritten to return a dictionary with keys as the names of objects required for computing features and values the types of these objects. The VoiceExtractor object will look for objects with the specified types and add them as attributes to the feature class with the names of the dictionary keys.
- Returns:
Dictionary where keys are the names and values the types of required objects.
- Return type:
- apply(time: numpy.ndarray) numpy.ndarray[source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeaturePitchF0[source]
Bases:
BaseFeatureExtract voice pitch as the fundamental frequency F0 in Hz.
- requires() Optional[Dict[str, mexca.audio.features.PitchFrames]][source]
Specify objects required for feature extraction.
- Returns:
Dictionary with key pitch_frames.
- Return type:
- apply(time: numpy.ndarray) numpy.ndarray[source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeatureJitter[source]
Bases:
BaseFeatureExtract local jitter relative to the fundamental frequency.
- requires() Optional[Dict[str, mexca.audio.features.JitterFrames]][source]
Specify objects required for feature extraction.
- Returns:
Dictionary with key jitter_frames.
- Return type:
- apply(time: numpy.ndarray) numpy.ndarray[source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeatureShimmer[source]
Bases:
BaseFeatureExtract local shimmer relative to the fundamental frequency.
- requires() Optional[Dict[str, mexca.audio.features.ShimmerFrames]][source]
Specify objects required for feature extraction.
- Returns:
Dictionary with key shimmer_frames.
- Return type:
- apply(time: numpy.ndarray) numpy.ndarray[source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeatureHnr[source]
Bases:
BaseFeatureExtract the harmonicity-to-noise ratio in dB.
- requires() Optional[Dict[str, mexca.audio.features.HnrFrames]][source]
Specify objects required for feature extraction.
- Returns:
Dictionary with key hnr_frames.
- Return type:
- apply(time: numpy.ndarray) numpy.ndarray[source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeatureFormantFreq(n_formant: int)[source]
Bases:
BaseFeatureExtract formant central frequency in Hz.
- Parameters:
n_formant (int) – Index of the formant (starting at 0).
- requires() Optional[Dict[str, mexca.audio.features.FormantFrames]][source]
Specify objects required for feature extraction.
- Returns:
Dictionary with key formant_frames.
- Return type:
- apply(time: numpy.ndarray) Optional[numpy.ndarray][source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeatureFormantBandwidth(n_formant: int)[source]
Bases:
FeatureFormantFreqExtract formant frequency bandwidth in Hz.
- Parameters:
n_formant (int) – Index of the formant (starting at 0).
- apply(time: numpy.ndarray) Optional[numpy.ndarray][source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.FeatureFormantAmplitude(n_formant: int)[source]
Bases:
BaseFeatureExtract formant amplitude relative to F0 harmonic amplitude.
- Parameters:
n_formant (int) – Index of the formant (starting at 0).
- requires() Optional[Dict[str, mexca.audio.features.FormantAmplitudeFrames]][source]
Specify objects required for feature extraction.
- Returns:
Dictionary with key formant_amp_frames.
- Return type:
- apply(time: numpy.ndarray) Optional[numpy.ndarray][source]
Extract features at time points by linear interpolation.
- Parameters:
time (numpy.ndarray) – Time points.
- Returns:
Feature values interpolated at time points.
- Return type:
- class mexca.audio.extraction.VoiceExtractor(features: Optional[Dict[str, BaseFeature]] = None)[source]
Extract voice features from an audio file.
For default features, see the Output section.
- Parameters:
features (dict, optional, default=None) – Dictionary with keys as feature names and values as feature extraction objects. If None, default features are extracted.