nadawanie CTCSS

pull/1/head
pawel 2021-11-03 21:19:29 +01:00
rodzic 4ce25e9cc0
commit f894a0f857
2 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -53,6 +53,7 @@ log_handlers = [{
}
}]
ctcss_tone = 88.5
serial_port = '/dev/ttyS0'
serial_baud_rate = 9600
serial_signal = 'DTR' # lub 'RTS'

Wyświetl plik

@ -76,6 +76,7 @@ import os
import pygame
import sys
import logging, logging.handlers
import numpy
# ``os``, ``sys`` and ``time`` doesn't need further explanation, these are
# syandard Python packages.
@ -206,7 +207,13 @@ for el in message:
else:
playlist.append("[sndarray]")
if hasattr(config, 'ctcss_tone'):
volume = 25000
arr = numpy.array([volume * numpy.sin(2.0 * numpy.pi * round(config.ctcss_tone) * x / 16000) for x in range(0, 16000)]).astype(numpy.int16)
arr2 = numpy.c_[arr,arr]
ctcss = pygame.sndarray.make_sound(arr2)
logger.info(COLOR_WARNING + "CTCSS tone %sHz" + COLOR_ENDC + "\n", "%.1f" % config.ctcss_tone)
ctcss.play(-1)
logger.info("playlist elements: %s", " ".join(playlist)+"\n")
logger.info("loading sound samples...")