parselmouth.Sound

Contents

parselmouth.Sound#

class parselmouth.Sound#

Bases: TimeFrameSampled, Vector

A fragment of audio, represented by one or multiple channels of floating point values between -1 and 1, sampled at a fixed sampling frequency.

Corresponds to a Praat: “Sound” object.

Methods

__init__

Create a new Sound object.

add

as_array

at_xy

autocorrelate

combine_to_stereo

concatenate

convert_to_mono

convert_to_stereo

convolve

copy

cross_correlate

de_emphasize

deepen_band_modulation

divide

extract_all_channels

extract_channel

extract_left_channel

extract_part

extract_part_for_overlap

extract_right_channel

formula

frame_number_to_time

get_column_distance

get_end_time

get_energy

get_energy_in_air

get_frame_number_from_time

get_highest_x

get_highest_y

get_index_from_time

get_intensity

get_lowest_x

get_lowest_y

get_maximum

get_minimum

get_nearest_zero_crossing

get_number_of_channels

get_number_of_columns

get_number_of_frames

get_number_of_rows

get_number_of_samples

get_power

get_power_in_air

get_rms

get_root_mean_square

get_row_distance

get_sampling_frequency

get_sampling_period

get_start_time

get_sum

get_time_from_frame_number

get_time_from_index

get_time_step

get_total_duration

get_value

get_value_at_xy

get_value_in_cell

get_x_of_column

get_y_of_row

info

lengthen

multiply

multiply_by_window

override_sampling_frequency

pre_emphasize

read

Read a file into a parselmouth.Data object.

resample

reverse

save

Save a Sound object to an audio file on disk.

save_as_binary_file

save_as_headerless_spreadsheet_file

save_as_matrix_text_file

save_as_short_text_file

save_as_text_file

scale

scale_intensity

scale_peak

scale_times_by

scale_times_to

scale_x_by

scale_x_to

set_to_zero

set_value

shift_times_by

shift_times_to

shift_x_by

shift_x_to

subtract

subtract_mean

t_bins

t_grid

time_to_frame_number

to_formant_burg

to_harmonicity

to_harmonicity_ac

to_harmonicity_cc

to_harmonicity_gne

to_intensity

to_mfcc

to_pitch

to_pitch_ac

to_pitch_cc

to_pitch_shs

to_pitch_spinet

to_spectrogram

to_spectrum

ts

x_bins

x_grid

xs

y_bins

y_grid

ys

Attributes

centre_time

class_name

dt

duration

dx

dy

end_time

full_name

n_channels

n_columns

n_frames

n_rows

n_samples

name

nt

nx

ny

sampling_frequency

sampling_period

start_time

t1

time_range

time_step

tmax

tmin

total_duration

trange

values

x1

xmax

xmin

xrange

y1

ymax

ymin

yrange

class FileFormat#

Bases: pybind11_object

__eq__(self: object, other: object) bool#
__hash__(self: object) int#
__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#
__ne__(self: object, other: object) bool#
__new__(**kwargs)#
__repr__(self: object) str#
__str__()#

name(self: handle) -> str

BINARY = <FileFormat.BINARY: 2>#
SHORT_TEXT = <FileFormat.SHORT_TEXT: 1>#
TEXT = <FileFormat.TEXT: 0>#
property name#
property value#
class ToHarmonicityMethod#

Bases: pybind11_object

__eq__(self: object, other: object) bool#
__hash__(self: object) int#
__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#
__ne__(self: object, other: object) bool#
__new__(**kwargs)#
__repr__(self: object) str#
__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

__eq__(self: object, other: object) bool#
__hash__(self: object) int#
__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#
__ne__(self: object, other: object) bool#
__new__(**kwargs)#
__repr__(self: object) str#
__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#
__add__(self: parselmouth.Vector, number: float) parselmouth.Vector#
__copy__(self: parselmouth.Data) parselmouth.Data#
__deepcopy__(self: parselmouth.Data, memo: dict) parselmouth.Data#
__eq__(self: parselmouth.Data, other: parselmouth.Data) bool#
__iadd__(self: parselmouth.Vector, number: float) parselmouth.Vector#
__imul__(self: parselmouth.Vector, factor: float) parselmouth.Vector#
__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

Create a new Sound object.

The new object can be created: - as a copy of an existing Sound object, - from an array of samples and a sampling frequency, or - by reading an audio file from disk.

Parameters:
  • other (Sound) – The Sound object to copy.

  • samples (array_like[float]) – The samples of the new Sound object.

  • sampling_frequency (float, optional) – The sampling frequency of the new Sound object (default: 44100).

  • start_time (float, optional) – The start time (xmin) of the new Sound object (default: 0).

  • file_name (str, optional) – The file name of the audio file to load.

  • file_path (str) – The file path of an audio file to load from disk.

__isub__(self: parselmouth.Vector, number: float) parselmouth.Vector#
__itruediv__(self: parselmouth.Vector, factor: float) parselmouth.Vector#
__len__(self: parselmouth.Sampled) int#
__mul__(self: parselmouth.Vector, factor: float) parselmouth.Vector#
__ne__(self: parselmouth.Data, other: parselmouth.Data) bool#
__new__(**kwargs)#
__radd__(self: parselmouth.Vector, number: float) parselmouth.Vector#
__rmul__(self: parselmouth.Vector, factor: float) parselmouth.Vector#
__str__(self: parselmouth.Thing) str#
__sub__(self: parselmouth.Vector, number: float) parselmouth.Vector#
__truediv__(self: parselmouth.Vector, factor: float) parselmouth.Vector#
add(self: parselmouth.Vector, number: float) None#
as_array(self: parselmouth.Matrix) numpy.ndarray[numpy.float64]#
at_xy(self: parselmouth.Matrix, x: float, y: float) float#
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#
copy(self: parselmouth.Data) parselmouth.Data#
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#
divide(self: parselmouth.Vector, factor: float) None#
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#
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
frame_number_to_time(self: parselmouth.Sampled, frame_number: Positive[int]) float#
get_column_distance(self: parselmouth.Matrix) float#
get_end_time(self: parselmouth.Function) float#
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_frame_number_from_time(self: parselmouth.Sampled, time: float) float#
get_highest_x(self: parselmouth.Matrix) float#
get_highest_y(self: parselmouth.Matrix) float#
get_index_from_time(self: parselmouth.Sound, time: float) float#
get_intensity(self: parselmouth.Sound) 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_nearest_zero_crossing(self: parselmouth.Sound, time: float, channel: int = 1) float#
get_number_of_channels(self: parselmouth.Sound) int#
get_number_of_columns(self: parselmouth.Matrix) int#
get_number_of_frames(self: parselmouth.Sampled) int#
get_number_of_rows(self: parselmouth.Matrix) 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_row_distance(self: parselmouth.Matrix) float#
get_sampling_frequency(self: parselmouth.Sound) float#
get_sampling_period(self: parselmouth.Sound) float#
get_start_time(self: parselmouth.Function) float#
get_sum(self: parselmouth.Matrix) float#
get_time_from_frame_number(self: parselmouth.Sampled, frame_number: Positive[int]) float#
get_time_from_index(self: parselmouth.Sound, sample: int) float#
get_time_step(self: parselmouth.Sampled) float#
get_total_duration(self: parselmouth.Function) float#
get_value(self: parselmouth.Vector, x: float, channel: Optional[int] = None, interpolation: parselmouth.ValueInterpolation = <ValueInterpolation.CUBIC: 2>) 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#
info(self: parselmouth.Thing) str#
lengthen(self: parselmouth.Sound, minimum_pitch: Positive[float] = 75.0, maximum_pitch: Positive[float] = 600.0, factor: Positive[float]) parselmouth.Sound#
multiply(self: parselmouth.Vector, factor: float) None#
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#
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:

parselmouth.Data

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#

Save a Sound object to an audio file on disk.

Parameters:
  • file_path (str) – The file path of the audio file to save to disk.

  • file_format (SoundFileFormat) – The audio file format to write to. This can either be a SoundFileFormat value (e.g., SoundFileFormat.WAV), or the string representation of the value (e.g., "WAV").

save_as_binary_file(self: parselmouth.Data, file_path: str) None#
save_as_headerless_spreadsheet_file(self: parselmouth.Matrix, file_path: str) None#
save_as_matrix_text_file(self: parselmouth.Matrix, 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#
scale(self: parselmouth.Vector, scale: Positive[float]) None#
scale_intensity(self: parselmouth.Sound, new_average_intensity: float) None#
scale_peak(self: parselmouth.Vector, new_peak: Positive[float] = 0.99) None#
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#
scale_x_by(self: parselmouth.Function, scale: Positive[float]) None#
scale_x_to(self: parselmouth.Function, new_xmin: float, new_xmax: 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#
set_value(self: parselmouth.Matrix, row_number: Positive[int], column_number: Positive[int], new_value: 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
shift_x_by(self: parselmouth.Function, shift: float) None#
shift_x_to(self: parselmouth.Function, x: float, new_x: float) None#
subtract(self: parselmouth.Vector, number: float) None#
subtract_mean(self: parselmouth.Vector) None#
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#
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#
ts(self: parselmouth.Sampled) numpy.ndarray[numpy.float64]#
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]#
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]#
__hash__ = None#
property centre_time#
property class_name#
property dt#
property duration#
property dx#
property dy#
property end_time#
property full_name#
property n_channels#
property n_columns#
property n_frames#
property n_rows#
property n_samples#
property name#
property nt#
property nx#
property ny#
property sampling_frequency#
property sampling_period#
property start_time#
property t1#
property time_range#
property time_step#
property tmax#
property tmin#
property total_duration#
property trange#
property values#
property x1#
property xmax#
property xmin#
property xrange#
property y1#
property ymax#
property ymin#
property yrange#