File: 01-read-from-disk.py

package info (click to toggle)
python-pyo 1.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,332 kB
  • sloc: python: 135,133; ansic: 127,822; javascript: 16,116; sh: 395; makefile: 388; cpp: 242
file content (26 lines) | stat: -rw-r--r-- 772 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
01-read-from-disk.py - Soundfile playback from disk.

SfPlayer and friends read samples from a file on disk with control
over playback speed and looping mode.

Player family:
    - **SfPlayer** : Reads many soundfile formats from disk.
    - **SfMarkerLooper** : AIFF with markers soundfile looper.
    - **SfMarkerShuffler** : AIFF with markers soundfile shuffler.

Reading sound file from disk can save a lot of RAM, especially if
the soundfile is big, but it is more CPU expensive than loading
the sound file in memory in a first pass.

"""
from pyo import *

s = Server().boot()

path = SNDS_PATH + "/transparent.aif"

# stereo playback with a slight shift between the two channels.
sf = SfPlayer(path, speed=[1, 0.995], loop=True, mul=0.4).out()

s.gui(locals())