ulaw#
- class diffsptk.MuLawCompression(abs_max=1, mu=255)[source]#
See this page for details.
- Parameters:
- abs_maxfloat > 0
The absolute maximum value of the input waveform.
- muint >= 1
The compression factor, \(\mu\).
- forward(x)[source]#
Compress the input waveform using the \(\mu\)-law algorithm.
- Parameters:
- xTensor [shape=(…,)]
The input waveform.
- Returns:
- outTensor [shape=(…,)]
The compressed waveform.
Examples
>>> x = diffsptk.ramp(4) >>> ulaw = diffsptk.MuLawCompression(4) >>> y = ulaw(x) >>> y tensor([0.0000, 3.0084, 3.5028, 3.7934, 4.0000])
- diffsptk.functional.ulaw(x, abs_max=1, mu=255)[source]#
Compress the input waveform using the \(\mu\)-law algorithm.
- Parameters:
- xTensor [shape=(…,)]
The input waveform.
- abs_maxfloat > 0
The absolute maximum value of the input waveform.
- muint >= 1
The compression factor, \(\mu\).
- Returns:
- outTensor [shape=(…,)]
The compressed waveform.
See also