mirror of
https://github.com/romanz/amodem.git
synced 2026-04-03 11:06:24 +08:00
Allow more silence before transmission
This commit is contained in:
@@ -124,10 +124,13 @@ def create_parser(description, interface_factory):
|
||||
sender.add_argument(
|
||||
'-g', '--gain', type=float, default=1.0,
|
||||
help='Modulator gain (defaults to 1)')
|
||||
sender.add_argument(
|
||||
'--silence', type=float, default=0.0,
|
||||
help='Extra silence before sending the data (in seconds)')
|
||||
sender.set_defaults(
|
||||
main=lambda config, args: main.send(
|
||||
config, src=wrap(Compressor, args.src, args.zlib), dst=args.dst,
|
||||
gain=args.gain
|
||||
gain=args.gain, extra_silence=args.silence
|
||||
),
|
||||
calib=lambda config, args: calib.send(
|
||||
config=config, dst=args.dst,
|
||||
|
||||
@@ -10,12 +10,12 @@ from . import framing, common, stream, detect, sampling
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def send(config, src, dst, gain=1.0):
|
||||
def send(config, src, dst, gain=1.0, extra_silence=0.0):
|
||||
sender = _send.Sender(dst, config=config, gain=gain)
|
||||
Fs = config.Fs
|
||||
|
||||
# pre-padding audio with silence (priming the audio sending queue)
|
||||
sender.write(np.zeros(int(Fs * config.silence_start)))
|
||||
sender.write(np.zeros(int(Fs * (config.silence_start + extra_silence))))
|
||||
|
||||
sender.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user