forked from auracaster/pyalsaaudio
isine example: actually play some tones
the thread in the background actually needs time to do something sensible. this is most easily achieved by simply sleeping in the foreground thread. i addition to the 440 Hz tone, also play 1 kHz, to demonstrate how the change() function is used.
This commit is contained in:
8
isine.py
8
isine.py
@@ -7,6 +7,7 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from multiprocessing import Queue
|
from multiprocessing import Queue
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ class SinePlayer(Thread):
|
|||||||
isine = SinePlayer()
|
isine = SinePlayer()
|
||||||
isine.start()
|
isine.start()
|
||||||
|
|
||||||
def change(f):
|
time.sleep(1)
|
||||||
isine.change(f)
|
isine.change(1000)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user