Esempio n. 1
0
    def test_octave_validation(self):
        trck = Track(1, 'C', 'major', 4, 'octave')

        trck.num_voices = 3
        with self.assertRaises(ValueError) as error:
            trck.octave = 6
        self.assertEqual(
            'Range too high. Reduce the number of voices, lower the starting octave, '
            'or choose a larger interval type.', str(error.exception))

        trck.num_voices = 1
        trck.octave = 1
        trck.octave = 7
        with self.assertRaises(ValueError) as error:
            trck.octave = 0
        self.assertEqual(
            'Octave out of range. Select octave in between 1 and 7.',
            str(error.exception))

        with self.assertRaises(ValueError) as error:
            trck.octave = 8
        self.assertEqual(
            'Octave out of range. Select octave in between 1 and 7.',
            str(error.exception))

        with self.assertRaises(TypeError) as error:
            trck.octave = '1'
        self.assertEqual('Octave type error, integer expected.',
                         str(error.exception))
Esempio n. 2
0
import os
import sys
sys.path.insert(0,
                os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

from sonify.arrangement import Track  # noqa

a = Track(3, 'F', 'major', 5, 'octave')
a.octave = 4
print(a.voices)
print(a.voice_freqs)