From 4d56f34a726c444d5db35dca58637dbe0e798884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Veres-Szentkir=C3=A1lyi?= Date: Fri, 22 Nov 2013 17:00:53 +0100 Subject: [PATCH] gen_values: fixed FM sample repetition bug In the previous version, the FM modulator issued the last sample of the previous frequency-time tuple twice, once as the last sample of the previous tuple, once as the first sample (sample = 0) of the next one. --- pysstv/sstv.py | 2 +- pysstv/tests/test_sstv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pysstv/sstv.py b/pysstv/sstv.py index 5f8d6f3..496a953 100644 --- a/pysstv/sstv.py +++ b/pysstv/sstv.py @@ -83,7 +83,7 @@ class SSTV(object): freq_factor = freq * factor for sample in xrange(tx): yield sin(sample * freq_factor + offset) - offset += sample * freq_factor + offset += (sample + 1) * freq_factor samples -= tx def gen_freq_bits(self): diff --git a/pysstv/tests/test_sstv.py b/pysstv/tests/test_sstv.py index 022f135..ffcd630 100644 --- a/pysstv/tests/test_sstv.py +++ b/pysstv/tests/test_sstv.py @@ -69,7 +69,7 @@ class TestSSTV(unittest.TestCase): mock_open = MagicMock(return_value=sio) with mock.patch('__builtin__.open', mock_open): self.s.write_wav('unittest.wav') - expected = '8aa1d52b222b411e032ce2bce77d203a' + expected = 'dd7eed880ab3360fb79ce09c469deee2' data = sio.getvalue() actual = hashlib.md5(data).hexdigest() self.assertEqual(expected, actual)