def mu_law_decode_nonlinear(output, quantization_channels=256):
'''
Uncompress the waveform amplitudes using mu-law non-linearity.
NOTE: This mu-law functions as a non-linear function.
'''
with tf.name_scope('decode'):
mu = quantization_channels - 1
# Map values back to [-1, 1].
# signal = 2 * (tf.to_float(output) / mu) - 1
signal = output
# Perform inverse of mu-law transformation.
magnitude = (1 / mu) * ((1 + mu)**abs(signal) - 1)
return tf.sign(signal) * magnitude
评论列表
文章目录