| 1 |
""" |
| 2 |
01-data-signal-conversion.py - Conversion from number to audio stream. |
| 3 |
|
| 4 |
The Stream object is a new type introduced by pyo to represent an |
| 5 |
audio signal as a vector of floats. It is sometimes useful to be |
| 6 |
able to convert simple numbers (python's floats or integers) to |
| 7 |
audio signal or to extract numbers from an audio stream. |
| 8 |
|
| 9 |
The Sig object converts a number to an audio stream. |
| 10 |
|
| 11 |
The PyoObject.get() method extracts a float from an audio stream. |
| 12 |
|
| 13 |
""" |
| 14 |
from pyo import * |
| 15 |
|
| 16 |
s = Server().boot() |
| 17 |
|
| 18 |
|
| 19 |
anumber = 100 |
| 20 |
|
| 21 |
|
| 22 |
astream = Sig(anumber) |
| 23 |
|
| 24 |
|
| 25 |
pp = Print(astream, interval=0.1, message="Audio stream value") |
| 26 |
|
| 27 |
|
| 28 |
print("Float from audio stream : ", astream.get()) |
| 29 |
|
| 30 |
s.gui(locals()) |