| 1 |
01-read-from-disk.py - Soundfile playback from disk. |
| 2 |
============================================================================================================================================ |
| 3 |
|
| 4 |
|
| 5 |
SfPlayer and friends read samples from a file on disk with control |
| 6 |
over playback speed and looping mode. |
| 7 |
|
| 8 |
Player family: |
| 9 |
- **SfPlayer** : Reads many soundfile formats from disk. |
| 10 |
- **SfMarkerLooper** : AIFF with markers soundfile looper. |
| 11 |
- **SfMarkerShuffler** : AIFF with markers soundfile shuffler. |
| 12 |
|
| 13 |
Reading sound file from disk can save a lot of RAM, especially if |
| 14 |
the soundfile is big, but it is more CPU expensive than loading |
| 15 |
the sound file in memory in a first pass. |
| 16 |
|
| 17 |
.. code-block:: python |
| 18 |
|
| 19 |
from pyo import * |
| 20 |
|
| 21 |
s = Server().boot() |
| 22 |
|
| 23 |
path = SNDS_PATH + "/transparent.aif" |
| 24 |
|
| 25 |
# stereo playback with a slight shift between the two channels. |
| 26 |
sf = SfPlayer(path, speed=[1, 0.995], loop=True, mul=0.4).out() |
| 27 |
|
| 28 |
s.gui(locals()) |
| 29 |
|