This enables the specific use case of checking whether a note's release phase has ended, but is also potentially useful to implement a sort of "voice stealing" algorithm in Python code, which can take account of the note's envelope state as well as other factors specific to the program.
18 lines
404 B
Python
18 lines
404 B
Python
from synthio import Synthesizer, Note, Envelope
|
|
from audiocore import get_buffer
|
|
|
|
s = Synthesizer()
|
|
n = Note(440, envelope=Envelope())
|
|
print("{} {:.2f}".format(*s.note_info(n)))
|
|
s.press(n)
|
|
print("press")
|
|
for _ in range(9):
|
|
print("{} {:.2f}".format(*s.note_info(n)))
|
|
get_buffer(s)
|
|
|
|
s.release(n)
|
|
print("release")
|
|
for _ in range(11):
|
|
print("{} {:.2f}".format(*s.note_info(n)))
|
|
get_buffer(s)
|