Recovers waveform from quantized values.
(output, quantization_channels)
| 76 | |
| 77 | |
| 78 | def 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 |
no outgoing calls