music.horizontal_stack

music.horizontal_stack(*arrays)[source]
Creates a horizontal stack of arrays while preserving bidimensional

data.

This function takes multiple arrays as input and stacks them horizontally. If any of the input arrays are bidimensional (have two dimensions), the function ensures that they are treated as stereo data by duplicating mono channels to both left and right channels.

Parameters:
*arraysarray_like

The arrays to be stacked horizontally. Can be one-dimensional (mono) or two-dimensional (stereo).

Returns:
ndarray

A numpy array representing the horizontal stack of input arrays.

Parameters:

arrays (ArrayLike)

Return type:

NDArray[float64]

Examples

>>> mono_array1 = np.array([0.1, 0.2, 0.3])
>>> mono_array2 = np.array([0.4, 0.5, 0.6])
>>> stereo_array = np.array([[1, 2, 3], [4, 5, 6]])
>>> stacked_array = create_horizontal_stack(mono_array1, stereo_array,
>>>                                         mono_array2)
>>> stacked_array.shape
(2, 9)