Utilities

Array operations

frame(x, frame_length, hop_length[, axis])

Slice a data array into (overlapping) frames.

pad_center(data, size[, axis])

Pad an array to a target length along a target axis.

fix_length(data, size[, axis])

Fix the length an array data to exactly size along a target axis.

fix_frames(frames[, x_min, x_max, pad])

Fix a list of frames to lie within [x_min, x_max]

index_to_slice(idx[, idx_min, idx_max, …])

Generate a slice array from an index array.

softmask(X, X_ref[, power, split_zeros])

Robustly compute a soft-mask operation.

stack(arrays[, axis])

Stack one or more arrays along a target axis.

sync(data, idx[, aggregate, pad, axis])

Synchronous aggregation of a multi-dimensional array between boundaries

axis_sort(S[, axis, index, value])

Sort an array along its rows or columns.

normalize(S[, norm, axis, threshold, fill])

Normalize an array along a chosen axis.

shear(X[, factor, axis])

Shear a matrix by a given factor.

sparsify_rows(x[, quantile, dtype])

Return a row-sparse matrix approximating the input

buf_to_float(x[, n_bytes, dtype])

Convert an integer buffer to floating point values.

tiny(x)

Compute the tiny-value corresponding to an input’s data type.

Matching

match_intervals(intervals_from, intervals_to)

Match one set of time intervals to another.

match_events(events_from, events_to[, left, …])

Match one set of events to another.

Miscellaneous

localmax(x[, axis])

Find local maxima in an array

localmin(x[, axis])

Find local minima in an array

peak_pick(x, pre_max, post_max, pre_avg, …)

Uses a flexible heuristic to pick peaks in a signal.

nnls(A, B, **kwargs)

Non-negative least squares.

cyclic_gradient(data[, edge_order, axis])

Estimate the gradient of a function over a uniformly sampled, periodic domain.

dtype_c2r(d[, default])

Find the real numpy dtype corresponding to a complex dtype.

dtype_r2c(d[, default])

Find the complex numpy dtype corresponding to a real dtype.

Input validation

valid_audio(y[, mono])

Determine whether a variable contains valid audio data.

valid_int(x[, cast])

Ensure that an input value is integer-typed.

valid_intervals(intervals)

Ensure that an array is a valid representation of time intervals:

File operations

example(key[, hq])

Retrieve the example recording identified by ‘key’.

example_info(key)

Display licensing and metadata information for the given example recording.

list_examples()

List the available audio recordings included with librosa.

find_files(directory[, ext, recurse, …])

Get a sorted list of (audio) files in a directory or directory sub-tree.

Deprecated

example_audio_file()

Get the path to an included audio example file.