diff --git a/amodem/main.py b/amodem/main.py index f593013..43de092 100644 --- a/amodem/main.py +++ b/amodem/main.py @@ -8,8 +8,8 @@ from . import framing, common, stream, detect, sampling log = logging.getLogger(__name__) -def send(config, src, dst): - sender = _send.Sender(dst, config=config) +def send(config, src, dst, gain=1.0): + sender = _send.Sender(dst, config=config, gain=gain) Fs = config.Fs # pre-padding audio with silence (priming the audio sending queue) diff --git a/amodem/send.py b/amodem/send.py index 170bab1..ed0f07b 100644 --- a/amodem/send.py +++ b/amodem/send.py @@ -10,7 +10,8 @@ log = logging.getLogger(__name__) class Sender(object): - def __init__(self, fd, config): + def __init__(self, fd, config, gain=1.0): + self.gain = gain self.offset = 0 self.fd = fd self.modem = dsp.MODEM(config.symbols) @@ -22,7 +23,7 @@ class Sender(object): self.equalizer = equalizer.Equalizer(config) def write(self, sym): - sym = np.array(sym) + sym = np.array(sym) * self.gain data = common.dumps(sym) self.fd.write(data) self.offset += len(sym)