shithub: opus

Download patch

ref: 4cf2b2705a461d0eff56e82a5a74f00ef912538c
parent: 2aba2a9c49cd3531013cc8258a3252442095392d
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Sat Jul 28 21:41:18 EDT 2018

fix ulaw2lin()

--- a/dnn/ulaw.py
+++ b/dnn/ulaw.py
@@ -3,7 +3,9 @@
 import math
 
 def ulaw2lin(u):
-    return (math.exp(u/128*math.log(256))-1)/255
+    s = np.sign(u)
+    u = np.abs(u)
+    return s*(np.exp(u/128*math.log(256))-1)/255
 
 
 def lin2ulaw(x):
--