testSound.py hinzugefügt
This commit is contained in:
27
testSound.py
Normal file
27
testSound.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import time
|
||||||
|
|
||||||
|
from pysinewave import SineWave
|
||||||
|
|
||||||
|
# Create a sine wave, with a starting pitch of 12, and a pitch change speed of 10/second.
|
||||||
|
sinewave = SineWave(pitch = 12, pitch_per_second = 5)
|
||||||
|
# Turn the sine wave on.
|
||||||
|
sinewave.play()
|
||||||
|
|
||||||
|
# Sleep for 2 seconds, as the sinewave keeps playing.
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
|
||||||
|
# Set the goal pitch to -5.
|
||||||
|
sinewave.set_pitch(-5)
|
||||||
|
|
||||||
|
# Sleep for 3 seconds, as the sinewave smoothly slides its pitch down from 12 to -5, and stays there.
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
# Set the goal pitch to -5.
|
||||||
|
sinewave.set_pitch(12)
|
||||||
|
|
||||||
|
# Sleep for 3 seconds, as the sinewave smoothly slides its pitch down from 12 to -5, and stays there.
|
||||||
|
time.sleep(1)
|
||||||
Reference in New Issue
Block a user