API Reference
- parselmouth.VERSION = '0.4.5'
This version of Parselmouth.
- parselmouth.PRAAT_VERSION = '6.1.38'
The Praat version on which this version of Parselmouth is based.
- parselmouth.PRAAT_VERSION_DATE = '2 January 2021'
The release date of the Praat version on which this version of Parselmouth is based.
- exception parselmouth.PraatError
Bases:
RuntimeError
- exception parselmouth.PraatFatal
Bases:
BaseException
- exception parselmouth.PraatWarning
Bases:
UserWarning
- class parselmouth.AmplitudeScaling
Bases:
pybind11_object
- __index__(self: parselmouth.AmplitudeScaling) int
- __init__(self: parselmouth.AmplitudeScaling, value: int) None
- __init__(self: parselmouth.AmplitudeScaling, arg0: str) None
- __int__(self: parselmouth.AmplitudeScaling) int
- __str__()
name(self: handle) -> str
- INTEGRAL = <AmplitudeScaling.INTEGRAL: 1>
- NORMALIZE = <AmplitudeScaling.NORMALIZE: 3>
- PEAK_0_99 = <AmplitudeScaling.PEAK_0_99: 4>
- SUM = <AmplitudeScaling.SUM: 2>
- property name
- property value
- class parselmouth.CC
Bases:
TimeFrameSampled
,Sampled
- class Frame
Bases:
pybind11_object
- __getitem__(self: parselmouth.CC.Frame, i: int) float
- __init__(*args, **kwargs)
- __len__(self: parselmouth.CC.Frame) int
- __setitem__(self: parselmouth.CC.Frame, i: int, value: float) None
- to_array(self: parselmouth.CC.Frame) numpy.ndarray[numpy.float64]
- property c
- property c0
- __getitem__(self: parselmouth.CC, i: int) parselmouth.CC.Frame
- __getitem__(self: parselmouth.CC, ij: Tuple[int, int]) float
- __init__(*args, **kwargs)
- __iter__(self: parselmouth.CC) Iterator
- get_c0_value_in_frame(self: parselmouth.CC, frame_number: Positive[int]) float
- get_frame(self: parselmouth.CC, frame_number: Positive[int]) parselmouth.CC.Frame
- get_number_of_coefficients(self: parselmouth.CC, frame_number: Positive[int]) int
- get_value_in_frame(self: parselmouth.CC, frame_number: Positive[int], index: Positive[int]) float
- to_array(self: parselmouth.CC) numpy.ndarray[numpy.float64]
- to_matrix(self: parselmouth.CC) parselmouth.Matrix
- property fmax
- property fmin
- property max_n_coefficients
- class parselmouth.Data
Bases:
Thing
- class FileFormat
Bases:
pybind11_object
- __index__(self: parselmouth.Data.FileFormat) int
- __init__(self: parselmouth.Data.FileFormat, value: int) None
- __init__(self: parselmouth.Data.FileFormat, arg0: str) None
- __int__(self: parselmouth.Data.FileFormat) int
- __str__()
name(self: handle) -> str
- BINARY = <FileFormat.BINARY: 2>
- SHORT_TEXT = <FileFormat.SHORT_TEXT: 1>
- TEXT = <FileFormat.TEXT: 0>
- property name
- property value
- __copy__(self: parselmouth.Data) parselmouth.Data
- __deepcopy__(self: parselmouth.Data, memo: dict) parselmouth.Data
- __eq__(self: parselmouth.Data, other: parselmouth.Data) bool
- __init__(*args, **kwargs)
- __ne__(self: parselmouth.Data, other: parselmouth.Data) bool
- copy(self: parselmouth.Data) parselmouth.Data
- static read(file_path: str) parselmouth.Data
Read a file into a
parselmouth.Data
object.- Parameters:
file_path (str) – The path of the file on disk to read.
- Returns:
The Praat Data object that was read.
- Return type:
See also
- save(self: parselmouth.Data, file_path: str, format: parselmouth.Data.FileFormat = <FileFormat.TEXT: 0>) None
- save_as_binary_file(self: parselmouth.Data, file_path: str) None
- save_as_short_text_file(self: parselmouth.Data, file_path: str) None
- save_as_text_file(self: parselmouth.Data, file_path: str) None
- __hash__ = None
- class parselmouth.Formant
Bases:
TimeFrameSampled
,Sampled
- __init__(*args, **kwargs)
- class parselmouth.FormantUnit
Bases:
pybind11_object
- __index__(self: parselmouth.FormantUnit) int
- __init__(self: parselmouth.FormantUnit, value: int) None
- __init__(self: parselmouth.FormantUnit, arg0: str) None
- __int__(self: parselmouth.FormantUnit) int
- __str__()
name(self: handle) -> str
- BARK = <FormantUnit.BARK: 1>
- HERTZ = <FormantUnit.HERTZ: 0>
- property name
- property value
- class parselmouth.Function
Bases:
Data
- __init__(*args, **kwargs)
- scale_x_by(self: parselmouth.Function, scale: Positive[float]) None
- scale_x_to(self: parselmouth.Function, new_xmin: float, new_xmax: float) None
- shift_x_by(self: parselmouth.Function, shift: float) None
- shift_x_to(self: parselmouth.Function, x: float, new_x: float) None
- property xmax
- property xmin
- property xrange
- class parselmouth.Harmonicity
Bases:
TimeFrameSampled
,Vector
- __init__(*args, **kwargs)
- class parselmouth.Intensity
Bases:
TimeFrameSampled
,Vector
- class AveragingMethod
Bases:
pybind11_object
- __index__(self: parselmouth.Intensity.AveragingMethod) int
- __init__(self: parselmouth.Intensity.AveragingMethod, value: int) None
- __init__(self: parselmouth.Intensity.AveragingMethod, arg0: str) None
- __int__(self: parselmouth.Intensity.AveragingMethod) int
- __str__()
name(self: handle) -> str
- DB = <AveragingMethod.DB: 3>
- ENERGY = <AveragingMethod.ENERGY: 1>
- MEDIAN = <AveragingMethod.MEDIAN: 0>
- SONES = <AveragingMethod.SONES: 2>
- property name
- property value
- __init__(*args, **kwargs)
- parselmouth.Interpolation
alias of
ValueInterpolation
- class parselmouth.MFCC
Bases:
CC
- __init__(*args, **kwargs)
- convolve(self: parselmouth.MFCC, other: parselmouth.MFCC, scaling: parselmouth.AmplitudeScaling = <AmplitudeScaling.PEAK_0_99: 4>, signal_outside_time_domain: parselmouth.SignalOutsideTimeDomain = <SignalOutsideTimeDomain.ZERO: 1>) parselmouth.Sound
- cross_correlate(self: parselmouth.MFCC, other: parselmouth.MFCC, scaling: parselmouth.AmplitudeScaling = <AmplitudeScaling.PEAK_0_99: 4>, signal_outside_time_domain: parselmouth.SignalOutsideTimeDomain = <SignalOutsideTimeDomain.ZERO: 1>) parselmouth.Sound
- extract_features(self: parselmouth.MFCC, window_length: Positive[float] = 0.025, include_energy: bool = False) parselmouth.Matrix
- to_matrix_features(self: parselmouth.MFCC, window_length: Positive[float] = 0.025, include_energy: bool = False) parselmouth.Matrix
- to_sound(self: parselmouth.MFCC) parselmouth.Sound
- class parselmouth.Matrix
Bases:
SampledXY
- __init__(*args, **kwargs)
- as_array(self: parselmouth.Matrix) numpy.ndarray[numpy.float64]
- at_xy(self: parselmouth.Matrix, x: float, y: float) float
- formula(self: parselmouth.Matrix, formula: str, from_x: float | None = None, to_x: float | None = None, from_y: float | None = None, to_y: float | None = None) None
- formula(self: parselmouth.Matrix, formula: str, x_range: Tuple[float | None, float | None] = (None, None), y_range: Tuple[float | None, float | None] = (None, None)) None
- get_column_distance(self: parselmouth.Matrix) float
- get_highest_x(self: parselmouth.Matrix) float
- get_highest_y(self: parselmouth.Matrix) float
- get_lowest_x(self: parselmouth.Matrix) float
- get_lowest_y(self: parselmouth.Matrix) float
- get_maximum(self: parselmouth.Matrix) float
- get_minimum(self: parselmouth.Matrix) float
- get_number_of_columns(self: parselmouth.Matrix) int
- get_number_of_rows(self: parselmouth.Matrix) int
- get_row_distance(self: parselmouth.Matrix) float
- get_sum(self: parselmouth.Matrix) float
- get_value_at_xy(self: parselmouth.Matrix, x: float, y: float) float
- get_value_in_cell(self: parselmouth.Matrix, row_number: Positive[int], column_number: Positive[int]) float
- get_x_of_column(self: parselmouth.Matrix, column_number: Positive[int]) float
- get_y_of_row(self: parselmouth.Matrix, row_number: Positive[int]) float
- save_as_headerless_spreadsheet_file(self: parselmouth.Matrix, file_path: str) None
- save_as_matrix_text_file(self: parselmouth.Matrix, file_path: str) None
- set_value(self: parselmouth.Matrix, row_number: Positive[int], column_number: Positive[int], new_value: float) None
- property n_columns
- property n_rows
- property values
- class parselmouth.Pitch
Bases:
TimeFrameSampled
,Sampled
- class Candidate
Bases:
pybind11_object
- __init__(*args, **kwargs)
- property frequency
- property strength
- class Frame
Bases:
pybind11_object
- __getitem__(self: parselmouth.Pitch.Frame, i: int) parselmouth.Pitch.Candidate
- __init__(*args, **kwargs)
- __len__(self: parselmouth.Pitch.Frame) int
- as_array(self: parselmouth.Pitch.Frame) numpy.ndarray
- select(self: parselmouth.Pitch.Frame, candidate: parselmouth.Pitch.Candidate) None
- select(self: parselmouth.Pitch.Frame, i: int) None
- unvoice(self: parselmouth.Pitch.Frame) None
- property candidates
- property intensity
- property selected
- __getitem__(self: parselmouth.Pitch, i: int) parselmouth.Pitch.Frame
- __getitem__(self: parselmouth.Pitch, ij: Tuple[int, int]) parselmouth.Pitch.Candidate
- __init__(*args, **kwargs)
- __iter__(self: parselmouth.Pitch) Iterator
- count_differences(self: parselmouth.Pitch, other: parselmouth.Pitch) str
- count_voiced_frames(self: parselmouth.Pitch) int
- fifth_down(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) None
- fifth_up(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) None
- formula(self: parselmouth.Pitch, formula: str) None
- get_frame(self: parselmouth.Pitch, frame_number: Positive[int]) parselmouth.Pitch.Frame
- get_mean_absolute_slope(self: parselmouth.Pitch, unit: parselmouth.PitchUnit = <PitchUnit.HERTZ: 0>) float
- get_slope_without_octave_jumps(self: parselmouth.Pitch) float
- get_value_at_time(self: parselmouth.Pitch, time: float, unit: parselmouth.PitchUnit = <PitchUnit.HERTZ: 0>, interpolation: parselmouth.ValueInterpolation = <ValueInterpolation.LINEAR: 1>) float
- get_value_in_frame(self: parselmouth.Pitch, frame_number: int, unit: parselmouth.PitchUnit = <PitchUnit.HERTZ: 0>) float
- interpolate(self: parselmouth.Pitch) parselmouth.Pitch
- kill_octave_jumps(self: parselmouth.Pitch) parselmouth.Pitch
- octave_down(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) None
- octave_up(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) None
- path_finder(self: parselmouth.Pitch, silence_threshold: float = 0.03, voicing_threshold: float = 0.45, octave_cost: float = 0.01, octave_jump_cost: float = 0.35, voiced_unvoiced_cost: float = 0.14, ceiling: Positive[float] = 600.0, pull_formants: bool = False) None
- smooth(self: parselmouth.Pitch, bandwidth: Positive[float] = 10.0) parselmouth.Pitch
- step(self: parselmouth.Pitch, step: float, precision: Positive[float] = 0.1, from_time: float | None = None, to_time: float | None = None) None
- subtract_linear_fit(self: parselmouth.Pitch, unit: parselmouth.PitchUnit = <PitchUnit.HERTZ: 0>) parselmouth.Pitch
- to_array(self: parselmouth.Pitch) numpy.ndarray[parselmouth.Pitch.Candidate]
- to_matrix(self: parselmouth.Pitch) parselmouth.Matrix
- to_sound_hum(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) parselmouth.Sound
- to_sound_pulses(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) parselmouth.Sound
- to_sound_sine(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None, sampling_frequency: Positive[float] = 44100.0, round_to_nearest_zero_crossing: float = True) parselmouth.Sound
- unvoice(self: parselmouth.Pitch, from_time: float | None = None, to_time: float | None = None) None
- property ceiling
- property max_n_candidates
- property selected
- property selected_array
- class parselmouth.PitchUnit
Bases:
pybind11_object
- __index__(self: parselmouth.PitchUnit) int
- __init__(self: parselmouth.PitchUnit, value: int) None
- __init__(self: parselmouth.PitchUnit, arg0: str) None
- __int__(self: parselmouth.PitchUnit) int
- __str__()
name(self: handle) -> str
- ERB = <PitchUnit.ERB: 8>
- HERTZ = <PitchUnit.HERTZ: 0>
- HERTZ_LOGARITHMIC = <PitchUnit.HERTZ_LOGARITHMIC: 1>
- LOG_HERTZ = <PitchUnit.LOG_HERTZ: 3>
- MEL = <PitchUnit.MEL: 2>
- SEMITONES_1 = <PitchUnit.SEMITONES_1: 4>
- SEMITONES_100 = <PitchUnit.SEMITONES_100: 5>
- SEMITONES_200 = <PitchUnit.SEMITONES_200: 6>
- SEMITONES_440 = <PitchUnit.SEMITONES_440: 7>
- property name
- property value
- class parselmouth.Sampled
Bases:
Function
- __init__(*args, **kwargs)
- __len__(self: parselmouth.Sampled) int
- x_bins(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]
- x_grid(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]
- xs(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]
- property dx
- property nx
- property x1
- class parselmouth.SampledXY
Bases:
Sampled
- __init__(*args, **kwargs)
- y_bins(self: parselmouth.SampledXY) numpy.ndarray[numpy.float64]
- y_grid(self: parselmouth.SampledXY) numpy.ndarray[numpy.float64]
- ys(self: parselmouth.SampledXY) numpy.ndarray[numpy.float64]
- property dy
- property ny
- property y1
- property ymax
- property ymin
- property yrange
- class parselmouth.SignalOutsideTimeDomain
Bases:
pybind11_object
- __index__(self: parselmouth.SignalOutsideTimeDomain) int
- __init__(self: parselmouth.SignalOutsideTimeDomain, value: int) None
- __init__(self: parselmouth.SignalOutsideTimeDomain, arg0: str) None
- __int__(self: parselmouth.SignalOutsideTimeDomain) int
- __str__()
name(self: handle) -> str
- SIMILAR = <SignalOutsideTimeDomain.SIMILAR: 2>
- ZERO = <SignalOutsideTimeDomain.ZERO: 1>
- property name
- property value
- class parselmouth.Sound
Bases:
TimeFrameSampled
,Vector
- class ToHarmonicityMethod
Bases:
pybind11_object
- __index__(self: parselmouth.Sound.ToHarmonicityMethod) int
- __init__(self: parselmouth.Sound.ToHarmonicityMethod, value: int) None
- __init__(self: parselmouth.Sound.ToHarmonicityMethod, arg0: str) None
- __int__(self: parselmouth.Sound.ToHarmonicityMethod) int
- __str__()
name(self: handle) -> str
- AC = <ToHarmonicityMethod.AC: 1>
- CC = <ToHarmonicityMethod.CC: 0>
- GNE = <ToHarmonicityMethod.GNE: 2>
- property name
- property value
- class ToPitchMethod
Bases:
pybind11_object
- __index__(self: parselmouth.Sound.ToPitchMethod) int
- __init__(self: parselmouth.Sound.ToPitchMethod, value: int) None
- __init__(self: parselmouth.Sound.ToPitchMethod, arg0: str) None
- __int__(self: parselmouth.Sound.ToPitchMethod) int
- __str__()
name(self: handle) -> str
- AC = <ToPitchMethod.AC: 0>
- CC = <ToPitchMethod.CC: 1>
- SHS = <ToPitchMethod.SHS: 3>
- SPINET = <ToPitchMethod.SPINET: 2>
- property name
- property value
- __init__(self: parselmouth.Sound, other: parselmouth.Sound) None
- __init__(self: parselmouth.Sound, values: numpy.ndarray[numpy.float64], sampling_frequency: Positive[float] = 44100.0, start_time: float = 0.0) None
- __init__(self: parselmouth.Sound, file_path: str) None
- autocorrelate(self: parselmouth.Sound, scaling: parselmouth.AmplitudeScaling = <AmplitudeScaling.PEAK_0_99: 4>, signal_outside_time_domain: parselmouth.SignalOutsideTimeDomain = <SignalOutsideTimeDomain.ZERO: 1>) parselmouth.Sound
- static combine_to_stereo(sounds: List[parselmouth.Sound]) parselmouth.Sound
- static concatenate(sounds: List[parselmouth.Sound], overlap: NonNegative[float] = 0.0) parselmouth.Sound
- convert_to_mono(self: parselmouth.Sound) parselmouth.Sound
- convert_to_stereo(self: parselmouth.Sound) parselmouth.Sound
- convolve(self: parselmouth.Sound, other: parselmouth.Sound, scaling: parselmouth.AmplitudeScaling = <AmplitudeScaling.PEAK_0_99: 4>, signal_outside_time_domain: parselmouth.SignalOutsideTimeDomain = <SignalOutsideTimeDomain.ZERO: 1>) parselmouth.Sound
- cross_correlate(self: parselmouth.Sound, other: parselmouth.Sound, scaling: parselmouth.AmplitudeScaling = <AmplitudeScaling.PEAK_0_99: 4>, signal_outside_time_domain: parselmouth.SignalOutsideTimeDomain = <SignalOutsideTimeDomain.ZERO: 1>) parselmouth.Sound
- de_emphasize(self: parselmouth.Sound, from_frequency: float = 50.0, normalize: bool = True) None
- deepen_band_modulation(self: parselmouth.Sound, enhancement: Positive[float] = 20.0, from_frequency: Positive[float] = 300.0, to_frequency: Positive[float] = 8000.0, slow_modulation: Positive[float] = 3.0, fast_modulation: Positive[float] = 30.0, band_smoothing: Positive[float] = 100.0) parselmouth.Sound
- extract_all_channels(self: parselmouth.Sound) List[parselmouth.Sound]
- extract_channel(self: parselmouth.Sound, channel: int) parselmouth.Sound
- extract_channel(self: parselmouth.Sound, arg0: str) parselmouth.Sound
- extract_left_channel(self: parselmouth.Sound) parselmouth.Sound
- extract_part(self: parselmouth.Sound, from_time: Optional[float] = None, to_time: Optional[float] = None, window_shape: parselmouth.WindowShape = <WindowShape.RECTANGULAR: 0>, relative_width: Positive[float] = 1.0, preserve_times: bool = False) parselmouth.Sound
- extract_part_for_overlap(self: parselmouth.Sound, from_time: Optional[float] = None, to_time: Optional[float] = None, overlap: Positive[float]) parselmouth.Sound
- extract_right_channel(self: parselmouth.Sound) parselmouth.Sound
- get_energy(self: parselmouth.Sound, from_time: float | None = None, to_time: float | None = None) float
- get_energy_in_air(self: parselmouth.Sound) float
- get_index_from_time(self: parselmouth.Sound, time: float) float
- get_intensity(self: parselmouth.Sound) float
- get_nearest_zero_crossing(self: parselmouth.Sound, time: float, channel: int = 1) float
- get_number_of_channels(self: parselmouth.Sound) int
- get_number_of_samples(self: parselmouth.Sound) int
- get_power(self: parselmouth.Sound, from_time: float | None = None, to_time: float | None = None) float
- get_power_in_air(self: parselmouth.Sound) float
- get_rms(self: parselmouth.Sound, from_time: float | None = None, to_time: float | None = None) float
- get_root_mean_square(self: parselmouth.Sound, from_time: float | None = None, to_time: float | None = None) float
- get_sampling_frequency(self: parselmouth.Sound) float
- get_sampling_period(self: parselmouth.Sound) float
- get_time_from_index(self: parselmouth.Sound, sample: int) float
- lengthen(self: parselmouth.Sound, minimum_pitch: Positive[float] = 75.0, maximum_pitch: Positive[float] = 600.0, factor: Positive[float]) parselmouth.Sound
- multiply_by_window(self: parselmouth.Sound, window_shape: parselmouth.WindowShape) None
- override_sampling_frequency(self: parselmouth.Sound, new_frequency: Positive[float]) None
- pre_emphasize(self: parselmouth.Sound, from_frequency: float = 50.0, normalize: bool = True) None
- resample(self: parselmouth.Sound, new_frequency: float, precision: int = 50) parselmouth.Sound
- reverse(self: parselmouth.Sound, from_time: float | None = None, to_time: float | None = None) None
- save(self: parselmouth.Sound, file_path: str, format: parselmouth.SoundFileFormat) None
- scale_intensity(self: parselmouth.Sound, new_average_intensity: float) None
- set_to_zero(self: parselmouth.Sound, from_time: float | None = None, to_time: float | None = None, round_to_nearest_zero_crossing: bool = True) None
- to_formant_burg(self: parselmouth.Sound, time_step: Positive[float] | None = None, max_number_of_formants: Positive[float] = 5.0, maximum_formant: float = 5500.0, window_length: Positive[float] = 0.025, pre_emphasis_from: Positive[float] = 50.0) parselmouth.Formant
- to_harmonicity(self: parselmouth.Sound, method: parselmouth.Sound.ToHarmonicityMethod = <ToHarmonicityMethod.CC: 0>, *args, **kwargs) object
- to_harmonicity_ac(self: parselmouth.Sound, time_step: Positive[float] = 0.01, minimum_pitch: Positive[float] = 75.0, silence_threshold: float = 0.1, periods_per_window: Positive[float] = 1.0) parselmouth.Harmonicity
- to_harmonicity_cc(self: parselmouth.Sound, time_step: Positive[float] = 0.01, minimum_pitch: Positive[float] = 75.0, silence_threshold: float = 0.1, periods_per_window: Positive[float] = 1.0) parselmouth.Harmonicity
- to_harmonicity_gne(self: parselmouth.Sound, minimum_frequency: Positive[float] = 500.0, maximum_frequency: Positive[float] = 4500.0, bandwidth: Positive[float] = 1000.0, step: Positive[float] = 80.0) parselmouth.Matrix
- to_intensity(self: parselmouth.Sound, minimum_pitch: Positive[float] = 100.0, time_step: Positive[float] | None = None, subtract_mean: bool = True) parselmouth.Intensity
- to_mfcc(self: parselmouth.Sound, number_of_coefficients: Positive[int] = 12, window_length: Positive[float] = 0.015, time_step: Positive[float] = 0.005, firstFilterFreqency: Positive[float] = 100.0, distance_between_filters: Positive[float] = 100.0, maximum_frequency: Positive[float] | None = None) parselmouth.MFCC
- to_pitch(self: parselmouth.Sound, time_step: Positive[float] | None = None, pitch_floor: Positive[float] = 75.0, pitch_ceiling: Positive[float] = 600.0) parselmouth.Pitch
- to_pitch(self: parselmouth.Sound, method: parselmouth.Sound.ToPitchMethod, *args, **kwargs) object
- to_pitch_ac(self: parselmouth.Sound, time_step: Positive[float] | None = None, pitch_floor: Positive[float] = 75.0, max_number_of_candidates: Positive[int] = 15, very_accurate: bool = False, silence_threshold: float = 0.03, voicing_threshold: float = 0.45, octave_cost: float = 0.01, octave_jump_cost: float = 0.35, voiced_unvoiced_cost: float = 0.14, pitch_ceiling: Positive[float] = 600.0) parselmouth.Pitch
- to_pitch_cc(self: parselmouth.Sound, time_step: Positive[float] | None = None, pitch_floor: Positive[float] = 75.0, max_number_of_candidates: Positive[int] = 15, very_accurate: bool = False, silence_threshold: float = 0.03, voicing_threshold: float = 0.45, octave_cost: float = 0.01, octave_jump_cost: float = 0.35, voiced_unvoiced_cost: float = 0.14, pitch_ceiling: Positive[float] = 600.0) parselmouth.Pitch
- to_pitch_shs(self: parselmouth.Sound, time_step: Positive[float] = 0.01, minimum_pitch: Positive[float] = 50.0, max_number_of_candidates: Positive[int] = 15, maximum_frequency_component: Positive[float] = 1250.0, max_number_of_subharmonics: Positive[int] = 15, compression_factor: Positive[float] = 0.84, ceiling: Positive[float] = 600.0, number_of_points_per_octave: Positive[int] = 48) parselmouth.Pitch
- to_pitch_spinet(self: parselmouth.Sound, time_step: Positive[float] = 0.005, window_length: Positive[float] = 0.04, minimum_filter_frequency: Positive[float] = 70.0, maximum_filter_frequency: Positive[float] = 5000.0, number_of_filters: Positive[int] = 250, ceiling: Positive[float] = 500.0, max_number_of_candidates: Positive[int] = 15) parselmouth.Pitch
- to_spectrogram(self: parselmouth.Sound, window_length: Positive[float] = 0.005, maximum_frequency: Positive[float] = 5000.0, time_step: Positive[float] = 0.002, frequency_step: Positive[float] = 20.0, window_shape: parselmouth.SpectralAnalysisWindowShape = <SpectralAnalysisWindowShape.GAUSSIAN: 5>) parselmouth.Spectrogram
- to_spectrum(self: parselmouth.Sound, fast: bool = True) parselmouth.Spectrum
- property n_channels
- property n_samples
- property sampling_frequency
- property sampling_period
- class parselmouth.SoundFileFormat
Bases:
pybind11_object
- __index__(self: parselmouth.SoundFileFormat) int
- __init__(self: parselmouth.SoundFileFormat, value: int) None
- __init__(self: parselmouth.SoundFileFormat, arg0: str) None
- __int__(self: parselmouth.SoundFileFormat) int
- __str__()
name(self: handle) -> str
- AIFC = <SoundFileFormat.AIFC: 2>
- AIFF = <SoundFileFormat.AIFF: 1>
- FLAC = <SoundFileFormat.FLAC: 5>
- KAY = <SoundFileFormat.KAY: 6>
- NEXT_SUN = <SoundFileFormat.NEXT_SUN: 3>
- NIST = <SoundFileFormat.NIST: 4>
- RAW_16_BE = <SoundFileFormat.RAW_16_BE: 12>
- RAW_16_LE = <SoundFileFormat.RAW_16_LE: 13>
- RAW_24_BE = <SoundFileFormat.RAW_24_BE: 14>
- RAW_24_LE = <SoundFileFormat.RAW_24_LE: 15>
- RAW_32_BE = <SoundFileFormat.RAW_32_BE: 16>
- RAW_32_LE = <SoundFileFormat.RAW_32_LE: 17>
- RAW_8_SIGNED = <SoundFileFormat.RAW_8_SIGNED: 10>
- RAW_8_UNSIGNED = <SoundFileFormat.RAW_8_UNSIGNED: 11>
- SESAM = <SoundFileFormat.SESAM: 7>
- WAV = <SoundFileFormat.WAV: 0>
- WAV_24 = <SoundFileFormat.WAV_24: 8>
- WAV_32 = <SoundFileFormat.WAV_32: 9>
- property name
- property value
- class parselmouth.SpectralAnalysisWindowShape
Bases:
pybind11_object
- __index__(self: parselmouth.SpectralAnalysisWindowShape) int
- __init__(self: parselmouth.SpectralAnalysisWindowShape, value: int) None
- __init__(self: parselmouth.SpectralAnalysisWindowShape, arg0: str) None
- __int__(self: parselmouth.SpectralAnalysisWindowShape) int
- __str__()
name(self: handle) -> str
- BARTLETT = <SpectralAnalysisWindowShape.BARTLETT: 2>
- GAUSSIAN = <SpectralAnalysisWindowShape.GAUSSIAN: 5>
- HAMMING = <SpectralAnalysisWindowShape.HAMMING: 1>
- HANNING = <SpectralAnalysisWindowShape.HANNING: 4>
- SQUARE = <SpectralAnalysisWindowShape.SQUARE: 0>
- WELCH = <SpectralAnalysisWindowShape.WELCH: 3>
- property name
- property value
- class parselmouth.Spectrogram
Bases:
TimeFrameSampled
,Matrix
- __init__(*args, **kwargs)
- get_power_at(self: parselmouth.Spectrogram, time: float, frequency: float) float
- synthesize_sound(self: parselmouth.Spectrogram, sampling_frequency: Positive[float] = 44100.0) parselmouth.Sound
- to_sound(self: parselmouth.Spectrogram, sampling_frequency: Positive[float] = 44100.0) parselmouth.Sound
- to_spectrum_slice(self: parselmouth.Spectrogram, time: float) parselmouth.Spectrum
- class parselmouth.Spectrum
Bases:
Matrix
- __getitem__(self: parselmouth.Spectrum, index: int) complex
- __init__(self: parselmouth.Spectrum, values: numpy.ndarray[numpy.float64], maximum_frequency: Positive[float]) None
- __init__(self: parselmouth.Spectrum, values: numpy.ndarray[numpy.complex128], maximum_frequency: Positive[float]) None
- __setitem__(self: parselmouth.Spectrum, index: int, value: complex) None
- cepstral_smoothing(self: parselmouth.Spectrum, bandwidth: Positive[float] = 500.0) parselmouth.Spectrum
- get_band_density(self: parselmouth.Spectrum, band_floor: float | None = None, band_ceiling: float | None = None) float
- get_band_density(self: parselmouth.Spectrum, band: Tuple[float | None, float | None] = (None, None)) float
- get_band_density_difference(self: parselmouth.Spectrum, low_band_floor: float | None = None, low_band_ceiling: float | None = None, high_band_floor: float | None = None, high_band_ceiling: float | None = None) float
- get_band_density_difference(self: parselmouth.Spectrum, low_band: Tuple[float | None, float | None] = (None, None), high_band: Tuple[float | None, float | None] = (None, None)) float
- get_band_energy(self: parselmouth.Spectrum, band_floor: float | None = None, band_ceiling: float | None = None) float
- get_band_energy(self: parselmouth.Spectrum, band: Tuple[float | None, float | None] = (None, None)) float
- get_band_energy_difference(self: parselmouth.Spectrum, low_band_floor: float | None = None, low_band_ceiling: float | None = None, high_band_floor: float | None = None, high_band_ceiling: float | None = None) float
- get_band_energy_difference(self: parselmouth.Spectrum, low_band: Tuple[float | None, float | None] = (None, None), high_band: Tuple[float | None, float | None] = (None, None)) float
- get_bin_number_from_frequency(self: parselmouth.Spectrum, frequency: float) float
- get_bin_width(self: parselmouth.Spectrum) float
- get_center_of_gravity(self: parselmouth.Spectrum, power: Positive[float] = 2.0) float
- get_central_moment(self: parselmouth.Spectrum, moment: Positive[float], power: Positive[float] = 2.0) float
- get_centre_of_gravity(self: parselmouth.Spectrum, power: Positive[float] = 2.0) float
- get_frequency_from_bin_number(self: parselmouth.Spectrum, band_number: Positive[int]) float
- get_highest_frequency(self: parselmouth.Spectrum) float
- get_imaginary_value_in_bin(self: parselmouth.Spectrum, bin_number: Positive[int]) float
- get_kurtosis(self: parselmouth.Spectrum, power: Positive[float] = 2.0) float
- get_lowest_frequency(self: parselmouth.Spectrum) float
- get_number_of_bins(self: parselmouth.Spectrum) int
- get_real_value_in_bin(self: parselmouth.Spectrum, bin_number: Positive[int]) float
- get_skewness(self: parselmouth.Spectrum, power: Positive[float] = 2.0) float
- get_standard_deviation(self: parselmouth.Spectrum, power: Positive[float] = 2.0) float
- get_value_in_bin(self: parselmouth.Spectrum, bin_number: Positive[int]) complex
- lpc_smoothing(self: parselmouth.Spectrum, num_peaks: Positive[int] = 5, pre_emphasis_from: Positive[float] = 50.0) parselmouth.Spectrum
- set_imaginary_value_in_bin(self: parselmouth.Spectrum, bin_number: Positive[int], value: float) None
- set_real_value_in_bin(self: parselmouth.Spectrum, bin_number: Positive[int], value: float) None
- set_value_in_bin(self: parselmouth.Spectrum, bin_number: Positive[int], value: complex) None
- to_sound(self: parselmouth.Spectrum) parselmouth.Sound
- to_spectrogram(self: parselmouth.Spectrum) parselmouth.Spectrogram
- property bin_width
- property df
- property fmax
- property fmin
- property highest_frequency
- property lowest_frequency
- property n_bins
- property nf
- class parselmouth.TextGrid
Bases:
Function
- __init__(self: parselmouth.TextGrid, start_time: float, end_time: float, tier_names: str, point_tier_names: str) None
- __init__(self: parselmouth.TextGrid, start_time: float, end_time: float, tier_names: List[str] = [], point_tier_names: List[str] = []) None
- __init__(self: parselmouth.TextGrid, tgt_text_grid: tgt.core.TextGrid) None
- static from_tgt(tgt_text_grid: tgt.core.TextGrid) parselmouth.TextGrid
- to_tgt(self: parselmouth.TextGrid, *, include_empty_intervals: bool = False) tgt.core.TextGrid
- class parselmouth.Thing
Bases:
pybind11_object
- __init__(*args, **kwargs)
- __str__(self: parselmouth.Thing) str
- info(self: parselmouth.Thing) str
- property class_name
- property full_name
- property name
- class parselmouth.TimeFrameSampled
Bases:
TimeFunction
,Sampled
- __init__(*args, **kwargs)
- frame_number_to_time(self: parselmouth.Sampled, frame_number: Positive[int]) float
- get_frame_number_from_time(self: parselmouth.Sampled, time: float) float
- get_number_of_frames(self: parselmouth.Sampled) int
- get_time_from_frame_number(self: parselmouth.Sampled, frame_number: Positive[int]) float
- get_time_step(self: parselmouth.Sampled) float
- t_bins(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]
- t_grid(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]
- time_to_frame_number(self: parselmouth.Sampled, time: float) float
- ts(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]
- property dt
- property n_frames
- property nt
- property t1
- property time_step
- class parselmouth.TimeFunction
Bases:
Function
- __init__(*args, **kwargs)
- get_end_time(self: parselmouth.Function) float
- get_start_time(self: parselmouth.Function) float
- get_total_duration(self: parselmouth.Function) float
- scale_times_by(self: parselmouth.Function, scale: Positive[float]) None
- scale_times_to(self: parselmouth.Function, new_start_time: float, new_end_time: float) None
- shift_times_by(self: parselmouth.Function, seconds: float) None
- shift_times_to(self: parselmouth.Function, time: float, new_time: float) None
- shift_times_to(self: parselmouth.Function, time: str, new_time: float) None
- property centre_time
- property duration
- property end_time
- property start_time
- property time_range
- property tmax
- property tmin
- property total_duration
- property trange
- class parselmouth.ValueInterpolation
Bases:
pybind11_object
- __index__(self: parselmouth.ValueInterpolation) int
- __init__(self: parselmouth.ValueInterpolation, value: int) None
- __init__(self: parselmouth.ValueInterpolation, arg0: str) None
- __int__(self: parselmouth.ValueInterpolation) int
- __str__()
name(self: handle) -> str
- CUBIC = <ValueInterpolation.CUBIC: 2>
- LINEAR = <ValueInterpolation.LINEAR: 1>
- NEAREST = <ValueInterpolation.NEAREST: 0>
- SINC70 = <ValueInterpolation.SINC70: 3>
- SINC700 = <ValueInterpolation.SINC700: 4>
- property name
- property value
- class parselmouth.Vector
Bases:
Matrix
- __add__(self: parselmouth.Vector, number: float) parselmouth.Vector
- __iadd__(self: parselmouth.Vector, number: float) parselmouth.Vector
- __imul__(self: parselmouth.Vector, factor: float) parselmouth.Vector
- __init__(*args, **kwargs)
- __isub__(self: parselmouth.Vector, number: float) parselmouth.Vector
- __itruediv__(self: parselmouth.Vector, factor: float) parselmouth.Vector
- __mul__(self: parselmouth.Vector, factor: float) parselmouth.Vector
- __radd__(self: parselmouth.Vector, number: float) parselmouth.Vector
- __rmul__(self: parselmouth.Vector, factor: float) parselmouth.Vector
- __sub__(self: parselmouth.Vector, number: float) parselmouth.Vector
- __truediv__(self: parselmouth.Vector, factor: float) parselmouth.Vector
- add(self: parselmouth.Vector, number: float) None
- divide(self: parselmouth.Vector, factor: float) None
- get_value(self: parselmouth.Vector, x: float, channel: Optional[int] = None, interpolation: parselmouth.ValueInterpolation = <ValueInterpolation.CUBIC: 2>) float
- multiply(self: parselmouth.Vector, factor: float) None
- scale(self: parselmouth.Vector, scale: Positive[float]) None
- scale_peak(self: parselmouth.Vector, new_peak: Positive[float] = 0.99) None
- subtract(self: parselmouth.Vector, number: float) None
- subtract_mean(self: parselmouth.Vector) None
- class parselmouth.WindowShape
Bases:
pybind11_object
- __index__(self: parselmouth.WindowShape) int
- __init__(self: parselmouth.WindowShape, value: int) None
- __init__(self: parselmouth.WindowShape, arg0: str) None
- __int__(self: parselmouth.WindowShape) int
- __str__()
name(self: handle) -> str
- GAUSSIAN1 = <WindowShape.GAUSSIAN1: 5>
- GAUSSIAN2 = <WindowShape.GAUSSIAN2: 6>
- GAUSSIAN3 = <WindowShape.GAUSSIAN3: 7>
- GAUSSIAN4 = <WindowShape.GAUSSIAN4: 8>
- GAUSSIAN5 = <WindowShape.GAUSSIAN5: 9>
- HAMMING = <WindowShape.HAMMING: 4>
- HANNING = <WindowShape.HANNING: 3>
- KAISER1 = <WindowShape.KAISER1: 10>
- KAISER2 = <WindowShape.KAISER2: 11>
- PARABOLIC = <WindowShape.PARABOLIC: 2>
- RECTANGULAR = <WindowShape.RECTANGULAR: 0>
- TRIANGULAR = <WindowShape.TRIANGULAR: 1>
- property name
- property value
- parselmouth.read(file_path: str) parselmouth.Data
Read a file into a
parselmouth.Data
object.- Parameters:
file_path (str) – The path of the file on disk to read.
- Returns:
The Praat Data object that was read.
- Return type:
See also
- parselmouth.praat.call(command: str, *args, **kwargs) object
- parselmouth.praat.call(object: parselmouth.Data, command: str, *args, **kwargs) object
- parselmouth.praat.call(objects: List[parselmouth.Data], command: str, *args, **kwargs) object
Call a Praat command.
This function provides a Python interface to call available Praat commands based on the label in the Praat user interface and documentation, similar to the Praat scripting language.
Calling a Praat command through this function roughly corresponds to the following scenario in the Praat user interface or scripting language:
Zero, one, or multiple
parselmouth.Data
objects are put into Praat’s global object list and are ‘selected’.The Python argument values are converted into Praat values; see below.
The Praat command is executed on the selected objects with the converted values as arguments.
The result of the command is returned. The type of the result depends on the result of the Praat command; see below.
Praat’s object list is emptied again, such that a future execution of this function is independent from the current call.
The use of
call
is demonstrated in the Pitch manipulation and Praat commands example.- Parameters:
object (parselmouth.Data) – A single object to add to the Praat object list, which will be selected when the Praat command is called.
objects (List[parselmouth.Data]) – Multiple objects to be added to the Praat object list, which will be selected when the Praat command is called.
command (str) – The Praat action to call. This is the same command name as one would use in a Praat script and corresponds to the label on the button in the Praat user interface.
*args –
The list of values to be passed as arguments to the Praat command. Allowed types for these arguments are:
bool
: converted into"yes"
/"no"
str
: passed as Praat string valuenumpy.ndarray
: passed as Praat vector or matrix, if the array contains numeric values and is 1D or 2D, respectively.
- Keyword Arguments:
extra_objects (List[parselmouth.Data]) – Extra objects added to the Praat object list that will not be selected when the command is called (default value:
[]
).return_string (bool) – Return the raw string written in the Praat info window instead of the converted Python object (default value:
False
).
- Returns:
The result of the Praat command. The actual value returned depends on what the Praat command does. The following types can be returned:
If
return_string=True
was passed, astr
value is returned, which contains the text that would have been written to the Praat info window.A
float
,int
,bool
, orcomplex
value is returned when the Praat command would write such a value to the Praat info window.A
numpy.ndarray
value is returned if the command returns a Praat vector or matrix.A
parselmouth.Data
object is returned if the command always creates exactly one object. If the actual type of the Praat object is available in Parselmouth, an object of a subtype ofparselmouth.Data
is returned.A list of
parselmouth.Data
objects is returned if the command can create multiple new objects (even if this particular execution of the command only added one object to the Praat object list).A
str
is returned when a string or info text would be written to the Praat info window.
- Return type:
- parselmouth.praat.run(script: str, *args, **kwargs) object
- parselmouth.praat.run(object: parselmouth.Data, script: str, *args, **kwargs) object
- parselmouth.praat.run(objects: List[parselmouth.Data], script: str, *args, **kwargs) object
Run a Praat script.
Given a string with the contents of a Praat script, run this script as if it was run inside Praat itself. Similarly to
parselmouth.praat.call
, Parselmouth objects and Python argument values can be passed into the script.Calling this function roughly corresponds to the following sequence of steps in Praat:
Zero, one, or multiple
parselmouth.Data
objects are put into Praat’s global object list and are ‘selected’.The Python argument values are converted into Praat values; see
call
.The Praat script is opened and run with the converted values as arguments; see Praat: “Scripting 6.1. Arguments to the script”.
The results of the execution of the script are returned; see below.
Praat’s object list is emptied again, such that a future execution of this function is independent from the current call.
Note that the script will be run in Praat’s so-called ‘batch’ mode; see Praat: “Scripting 6.9. Calling from the command line”. Since the script is run from inside a Python program, the Praat functionality is run without graphical user interface and no windows (such as “View & Edit”) can be opened by the Praat script. However, the functionality in these windows is also available in different ways: for example, opening a Sound object in a “View & Edit” window, making a selection, and choosing “Extract selected sound (windowed)…” can also be achieved by directly using the “Extract part…” command of the Sound object.
- Parameters:
object (parselmouth.Data) – A single object to add to the Praat object list, which will be selected when the Praat script is run.
objects (List[parselmouth.Data]) – Multiple objects to be added to the Praat object list, which will be selected when the Praat script is run.
script (str) – The content of the Praat script to be run.
*args – The list of values to be passed as arguments to the Praat script. For more details on the allowed types of these argument, see
call
.
- Keyword Arguments:
extra_objects (List[parselmouth.Data]) – Extra objects added to the Praat object list that will not be selected when the command is called (default value:
[]
).capture_output (bool) – Intercept and also return the output written to the Praat info window, instead of forwarding it to the Python standard output; see below (default value:
False
).return_variables (bool) – Also return a
dict
of the Praat variables and their values at the end of the script’s execution; see below (default value:False
).
- Returns:
A list of
parselmouth.Data
objects selected at the end of the script’s execution.Optionally, extra values are returned:
A
str
containing the intercepted output ifcapture_output=True
was passed.A
dict
mapping variable names (str
) to their values (object
) ifreturn_variables
isTrue
. The values of Praat’s variables get converted to Python values:A Praat string variable, with a name ending in
$
, is returned asstr
value.A Praat vector or matrix variable, respectively ending in
#
or##
, is returned asnumpy.ndarray
.A numeric variable, without variable name suffix, is converted to a Python
float
.
- Return type:
- parselmouth.praat.run_file(path: str, *args, **kwargs) object
- parselmouth.praat.run_file(object: parselmouth.Data, path: str, *args, **kwargs) object
- parselmouth.praat.run_file(objects: List[parselmouth.Data], path: str, *args, **kwargs) object
Run a Praat script from file.
Given the filename of a Praat script, the script is read and run the same way as a script string passed to
parselmouth.praat.run
. Seerun
for details on the manner in which the script gets executed.One thing to note is that relative filenames in the Praat script (including those in potential ‘include’ statements in the script; see Praat: “Scripting 5.8. Including other scripts”) will be resolved relative to the path of the script file, just like in Praat. Also note that Praat accomplishes this by temporarily changing the current working during the execution of the script.
- Parameters:
object (parselmouth.Data) – A single object to add to the Praat object list, which will be selected when the Praat script is run.
objects (List[parselmouth.Data]) – Multiple objects to be added to the Praat object list, which will be selected when the Praat script is run.
path (str) – The filename of the Praat script to run.
*args – The list of values to be passed as arguments to the Praat script. For more details on the allowed types of these argument, see
call
.
- Keyword Arguments:
keep_cwd (bool) – Keep the current working directory (see
os.getcwd
) when running the script, rather than changing it to the script’s parent directory, as Praat does by default (default value:False
). Note that even when set toTrue
, the filenames in the Praat script’s include statements will be resolved relatively to the directory containing the script.**kwargs – See
parselmouth.praat.run
.
- Returns:
- Return type: