nvidia.dali.fn.audio_resample¶
- nvidia.dali.fn.audio_resample(*inputs, **kwargs)¶
Resamples an audio signal.
The resampling is achieved by applying a sinc filter with Hann window with an extent controlled by the
quality
argument.The resampling ratio can be specified directly or as a ratio of target to source sampling rate, or calculated from the ratio of the requested output length to the input length.
- Supported backends
‘cpu’
‘gpu’
- Parameters:
input (TensorList) – Input to the operator.
- Keyword Arguments:
bytes_per_sample_hint (int or list of int, optional, default = [0]) –
Output size hint, in bytes per sample.
If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.
dtype (
nvidia.dali.types.DALIDataType
, optional) –The ouput type.
If not specified, the output type is the same as the input type. When the type is changed, the values are normalized to fill the dynamic range of the target data type. When converting floating point inputs to integer types, the input values are assumed to be in -1..1 range. When converting between signed and unsigned types, 0 translates to half-range of the unsigned type. Example:
float -> uint8 -1.0 -> 0 0 -> 128 1.0 -> 255 uint8 -> int16 0 -> -32767 127 -> -128 128 -> 128 255 -> 32767 uint16 -> float 0 -> -1 32767 -> -0.000015 32768 -> 0.000015 65535 -> 1
in_rate (float or TensorList of float, optional) –
Input sampling rate.
The sampling rate of the input sample. This parameter must be specified together with
out_rate
. The value is relative toout_rate
and doesn’t need to use any specific unit as long as the units of input and output rates match.The
in_rate
andout_rate
parameters cannot be specified together withscale
orout_length
.out_length (int or TensorList of int, optional) –
The requested output length, in samples.
The scaling factor is the ratio of this output length to the input length. This parameter cannot be specified together with
in_rate
,out_rate
orscale
.out_rate (float or TensorList of float, optional) –
Output sampling rate.
The requested output sampling rate. This parameter must be specified together with
in_rate
. The value is relative toin_rate
and doesn’t need to use any specific unit as long as the units of input and output rates match.The
in_rate
andout_rate
parameters cannot be specified together withscale
orout_length
.preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.
quality (float, optional, default = 50.0) –
Resampling quality, where 0 is the lowest, and 100 is the highest.
0 gives 3 lobes of the sinc filter, 50 gives 16 lobes, and 100 gives 64 lobes.
scale (float or TensorList of float, optional) –
The scaling factor.
The scaling factor is the ratio of the target sampling rate to source sampling rate. For example, a
scale=2
will produce an output with twice as many samples as the input.This parameter cannot be specified together with
in_rate
andout_rate
orout_length
.seed (int, optional, default = -1) –
Random seed.
If not provided, it will be populated based on the global seed of the pipeline.