Module pippi.buffers
Classes
SoundBuffer
class SoundBuffer(
/,
*args,
**kwargs
)
Class variables
channels
dur
frames
length
mag
max
min
samplerate
Static methods
win
def win(
w,
minvalue=0.0,
maxvalue=1.0,
length=0.0,
samplerate=48000
)
wt
def wt(
w,
minvalue=-1.0,
maxvalue=1.0,
length=0.0,
samplerate=48000
)
Methods
blocks
def blocks(
self,
blocksize
)
clear
def clear(
self
)
clip
def clip(
self,
minval=-1.0,
maxval=1.0
)
convolve
def convolve(
self,
impulse,
norm=True
)
copy
def copy(
self
)
cut
def cut(
self,
start=0.0,
length=1.0
)
Copy a portion of this soundbuffer, returning
a new soundbuffer with the selected slice.
The start
param is a position in seconds to begin
cutting, and the length
param is the cut length in seconds.
Overflowing values that exceed the boundries of the source SoundBuffer
will return a SoundBuffer padded with silence so that the length
param
is always respected.
dub
def dub(
self,
sounds,
pos=0.0,
framepos=0
)
Dub a sound or iterable of sounds into this soundbuffer
starting at the given position in fractional seconds.
>>> snd.dub(snd2, 3.2)
To dub starting at a specific frame position use:
>>> snd.dub(snd3, framepos=111)
env
def env(
self,
window=None
)
Apply an amplitude envelope
to the sound of the given type.
To modulate a sound with an arbitrary iterable, simply do:
>>> snd * iterable
Where iterable is a list, array, or SoundBuffer with the same # of channels and of any length
fcut
def fcut(
self,
start=0,
length=1
)
Copy a portion of this soundbuffer, returning
a new soundbuffer with the selected slice.
Identical to cut
except start
and length
should be given in frames instead of seconds.
fdub
def fdub(
self,
sounds,
framepos=0
)
fill
def fill(
self,
length
)
grains
def grains(
self,
minlength,
maxlength=-1.0
)
Iterate over the buffer in fixed-size grains.
If a second length is given, iterate in randomly-sized grains, given the minimum and maximum sizes.
graph
def graph(
self,
*args,
**kwargs
)
mix
def mix(
self,
sounds
)
Mix this sound in place with an iterable of sounds
pad
def pad(
self,
before=0.0,
after=0.0,
samples=False
)
Pad this sound with silence at before or after
pan
def pan(
self,
pos=0.5,
method=None
)
Pan a stereo sound from pos=0
(hard left) to pos=1
(hard right)
Different panning strategies can be chosen by passing a value to the method
param.
method='constant'
Constant (square) power panning. This is the default.method='linear'
Simple linear panning.method='sine'
Variation on constant power panning using sin() and cos() to shape the pan. Taken from the floss manuals csound manual.method='gogins'
Michael Gogins' variation on the above which uses a different part of the sinewave. Also taken from the floss csound manual!
plot
def plot(
self
)
rcut
def rcut(
self,
length=1.0
)
Copy a portion of this SoundBuffer of the
given length in seconds starting from a random position within it.
This will always return a complete SoundBuffer without overflows or added silence, and the entire sound will be returned without added silence if a length that exceeds the length of the source SoundBuffer is given -- unlike SoundBuffer.cut() which will pad results with silence to preserve the length param if an invalid or overflowing offset position is given.
remix
def remix(
self,
channels
)
repeat
def repeat(
self,
repeats
)
reverse
def reverse(
self
)
reversed
def reversed(
self
)
softclip
def softclip(
self
)
speed
def speed(
self,
speed,
interpolation=None
)
Change the speed of the sound
taper
def taper(
self,
start,
end=-1.0
)
toenv
def toenv(
self,
window=0.01
)
towavetable
def towavetable(
self,
*args,
**kwargs
)
trim
def trim(
self,
start=False,
end=True,
threshold=0.0,
window=4
)
Trim silence below a given threshold from the end (and/or start) of the buffer
vspeed
def vspeed(
self,
speed,
interpolation=None
)
write
def write(
self,
filename=None
)
Write the contents of this buffer to disk
in the given audio file format. (WAV, AIFF, AU)
SoundBufferError
class SoundBufferError(
/,
*args,
**kwargs
)
Common base class for all non-exit exceptions.
Ancestors (in MRO)
- builtins.Exception
- builtins.BaseException
Class variables
args
Methods
with_traceback
def with_traceback(
...
)
Exception.with_traceback(tb) --
set self.traceback to tb and return self.