Ejemplo n.º 1
0
import wave
import struct
from ev3.rawdevice import Sound
import time

frequency=[ 523, 578, 659, 698, 784, 880, 988 ]




notes=[ 3, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 3, 2, 2, 3, 3,
                4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 2, 1, 1 ]
beats=[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 4, 2, 2, 2,
                2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 4 ]
Sound.init()

for (note,beat) in zip(notes, beats):
    print frequency[note],beat
    Sound.playTone(frequency[note],beat*100*2)
    time.sleep(beat/10.0*2)

Sound.close()

    
Ejemplo n.º 2
0
 def tearDown(self):
     Sound.close()
Ejemplo n.º 3
0
 def setUp(self):
     Sound.init()
Ejemplo n.º 4
0
 def test_lcd(self):
     Sound.playTone(697, 200)