MCPcopy
hub / github.com/ibab/tensorflow-wavenet / mu_law_decode

Function mu_law_decode

wavenet/ops.py:78–86  ·  view source on GitHub ↗

Recovers waveform from quantized values.

(output, quantization_channels)

Source from the content-addressed store, hash-verified

76
77
78def mu_law_decode(output, quantization_channels):
79 '''Recovers waveform from quantized values.'''
80 with tf.name_scope('decode'):
81 mu = quantization_channels - 1
82 # Map values back to [-1, 1].
83 signal = 2 * (tf.to_float(output) / mu) - 1
84 # Perform inverse of mu-law transformation.
85 magnitude = (1 / mu) * ((1 + mu)**abs(signal) - 1)
86 return tf.sign(signal) * magnitude

Callers 11

mainFunction · 0.90
generate_waveformFunction · 0.90
testDecodeEncodeMethod · 0.90
testMinMaxRangeMethod · 0.90
testEncodeDecodeShiftMethod · 0.90
testEncodeDecodeMethod · 0.90
testDecodeRampMethod · 0.90
testDecodeZerosMethod · 0.90

Calls

no outgoing calls

Tested by 10

generate_waveformFunction · 0.72
testDecodeEncodeMethod · 0.72
testMinMaxRangeMethod · 0.72
testEncodeDecodeShiftMethod · 0.72
testEncodeDecodeMethod · 0.72
testDecodeRampMethod · 0.72
testDecodeZerosMethod · 0.72