コード例 #1
0
ファイル: test_sound_pyo.py プロジェクト: NSalem/psychopy
    def test_init(self):
        for note in ['A', 440, '440', [1,2,3,4], numpy.array([1,2,3,4])]:
            sound.Sound(note, secs=.1)
        with pytest.raises(ValueError):
            sound.Sound('this is not a file name')
        with pytest.raises(ValueError):
            sound.Sound(-1) #negative frequency makes no sense
        with pytest.raises(DeprecationWarning):
            sound.setaudioLib('foo')

        points = 100
        snd = numpy.ones(points) / 20

        s = sound.Sound(self.testFile)
コード例 #2
0
    def test_init(self):
        for note in ['A', 440, '440', [1, 2, 3, 4], np.array([1, 2, 3, 4])]:
            sound.Sound(note, secs=.1)
        with pytest.raises(ValueError):
            sound.Sound('this is not a file name')
        with pytest.raises(ValueError):
            sound.Sound(-1)  #negative frequency makes no sense
        with pytest.raises(DeprecationWarning):
            sound.setaudioLib('foo')

        points = 100
        snd = old_div(np.ones(points), 20)

        s = sound.Sound(self.testFile)
コード例 #3
0
ファイル: test_sound_pygame.py プロジェクト: qenops/psychopy
    def test_init(self):
        for note in ['A', 440, '440', [1, 2, 3, 4], numpy.array([1, 2, 3, 4])]:
            sound.Sound(note, secs=.1)
        with pytest.raises(ValueError):
            sound.Sound('this is not a file name')
        with pytest.raises(ValueError):
            sound.Sound(-1)
        with pytest.raises(ValueError):
            sound.Sound(440, secs=-1)
        with pytest.raises(ValueError):
            sound.Sound(440, secs=0)
        with pytest.raises(DeprecationWarning):
            sound.setaudioLib('foo')

        points = 100
        snd = old_div(numpy.ones(points), 20)
コード例 #4
0
    def test_init(self):
        for note in ['A', 440, '440', [1,2,3,4], numpy.array([1,2,3,4])]:
            sound.Sound(note, secs=.1)
        with pytest.raises(ValueError):
            sound.Sound('this is not a file name')
        with pytest.raises(ValueError):
            sound.Sound(-1)
        with pytest.raises(ValueError):
            sound.Sound(440, secs=-1)
        with pytest.raises(ValueError):
            sound.Sound(440, secs=0)
        with pytest.raises(DeprecationWarning):
            sound.setaudioLib('foo')

        points = 100
        snd = old_div(numpy.ones(points), 20)
コード例 #5
0
ファイル: test_sound_pyo.py プロジェクト: dschreij/psychopy
    def test_init(self):
        for note in ['A', 440, '440', [1,2,3,4], numpy.array([1,2,3,4])]:
            sound.Sound(note, secs=.1)
        with pytest.raises(ValueError):
            sound.Sound('this is not a file name')
        with pytest.raises(ValueError):
            sound.Sound(-1)
        with pytest.raises(ValueError):
            sound.Sound(440, secs=-1)
        with pytest.raises(ValueError):
            sound.Sound(440, secs=0)
        with pytest.raises(DeprecationWarning):
            sound.setaudioLib('foo')

        points = 100
        snd = numpy.ones(points) / 20

        testFile = os.path.join(self.tmp, 'green_48000.wav')
        s = sound.Sound(testFile)