mirror of
https://github.com/xiph/opus.git
synced 2025-05-23 11:49:12 +00:00
initial commit
This commit is contained in:
commit
c41afe41f0
4 changed files with 162 additions and 0 deletions
14
dnn/ulaw.py
Normal file
14
dnn/ulaw.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
import numpy as np
|
||||
import math
|
||||
|
||||
def ulaw2lin(u):
|
||||
return (math.exp(u/128*math.log(256))-1)/255
|
||||
|
||||
|
||||
def lin2ulaw(x):
|
||||
s = np.sign(x)
|
||||
x = np.abs(x)
|
||||
u = (s*(128*np.log(1+255*x)/math.log(256)))
|
||||
u = np.round(u)
|
||||
return u.astype('int16')
|
Loading…
Add table
Add a link
Reference in a new issue