/liblc3-3.7.0-3.6.0/test/ |
D | bitstream.py | 21 def __init__(self, data): argument 23 self.bytes = data 25 self.bp_bw = len(data) - 1 26 self.mask_bw = 1 28 self.bp = 0 29 self.low = 0 30 self.range = 0xffffff 32 def dump(self): argument 34 b = self.bytes 42 def __init__(self, data): argument [all …]
|
D | ltpf.py | 27 def __init__(self, dt, sr, history = 0): argument 29 self.sr = sr 30 self.p = 192 // T.SRATE_KHZ[sr] 31 self.w = 240 // self.p 33 self.n = ((T.DT_MS[dt] * 128) / 10).astype(int) 34 self.d = [ 44, 24 ][dt] 36 self.x = np.zeros(self.w + T.NS[dt][sr]) 37 self.u = np.zeros(self.n + 2) 38 self.y = np.zeros(self.n + self.d + history) 40 def resample(self, x): argument [all …]
|
D | sns.py | 27 def __init__(self, dt, sr): argument 29 self.dt = dt 30 self.sr = sr 32 (self.ind_lf, self.ind_hf, self.shape, self.gain) = \ 35 (self.idx_a, self.ls_a, self.idx_b, self.ls_b) = \ 38 def get_data(self): argument 40 data = { 'lfcb' : self.ind_lf, 'hfcb' : self.ind_hf, 41 'shape' : self.shape, 'gain' : self.gain, 42 'idx_a' : self.idx_a, 'ls_a' : self.ls_a } 44 if self.idx_b is not None: [all …]
|
D | attdet.py | 27 def __init__(self, dt, sr): argument 29 self.dt = dt 30 self.sr = sr 31 self.ms = T.DT_MS[dt] 33 self.xn1 = 0 34 self.xn2 = 0 35 self.en1 = 0 36 self.an1 = 0 37 self.p_att = 0 39 def is_enabled(self, nbytes): argument [all …]
|
D | encoder.py | 35 def __init__(self, dt_ms, sr_hz): argument 42 self.ne = T.NE[dt][sr] 44 self.attdet = attdet.AttackDetector(dt, sr) 45 self.ltpf = ltpf.LtpfAnalysis(dt, sr) 47 self.mdct = mdct.MdctForward(dt, sr) 48 self.energy = energy.EnergyBand(dt, sr) 49 self.bwdet = bwdet.BandwidthDetector(dt, sr) 50 self.sns = sns.SnsAnalysis(dt, sr) 51 self.tns = tns.TnsAnalysis(dt) 52 self.spec = spec.SpectrumAnalysis(dt, sr) [all …]
|
D | decoder.py | 34 def __init__(self, dt_ms, sr_hz): argument 41 self.sr = sr 42 self.ne = T.NE[dt][sr] 43 self.ns = T.NS[dt][sr] 45 self.mdct = mdct.MdctInverse(dt, sr) 47 self.bwdet = bwdet.BandwidthDetector(dt, sr) 48 self.spec = spec.SpectrumSynthesis(dt, sr) 49 self.tns = tns.TnsSynthesis(dt) 50 self.sns = sns.SnsSynthesis(dt, sr) 51 self.ltpf = ltpf.LtpfSynthesis(dt, sr) [all …]
|
D | tns.py | 66 def __init__(self, dt): argument 68 self.dt = dt 70 (self.nfilters, self.lpc_weighting, self.rc_order, self.rc) = \ 73 def get_data(self): argument 75 return { 'nfilters' : self.nfilters, 76 'lpc_weighting' : self.lpc_weighting, 77 'rc_order' : self.rc_order, 'rc' : self.rc - 8 } 79 def get_nbits(self): argument 81 lpc_weighting = self.lpc_weighting 84 for f in range(self.nfilters): [all …]
|
D | spec.py | 31 def __init__(self, dt, sr): argument 33 self.dt = dt 34 self.sr = sr 36 def get_gain_offset(self, nbytes): argument 38 g_off = (nbytes * 8) // (10 * (1 + self.sr)) 39 g_off = -min(115, g_off) - (105 + 5*(1 + self.sr)) 43 def get_noise_indices(self, bw, xq, lastnz): argument 45 nf_start = [ 18, 24 ][self.dt] 46 nf_width = [ 2, 3 ][self.dt] 48 bw_stop = int([ 80, 160, 240, 320, 400 ][bw] * (T.DT_MS[self.dt] / 10)) [all …]
|
D | bwdet.py | 43 def __init__(self, dt, sr): argument 45 self.dt = dt 46 self.sr = sr 48 def run(self, e): argument 50 dt = self.dt 51 sr = self.sr 76 self.bw = bw 77 return self.bw 79 def get_nbits(self): argument 81 return 0 if self.sr == 0 else \ [all …]
|
D | mdct.py | 30 def __init__(self, dt, sr): argument 32 self.ns = T.NS[dt][sr] 33 self.nd = T.ND[dt][sr] 35 self.t = np.zeros(2*self.ns) 36 self.w = Mdct.W[dt][sr] 41 def __init__(self, dt, sr): argument 45 def run(self, x): argument 47 ns = self.ns 48 nd = self.nd 50 self.t[nd:nd+ns] = x [all …]
|
D | energy.py | 26 def __init__(self, dt, sr): argument 28 self.dt = dt 29 self.I = T.I[dt][sr] 31 def compute(self, x): argument 33 e = [ np.mean(np.square(x[self.I[i]:self.I[i+1]])) 34 for i in range(len(self.I)-1) ] 36 e_lo = np.sum(e[:len(e) - [4, 2][self.dt]]) 37 e_hi = np.sum(e[len(e) - [4, 2][self.dt]:])
|