added VOX tones

ironpython
András Veres-Szentkirályi 2013-06-19 15:44:30 +02:00
rodzic bf165b0b1e
commit b51fae57e5
2 zmienionych plików z 7 dodań i 0 usunięć

3
run.py
Wyświetl plik

@ -25,6 +25,8 @@ def main():
help='sampling rate (default: 48000)')
parser.add_argument('--bits', dest='bits', type=int, default=16,
help='bits per sample (default: 16)')
parser.add_argument('--vox', dest='vox', action='store_true',
help='add VOX tones at the beginning')
args = parser.parse_args()
image = Image.open(args.img_file)
mode = module_map[args.mode]
@ -33,6 +35,7 @@ def main():
'for mode {m.__name__}').format(m=mode), file=stderr)
raise SystemExit(1)
s = mode(image, args.rate, args.bits)
s.vox_enabled = args.vox
s.write_wav(args.wav_file)

Wyświetl plik

@ -26,6 +26,7 @@ class SSTV(object):
self.image = image
self.samples_per_sec = samples_per_sec
self.bits = bits
self.vox_enabled = False
BITS_TO_STRUCT = {8: 'b', 16: 'h'}
@ -78,6 +79,9 @@ class SSTV(object):
frequency "freq" in Hz and duration "msec" in ms
"""
if self.vox_enabled:
for freq in (1900, 1500, 1900, 1500, 2300, 1500, 2300, 1500):
yield freq, 100
yield FREQ_VIS_START, MSEC_VIS_START
yield FREQ_SYNC, MSEC_VIS_SYNC
yield FREQ_VIS_START, MSEC_VIS_START