remix()¶
- audresample.remix(signal, channels=None, mixdown=False, *, upmix=None, always_copy=False)[source]¶
Remix a signal.
The
channels
arguments allows to select one or more channels and/or re-order them. Examples:channels
result
None
all channels
0
first channel
1
second channel
-1
last channel
-2
second last channel
[0, 1]
first two channels
[1, 0]
first two channels in swapped order
[0, -1]
first and last channel
[1, 1]
twice the second channel
range(3)
first three channels
If the input signal has not enough channels to fulfill the
channels
selection you can select anupmix
method to fill in the missing channels. The workflow ofaudresample.remix()
is always upmix -> channel selection -> downmix.The returned signal always of shape (
channels
,samples
).- Parameters
signal (
ndarray
) – array with signal valueschannels (
Union
[int
,Sequence
[int
],None
]) – channel selection, see descriptionmixdown (
bool
) – apply mono mix-down on selectionupmix (
Optional
[str
]) – if'zeros'
it will pad missing channels with zeros, if'repeat'
it will pad by repeating the existing channelsalways_copy (
bool
) – ifTrue
always returns a new object
- Return type
- Returns
remixed signal with shape
(number of channels, number of samples)
- Raises
RuntimeError – if input signal has more than two dimensions
ValueError – if channel selection is invalid and upmix is
None
ValueError – if specified upmix method is not known