Use 4 carriers wit QAM16 to achieve 16kbps.

This commit is contained in:
Roman Zeyde
2014-06-21 12:55:36 +03:00
parent 5c6304823d
commit fbbc404b45
7 changed files with 71 additions and 49 deletions

View File

@@ -33,12 +33,11 @@ class Filter(object):
class QAM(object):
def __init__(self, bits_per_symbol):
self._enc = {tuple(): 0.0} # End-Of-Stream symbol
def __init__(self, bits_per_symbol, radii):
self._enc = {}
index = 0
amps = [0.6, 1.0]
N = (2 ** bits_per_symbol) / len(amps)
for a in amps:
N = (2 ** bits_per_symbol) / len(radii)
for a in radii:
for i in range(N):
k = tuple(int(index & (1 << j) != 0) for j in range(bits_per_symbol))
v = np.exp(2j * i * np.pi / N)
@@ -61,7 +60,7 @@ class QAM(object):
index = np.argmin(np.abs(s - keys))
yield self._dec[ keys[index] ]
modulator = QAM(bits_per_symbol=4)
modulator = QAM(bits_per_symbol=4, radii=[0.6, 1.0])
def test():
q = QAM(bits_per_symbol=2)